File: page_info_bubble_view.h

package info (click to toggle)
chromium 139.0.7258.138-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,120,676 kB
  • sloc: cpp: 35,100,869; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (102 lines) | stat: -rw-r--r-- 4,024 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_H_

#include "base/memory/raw_ptr.h"
#include "chrome/browser/ui/page_info/page_info_dialog.h"
#include "chrome/browser/ui/views/page_info/page_info_bubble_view_base.h"
#include "chrome/browser/ui/views/page_info/page_info_history_controller.h"
#include "chrome/browser/ui/views/page_info/page_info_navigation_handler.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/page_info/core/page_info_types.h"
#include "ui/base/metadata/metadata_header_macros.h"

class ChromePageInfoUiDelegate;
class PageSwitcherView;
class PageInfoViewFactory;
class PageInfoMerchantTrustCoordinator;

// The views implementation of the page info UI.
class PageInfoBubbleView : public PageInfoBubbleViewBase,
                           public PageInfoNavigationHandler {
  METADATA_HEADER(PageInfoBubbleView, PageInfoBubbleViewBase)

 public:
  // The column set id of the permissions table for |permissions_view_|.
  static constexpr int kPermissionColumnSetId = 0;

  ~PageInfoBubbleView() override;

  // Creates the appropriate page info bubble for the given |url|.
  // |anchor_view| will be used to place the bubble.  If |anchor_view| is null,
  // |anchor_rect| will be used instead.  |parent_window| will become the
  // parent of the widget hosting the bubble view.
  static views::BubbleDialogDelegateView* CreatePageInfoBubble(
      views::View* anchor_view,
      const gfx::Rect& anchor_rect,
      gfx::NativeWindow parent_window,
      content::WebContents* web_contents,
      const GURL& url,
      base::OnceClosure initialized_callback,
      PageInfoClosingCallback closing_callback,
      bool allow_extended_site_info,
      std::optional<ContentSettingsType> type = std::nullopt,
      bool open_merchant_trust_page = false);

  // PageInfoNavigationHandler:
  void OpenMainPage(base::OnceClosure initialized_callback) override;
  void OpenSecurityPage() override;
  void OpenPermissionPage(ContentSettingsType type) override;
  void OpenAdPersonalizationPage() override;
  void OpenCookiesPage() override;
  void OpenPrivacyAndSiteDataPage() override;
  void OpenMerchantTrustPage(
      page_info::MerchantBubbleOpenReferrer referrer) override;
  void CloseBubble() override;

  // WebContentsObserver:
  void DidChangeVisibleSecurityState() override;

  PageInfo* presenter_for_testing() { return presenter_.get(); }

 private:
  PageInfoBubbleView(views::View* anchor_view,
                     const gfx::Rect& anchor_rect,
                     gfx::NativeView parent_window,
                     content::WebContents* web_contents,
                     const GURL& url,
                     base::OnceClosure initialized_callback,
                     PageInfoClosingCallback closing_callback,
                     bool allow_extended_site_info);

  // PageInfoBubbleViewBase:
  gfx::Size CalculatePreferredSize(
      const views::SizeBounds& available_size) const override;
  void OnWidgetDestroying(views::Widget* widget) override;
  void WebContentsDestroyed() override;
  void ChildPreferredSizeChanged(views::View* child) override;

  void AnnouncePageOpened(std::u16string announcement);

  // The presenter that controls the Page Info UI.
  std::unique_ptr<PageInfo> presenter_;

  std::unique_ptr<ChromePageInfoUiDelegate> ui_delegate_;

  std::unique_ptr<PageInfoViewFactory> view_factory_;

  std::unique_ptr<PageInfoHistoryController> history_controller_;

  std::unique_ptr<PageInfoMerchantTrustCoordinator> merchant_trust_coordinator_;

  raw_ptr<PageSwitcherView> page_container_ = nullptr;

  PageInfoClosingCallback closing_callback_;

  base::WeakPtrFactory<PageInfoBubbleView> weak_factory_{this};
};

#endif  // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_BUBBLE_VIEW_H_