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_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_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 "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
msw
2016/10/08 00:21:57
nit: remove
| |
14 #include "chrome/browser/ui/views/website_settings/chosen_object_row_observer.h" | 14 #include "chrome/browser/ui/views/website_settings/chosen_object_row_observer.h" |
15 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser ver.h" | 15 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser ver.h" |
16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
17 #include "components/security_state/security_state_model.h" | 17 #include "components/security_state/security_state_model.h" |
18 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
19 #include "ui/views/bubble/bubble_dialog_delegate.h" | 19 #include "ui/views/bubble/bubble_dialog_delegate.h" |
20 #include "ui/views/controls/button/button.h" | 20 #include "ui/views/controls/button/button.h" |
21 #include "ui/views/controls/link_listener.h" | 21 #include "ui/views/controls/link_listener.h" |
22 #include "ui/views/controls/separator.h" | 22 #include "ui/views/controls/separator.h" |
23 #include "ui/views/controls/styled_label_listener.h" | 23 #include "ui/views/controls/styled_label_listener.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
43 class Label; | 43 class Label; |
44 class LabelButton; | 44 class LabelButton; |
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 = 20, | 53 kPermissionIconColumnWidth = 16, |
54 }; | 54 }; |
55 | 55 |
56 // The views implementation of the website settings UI. | 56 // The views implementation of the website settings UI. |
57 class WebsiteSettingsPopupView : public content::WebContentsObserver, | 57 class WebsiteSettingsPopupView : 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, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 const PermissionInfoList& permission_info_list, | 123 const PermissionInfoList& permission_info_list, |
124 const ChosenObjectInfoList& chosen_object_info_list) override; | 124 const ChosenObjectInfoList& chosen_object_info_list) override; |
125 void SetIdentityInfo(const IdentityInfo& identity_info) override; | 125 void SetIdentityInfo(const IdentityInfo& identity_info) override; |
126 // TODO(lgarron): Remove SetSelectedTab() with https://crbug.com/571533 | 126 // TODO(lgarron): Remove SetSelectedTab() with https://crbug.com/571533 |
127 void SetSelectedTab(TabId tab_id) override; | 127 void SetSelectedTab(TabId tab_id) override; |
128 | 128 |
129 // Creates the contents of the |site_settings_view_|. The ownership of the | 129 // Creates the contents of the |site_settings_view_|. The ownership of the |
130 // returned view is transferred to the caller. | 130 // returned view is transferred to the caller. |
131 views::View* CreateSiteSettingsView() WARN_UNUSED_RESULT; | 131 views::View* CreateSiteSettingsView() WARN_UNUSED_RESULT; |
132 | 132 |
133 // The site settings view contains several sections with a |headline| | |
134 // followed by the section |contents| and an optional |link|. This method | |
135 // creates a section for the given |headline|, |contents| and |link|. |link| | |
136 // can be NULL if the section should not contain a link. | |
137 views::View* CreateSection(const base::string16& headline, | |
138 views::View* contents, | |
139 views::Link* link) WARN_UNUSED_RESULT; | |
140 | |
141 // Used to asynchronously handle clicks since these calls may cause the | 133 // Used to asynchronously handle clicks since these calls may cause the |
142 // destruction of the settings view and the base class window still needs to | 134 // destruction of the settings view and the base class window still needs to |
143 // be alive to finish handling the mouse or keyboard click. | 135 // be alive to finish handling the mouse or keyboard click. |
144 void HandleLinkClickedAsync(views::Link* source); | 136 void HandleLinkClickedAsync(views::Link* source); |
145 | 137 |
146 // Whether DevTools is disabled for the relevant profile. | 138 // Whether DevTools is disabled for the relevant profile. |
147 bool is_devtools_disabled_; | 139 bool is_devtools_disabled_; |
148 | 140 |
149 // The presenter that controls the Website Settings UI. | 141 // The presenter that controls the Website Settings UI. |
150 std::unique_ptr<WebsiteSettings> presenter_; | 142 std::unique_ptr<WebsiteSettings> presenter_; |
151 | 143 |
152 // The header section (containing security-related information). | 144 // The header section (containing security-related information). |
153 PopupHeaderView* header_; | 145 PopupHeaderView* header_; |
154 | 146 |
155 // The separator between the header and the site settings view. | 147 // The separator between the header and the site settings view. |
156 views::Separator* separator_; | 148 views::Separator* separator_; |
157 | 149 |
158 // The view that contains the site data and permissions sections. | 150 // The view that contains the cookie and permissions sections. |
159 views::View* site_settings_view_; | 151 views::View* site_settings_view_; |
160 // The view that contains the contents of the "Cookies and Site data" section | 152 // The view that contains the contents of the "Cookies" part of the site |
161 // of the site settings view. | 153 // settings view. |
162 views::View* site_data_content_; | 154 views::View* cookies_view_; |
163 // The link that opens the "Cookies" dialog. | 155 // The link that opens the "Cookies" dialog. |
164 views::Link* cookie_dialog_link_; | 156 views::Link* cookie_dialog_link_; |
165 // The view that contains the contents of the "Permissions" section | 157 // The view that contains the "Permissions" table of the site settings view. |
166 // of the site settings view. | 158 views::View* permissions_view_; |
167 views::View* permissions_content_; | |
168 | 159 |
169 // The certificate provided by the site, if one exists. | 160 // The certificate provided by the site, if one exists. |
170 scoped_refptr<net::X509Certificate> certificate_; | 161 scoped_refptr<net::X509Certificate> certificate_; |
171 | 162 |
172 // The link to open the site settings page that provides full control over | |
173 // the origin's permissions. | |
174 views::Link* site_settings_link_; | |
175 | |
176 base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_; | 163 base::WeakPtrFactory<WebsiteSettingsPopupView> weak_factory_; |
177 | 164 |
178 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView); | 165 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupView); |
179 }; | 166 }; |
180 | 167 |
181 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_ H_ | 168 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_VIEW_ H_ |
OLD | NEW |