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_PAGE_INFO_WEBSITE_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_ |
6 #define CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_H_ | 6 #define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
11 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
12 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
13 #include "components/security_state/core/security_state.h" | 13 #include "components/security_state/core/security_state.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 class X509Certificate; | 22 class X509Certificate; |
23 } | 23 } |
24 | 24 |
25 class ChromeSSLHostStateDelegate; | 25 class ChromeSSLHostStateDelegate; |
26 class ChooserContextBase; | 26 class ChooserContextBase; |
27 class HostContentSettingsMap; | 27 class HostContentSettingsMap; |
28 class Profile; | 28 class Profile; |
29 class WebsiteSettingsUI; | 29 class PageInfoUI; |
30 | 30 |
31 // The |WebsiteSettings| provides information about a website's permissions, | 31 // The |PageInfo| provides information about a website's permissions, |
32 // connection state and its identity. It owns a UI that displays the | 32 // connection state and its identity. It owns a UI that displays the |
33 // information and allows users to change the permissions. |WebsiteSettings| | 33 // information and allows users to change the permissions. |PageInfo| |
34 // objects must be created on the heap. They destroy themselves after the UI is | 34 // objects must be created on the heap. They destroy themselves after the UI is |
35 // closed. | 35 // closed. |
36 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver, | 36 class PageInfo : public TabSpecificContentSettings::SiteDataObserver, |
37 public content::WebContentsObserver { | 37 public content::WebContentsObserver { |
38 public: | 38 public: |
39 // TODO(palmer): Figure out if it is possible to unify SiteConnectionStatus | 39 // TODO(palmer): Figure out if it is possible to unify SiteConnectionStatus |
40 // and SiteIdentityStatus. | 40 // and SiteIdentityStatus. |
41 // | 41 // |
42 // Status of a connection to a website. | 42 // Status of a connection to a website. |
43 enum SiteConnectionStatus { | 43 enum SiteConnectionStatus { |
44 SITE_CONNECTION_STATUS_UNKNOWN = 0, // No status available. | 44 SITE_CONNECTION_STATUS_UNKNOWN = 0, // No status available. |
45 SITE_CONNECTION_STATUS_ENCRYPTED, // Connection is encrypted. | 45 SITE_CONNECTION_STATUS_ENCRYPTED, // Connection is encrypted. |
46 SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, // Non-secure passive | 46 SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE, // Non-secure passive |
47 // content. | 47 // content. |
(...skipping 28 matching lines...) Expand all Loading... |
76 // The website provided a valid certificate, but the certificate or chain | 76 // The website provided a valid certificate, but the certificate or chain |
77 // is using a deprecated signature algorithm. | 77 // is using a deprecated signature algorithm. |
78 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM, | 78 SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM, |
79 // The website has been flagged by Safe Browsing as dangerous for | 79 // The website has been flagged by Safe Browsing as dangerous for |
80 // containing malware, social engineering, or unwanted software. | 80 // containing malware, social engineering, or unwanted software. |
81 SITE_IDENTITY_STATUS_MALWARE, | 81 SITE_IDENTITY_STATUS_MALWARE, |
82 SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING, | 82 SITE_IDENTITY_STATUS_SOCIAL_ENGINEERING, |
83 SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE, | 83 SITE_IDENTITY_STATUS_UNWANTED_SOFTWARE, |
84 }; | 84 }; |
85 | 85 |
86 // UMA statistics for WebsiteSettings. Do not reorder or remove existing | 86 // UMA statistics for PageInfo. Do not reorder or remove existing |
87 // fields. A Java counterpart will be generated for this enum. | 87 // fields. A Java counterpart will be generated for this enum. |
88 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.page_info | 88 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.page_info |
89 enum WebsiteSettingsAction { | 89 enum PageInfoAction { |
90 WEBSITE_SETTINGS_OPENED = 0, | 90 PAGE_INFO_OPENED = 0, |
91 // No longer used; indicated actions for the old version of Page Info that | 91 // No longer used; indicated actions for the old version of Page Info that |
92 // had a "Permissions" tab and a "Connection" tab. | 92 // had a "Permissions" tab and a "Connection" tab. |
93 // WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED = 1, | 93 // PAGE_INFO_PERMISSIONS_TAB_SELECTED = 1, |
94 // WEBSITE_SETTINGS_CONNECTION_TAB_SELECTED = 2, | 94 // PAGE_INFO_CONNECTION_TAB_SELECTED = 2, |
95 // WEBSITE_SETTINGS_CONNECTION_TAB_SHOWN_IMMEDIATELY = 3, | 95 // PAGE_INFO_CONNECTION_TAB_SHOWN_IMMEDIATELY = 3, |
96 WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED = 4, | 96 PAGE_INFO_COOKIES_DIALOG_OPENED = 4, |
97 WEBSITE_SETTINGS_CHANGED_PERMISSION = 5, | 97 PAGE_INFO_CHANGED_PERMISSION = 5, |
98 WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED = 6, | 98 PAGE_INFO_CERTIFICATE_DIALOG_OPENED = 6, |
99 // No longer used; indicated a UI viewer for SCTs. | 99 // No longer used; indicated a UI viewer for SCTs. |
100 // WEBSITE_SETTINGS_TRANSPARENCY_VIEWER_OPENED = 7, | 100 // PAGE_INFO_TRANSPARENCY_VIEWER_OPENED = 7, |
101 WEBSITE_SETTINGS_CONNECTION_HELP_OPENED = 8, | 101 PAGE_INFO_CONNECTION_HELP_OPENED = 8, |
102 WEBSITE_SETTINGS_SITE_SETTINGS_OPENED = 9, | 102 PAGE_INFO_SITE_SETTINGS_OPENED = 9, |
103 WEBSITE_SETTINGS_SECURITY_DETAILS_OPENED = 10, | 103 PAGE_INFO_SECURITY_DETAILS_OPENED = 10, |
104 WEBSITE_SETTINGS_COUNT | 104 PAGE_INFO_COUNT |
105 }; | 105 }; |
106 | 106 |
107 struct ChooserUIInfo { | 107 struct ChooserUIInfo { |
108 ContentSettingsType content_settings_type; | 108 ContentSettingsType content_settings_type; |
109 ChooserContextBase* (*get_context)(Profile*); | 109 ChooserContextBase* (*get_context)(Profile*); |
110 int blocked_icon_id; | 110 int blocked_icon_id; |
111 int allowed_icon_id; | 111 int allowed_icon_id; |
112 int label_string_id; | 112 int label_string_id; |
113 int delete_tooltip_string_id; | 113 int delete_tooltip_string_id; |
114 const char* ui_name_key; | 114 const char* ui_name_key; |
115 }; | 115 }; |
116 | 116 |
117 // Creates a WebsiteSettings for the passed |url| using the given |ssl| status | 117 // Creates a PageInfo for the passed |url| using the given |ssl| status |
118 // object to determine the status of the site's connection. The | 118 // object to determine the status of the site's connection. The |
119 // |WebsiteSettings| takes ownership of the |ui|. | 119 // |PageInfo| takes ownership of the |ui|. |
120 WebsiteSettings(WebsiteSettingsUI* ui, | 120 PageInfo(PageInfoUI* ui, |
121 Profile* profile, | 121 Profile* profile, |
122 TabSpecificContentSettings* tab_specific_content_settings, | 122 TabSpecificContentSettings* tab_specific_content_settings, |
123 content::WebContents* web_contents, | 123 content::WebContents* web_contents, |
124 const GURL& url, | 124 const GURL& url, |
125 const security_state::SecurityInfo& security_info); | 125 const security_state::SecurityInfo& security_info); |
126 ~WebsiteSettings() override; | 126 ~PageInfo() override; |
127 | 127 |
128 void RecordWebsiteSettingsAction(WebsiteSettingsAction action); | 128 void RecordPageInfoAction(PageInfoAction action); |
129 | 129 |
130 // This method is called when ever a permission setting is changed. | 130 // This method is called when ever a permission setting is changed. |
131 void OnSitePermissionChanged(ContentSettingsType type, ContentSetting value); | 131 void OnSitePermissionChanged(ContentSettingsType type, ContentSetting value); |
132 | 132 |
133 // This method is called whenever access to an object is revoked. | 133 // This method is called whenever access to an object is revoked. |
134 void OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info, | 134 void OnSiteChosenObjectDeleted(const ChooserUIInfo& ui_info, |
135 const base::DictionaryValue& object); | 135 const base::DictionaryValue& object); |
136 | 136 |
137 // This method is called by the UI when the UI is closing. | 137 // This method is called by the UI when the UI is closing. |
138 void OnUIClosing(); | 138 void OnUIClosing(); |
(...skipping 11 matching lines...) Expand all Loading... |
150 SiteIdentityStatus site_identity_status() const { | 150 SiteIdentityStatus site_identity_status() const { |
151 return site_identity_status_; | 151 return site_identity_status_; |
152 } | 152 } |
153 | 153 |
154 base::string16 organization_name() const { return organization_name_; } | 154 base::string16 organization_name() const { return organization_name_; } |
155 | 155 |
156 // SiteDataObserver implementation. | 156 // SiteDataObserver implementation. |
157 void OnSiteDataAccessed() override; | 157 void OnSiteDataAccessed() override; |
158 | 158 |
159 private: | 159 private: |
160 // Initializes the |WebsiteSettings|. | 160 // Initializes the |PageInfo|. |
161 void Init(const GURL& url, const security_state::SecurityInfo& security_info); | 161 void Init(const GURL& url, const security_state::SecurityInfo& security_info); |
162 | 162 |
163 // Sets (presents) the information about the site's permissions in the |ui_|. | 163 // Sets (presents) the information about the site's permissions in the |ui_|. |
164 void PresentSitePermissions(); | 164 void PresentSitePermissions(); |
165 | 165 |
166 // Sets (presents) the information about the site's data in the |ui_|. | 166 // Sets (presents) the information about the site's data in the |ui_|. |
167 void PresentSiteData(); | 167 void PresentSiteData(); |
168 | 168 |
169 // Sets (presents) the information about the site's identity and connection | 169 // Sets (presents) the information about the site's identity and connection |
170 // in the |ui_|. | 170 // in the |ui_|. |
171 void PresentSiteIdentity(); | 171 void PresentSiteIdentity(); |
172 | 172 |
173 // The website settings UI displays information and controls for site- | 173 // The page info UI displays information and controls for site- |
174 // specific data (local stored objects like cookies), site-specific | 174 // specific data (local stored objects like cookies), site-specific |
175 // permissions (location, pop-up, plugin, etc. permissions) and site-specific | 175 // permissions (location, pop-up, plugin, etc. permissions) and site-specific |
176 // information (identity, connection status, etc.). | 176 // information (identity, connection status, etc.). |
177 WebsiteSettingsUI* ui_; | 177 PageInfoUI* ui_; |
178 | 178 |
179 // The flag that controls whether an infobar is displayed after the website | 179 // The flag that controls whether an infobar is displayed after the website |
180 // settings UI is closed or not. | 180 // settings UI is closed or not. |
181 bool show_info_bar_; | 181 bool show_info_bar_; |
182 | 182 |
183 // The Omnibox URL of the website for which to display site permissions and | 183 // The Omnibox URL of the website for which to display site permissions and |
184 // site information. | 184 // site information. |
185 GURL site_url_; | 185 GURL site_url_; |
186 | 186 |
187 // Status of the website's identity verification check. | 187 // Status of the website's identity verification check. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Service for managing SSL error page bypasses. Used to revoke bypass | 228 // Service for managing SSL error page bypasses. Used to revoke bypass |
229 // decisions by users. | 229 // decisions by users. |
230 ChromeSSLHostStateDelegate* chrome_ssl_host_state_delegate_; | 230 ChromeSSLHostStateDelegate* chrome_ssl_host_state_delegate_; |
231 | 231 |
232 bool did_revoke_user_ssl_decisions_; | 232 bool did_revoke_user_ssl_decisions_; |
233 | 233 |
234 Profile* profile_; | 234 Profile* profile_; |
235 | 235 |
236 security_state::SecurityLevel security_level_; | 236 security_state::SecurityLevel security_level_; |
237 | 237 |
238 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); | 238 DISALLOW_COPY_AND_ASSIGN(PageInfo); |
239 }; | 239 }; |
240 | 240 |
241 #endif // CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_H_ | 241 #endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_H_ |
OLD | NEW |