OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ |
msw
2017/04/05 17:05:52
Will you follow up to rename the files and other p
| |
6 #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/ui/page_info/page_info_ui.h" | 13 #include "chrome/browser/ui/page_info/page_info_ui.h" |
14 #include "chrome/browser/ui/views/page_info/chosen_object_row_observer.h" | 14 #include "chrome/browser/ui/views/page_info/chosen_object_row_observer.h" |
15 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" | 15 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 class X509Certificate; | 33 class X509Certificate; |
34 } | 34 } |
35 | 35 |
36 namespace security_state { | 36 namespace security_state { |
37 struct SecurityInfo; | 37 struct SecurityInfo; |
38 } // namespace security_state | 38 } // namespace security_state |
39 | 39 |
40 namespace test { | 40 namespace test { |
41 class PageInfoPopupViewTestApi; | 41 class PageInfoBubbleViewTestApi; |
42 } | 42 } |
43 | 43 |
44 namespace views { | 44 namespace views { |
45 class Link; | 45 class Link; |
46 class Widget; | 46 class Widget; |
47 } | 47 } |
48 | 48 |
49 enum : int { | 49 enum : int { |
50 // Left icon margin. | 50 // Left icon margin. |
51 kPermissionIconMarginLeft = 6, | 51 kPermissionIconMarginLeft = 6, |
52 // The width of the column that contains the permissions icons. | 52 // The width of the column that contains the permissions icons. |
53 kPermissionIconColumnWidth = 16, | 53 kPermissionIconColumnWidth = 16, |
54 }; | 54 }; |
55 | 55 |
56 // The views implementation of the page info UI. | 56 // The views implementation of the page info UI. |
57 class PageInfoPopupView : public content::WebContentsObserver, | 57 class PageInfoBubbleView : public content::WebContentsObserver, |
58 public PermissionSelectorRowObserver, | 58 public PermissionSelectorRowObserver, |
59 public ChosenObjectRowObserver, | 59 public ChosenObjectRowObserver, |
60 public views::BubbleDialogDelegateView, | 60 public views::BubbleDialogDelegateView, |
61 public views::ButtonListener, | 61 public views::ButtonListener, |
62 public views::LinkListener, | 62 public views::LinkListener, |
63 public views::StyledLabelListener, | 63 public views::StyledLabelListener, |
64 public PageInfoUI { | 64 public PageInfoUI { |
65 public: | 65 public: |
66 ~PageInfoPopupView() override; | 66 ~PageInfoBubbleView() override; |
67 | 67 |
68 // Type of the popup being displayed. | 68 // Type of the popup being displayed. |
69 enum PopupType { | 69 enum PopupType { |
70 POPUP_NONE, | 70 POPUP_NONE, |
71 // Usual page info bubble for websites. | 71 // Usual page info bubble for websites. |
72 POPUP_PAGE_INFO, | 72 POPUP_PAGE_INFO, |
73 // Custom bubble for internal pages like chrome:// and chrome-extensions://. | 73 // Custom bubble for internal pages like chrome:// and chrome-extensions://. |
74 POPUP_INTERNAL_PAGE | 74 POPUP_INTERNAL_PAGE |
75 }; | 75 }; |
76 | 76 |
77 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble. | 77 // If |anchor_view| is null, |anchor_rect| is used to anchor the bubble. |
78 static void ShowPopup(views::View* anchor_view, | 78 static void ShowPopup(views::View* anchor_view, |
79 const gfx::Rect& anchor_rect, | 79 const gfx::Rect& anchor_rect, |
80 Profile* profile, | 80 Profile* profile, |
81 content::WebContents* web_contents, | 81 content::WebContents* web_contents, |
82 const GURL& url, | 82 const GURL& url, |
83 const security_state::SecurityInfo& security_info); | 83 const security_state::SecurityInfo& security_info); |
84 | 84 |
85 // Returns the type of the popup bubble being shown. | 85 // Returns the type of the popup bubble being shown. |
86 static PopupType GetShownPopupType(); | 86 static PopupType GetShownPopupType(); |
87 | 87 |
88 private: | 88 private: |
89 friend class test::PageInfoPopupViewTestApi; | 89 friend class test::PageInfoBubbleViewTestApi; |
90 | 90 |
91 PageInfoPopupView(views::View* anchor_view, | 91 PageInfoBubbleView(views::View* anchor_view, |
92 gfx::NativeView parent_window, | 92 gfx::NativeView parent_window, |
93 Profile* profile, | 93 Profile* profile, |
94 content::WebContents* web_contents, | 94 content::WebContents* web_contents, |
95 const GURL& url, | 95 const GURL& url, |
96 const security_state::SecurityInfo& security_info); | 96 const security_state::SecurityInfo& security_info); |
97 | 97 |
98 // WebContentsObserver implementation. | 98 // WebContentsObserver implementation. |
99 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 99 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
100 void WebContentsDestroyed() override; | 100 void WebContentsDestroyed() override; |
101 | 101 |
102 // PermissionSelectorRowObserver implementation. | 102 // PermissionSelectorRowObserver implementation. |
103 void OnPermissionChanged( | 103 void OnPermissionChanged( |
104 const PageInfoUI::PermissionInfo& permission) override; | 104 const PageInfoUI::PermissionInfo& permission) override; |
105 | 105 |
106 // ChosenObjectRowObserver implementation. | 106 // ChosenObjectRowObserver implementation. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 views::View* permissions_view_; | 170 views::View* permissions_view_; |
171 | 171 |
172 // The certificate provided by the site, if one exists. | 172 // The certificate provided by the site, if one exists. |
173 scoped_refptr<net::X509Certificate> certificate_; | 173 scoped_refptr<net::X509Certificate> certificate_; |
174 | 174 |
175 // These rows bundle together all the |View|s involved in a single row of the | 175 // These rows bundle together all the |View|s involved in a single row of the |
176 // permissions section, and keep those views updated when the underlying | 176 // permissions section, and keep those views updated when the underlying |
177 // |Permission| changes. | 177 // |Permission| changes. |
178 std::vector<std::unique_ptr<PermissionSelectorRow>> selector_rows_; | 178 std::vector<std::unique_ptr<PermissionSelectorRow>> selector_rows_; |
179 | 179 |
180 base::WeakPtrFactory<PageInfoPopupView> weak_factory_; | 180 base::WeakPtrFactory<PageInfoBubbleView> weak_factory_; |
181 | 181 |
182 DISALLOW_COPY_AND_ASSIGN(PageInfoPopupView); | 182 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView); |
183 }; | 183 }; |
184 | 184 |
185 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ | 185 #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_POPUP_VIEW_H_ |
OLD | NEW |