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_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_ |
6 #define CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_UI_H_ | 6 #define CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "chrome/browser/ui/page_info/website_settings.h" | 13 #include "chrome/browser/ui/page_info/page_info.h" |
14 #include "components/content_settings/core/common/content_settings.h" | 14 #include "components/content_settings/core/common/content_settings.h" |
15 #include "components/content_settings/core/common/content_settings_types.h" | 15 #include "components/content_settings/core/common/content_settings_types.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 | 17 |
18 class Profile; | 18 class Profile; |
19 class WebsiteSettings; | 19 class PageInfo; |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 class Image; | 22 class Image; |
23 } | 23 } |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 class X509Certificate; | 26 class X509Certificate; |
27 } | 27 } |
28 | 28 |
29 // The class |WebsiteSettingsUI| specifies the platform independent | 29 // The class |PageInfoUI| specifies the platform independent |
30 // interface of the website settings UI. The website settings UI displays | 30 // interface of the page info UI. The page info UI displays |
31 // information and controls for site specific data (local stored objects like | 31 // information and controls for site specific data (local stored objects like |
32 // cookies), site specific permissions (location, popup, plugin, etc. | 32 // cookies), site specific permissions (location, popup, plugin, etc. |
33 // permissions) and site specific information (identity, connection status, | 33 // permissions) and site specific information (identity, connection status, |
34 // etc.). | 34 // etc.). |
35 class WebsiteSettingsUI { | 35 class PageInfoUI { |
36 public: | 36 public: |
37 // The Website Settings UI contains several tabs. Each tab is associated with | 37 // The Page Info UI contains several tabs. Each tab is associated with |
38 // a unique tab id. The enum |TabId| contains all the ids for the tabs. | 38 // a unique tab id. The enum |TabId| contains all the ids for the tabs. |
39 enum TabId { | 39 enum TabId { |
40 TAB_ID_PERMISSIONS = 0, | 40 TAB_ID_PERMISSIONS = 0, |
41 TAB_ID_CONNECTION, | 41 TAB_ID_CONNECTION, |
42 NUM_TAB_IDS, | 42 NUM_TAB_IDS, |
43 }; | 43 }; |
44 | 44 |
45 // The security summary is styled depending on the security state. At the | 45 // The security summary is styled depending on the security state. At the |
46 // moment, the only styling we apply is color, but it could also include e.g. | 46 // moment, the only styling we apply is color, but it could also include e.g. |
47 // bolding. | 47 // bolding. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ContentSetting default_setting; | 82 ContentSetting default_setting; |
83 // The settings source e.g. user, extensions, policy, ... . | 83 // The settings source e.g. user, extensions, policy, ... . |
84 content_settings::SettingSource source; | 84 content_settings::SettingSource source; |
85 // Whether the profile is off the record. | 85 // Whether the profile is off the record. |
86 bool is_incognito; | 86 bool is_incognito; |
87 }; | 87 }; |
88 | 88 |
89 // |ChosenObjectInfo| contains information about a single |object| of a | 89 // |ChosenObjectInfo| contains information about a single |object| of a |
90 // chooser |type| that the current website has been granted access to. | 90 // chooser |type| that the current website has been granted access to. |
91 struct ChosenObjectInfo { | 91 struct ChosenObjectInfo { |
92 ChosenObjectInfo(const WebsiteSettings::ChooserUIInfo& ui_info, | 92 ChosenObjectInfo(const PageInfo::ChooserUIInfo& ui_info, |
93 std::unique_ptr<base::DictionaryValue> object); | 93 std::unique_ptr<base::DictionaryValue> object); |
94 ~ChosenObjectInfo(); | 94 ~ChosenObjectInfo(); |
95 // |ui_info| for this chosen object type. | 95 // |ui_info| for this chosen object type. |
96 const WebsiteSettings::ChooserUIInfo& ui_info; | 96 const PageInfo::ChooserUIInfo& ui_info; |
97 // The opaque |object| representing the thing the user selected. | 97 // The opaque |object| representing the thing the user selected. |
98 std::unique_ptr<base::DictionaryValue> object; | 98 std::unique_ptr<base::DictionaryValue> object; |
99 }; | 99 }; |
100 | 100 |
101 // |IdentityInfo| contains information about the site's identity and | 101 // |IdentityInfo| contains information about the site's identity and |
102 // connection. | 102 // connection. |
103 struct IdentityInfo { | 103 struct IdentityInfo { |
104 IdentityInfo(); | 104 IdentityInfo(); |
105 ~IdentityInfo(); | 105 ~IdentityInfo(); |
106 | 106 |
107 // The site's identity: the certificate's Organization Name for sites with | 107 // The site's identity: the certificate's Organization Name for sites with |
108 // Extended Validation certificates, or the URL's hostname for all other | 108 // Extended Validation certificates, or the URL's hostname for all other |
109 // sites. | 109 // sites. |
110 std::string site_identity; | 110 std::string site_identity; |
111 // Status of the site's identity. | 111 // Status of the site's identity. |
112 WebsiteSettings::SiteIdentityStatus identity_status; | 112 PageInfo::SiteIdentityStatus identity_status; |
113 // Helper to get security description info to display to the user. | 113 // Helper to get security description info to display to the user. |
114 std::unique_ptr<SecurityDescription> GetSecurityDescription() const; | 114 std::unique_ptr<SecurityDescription> GetSecurityDescription() const; |
115 // Textual description of the site's identity status that is displayed to | 115 // Textual description of the site's identity status that is displayed to |
116 // the user. | 116 // the user. |
117 std::string identity_status_description; | 117 std::string identity_status_description; |
118 // The server certificate if a secure connection. | 118 // The server certificate if a secure connection. |
119 scoped_refptr<net::X509Certificate> certificate; | 119 scoped_refptr<net::X509Certificate> certificate; |
120 // Status of the site's connection. | 120 // Status of the site's connection. |
121 WebsiteSettings::SiteConnectionStatus connection_status; | 121 PageInfo::SiteConnectionStatus connection_status; |
122 // Textual description of the site's connection status that is displayed to | 122 // Textual description of the site's connection status that is displayed to |
123 // the user. | 123 // the user. |
124 std::string connection_status_description; | 124 std::string connection_status_description; |
125 // Set when the user has explicitly bypassed an SSL error for this host and | 125 // Set when the user has explicitly bypassed an SSL error for this host and |
126 // has a flag set to remember ssl decisions (explicit flag or in the | 126 // has a flag set to remember ssl decisions (explicit flag or in the |
127 // experimental group). When |show_ssl_decision_revoke_button| is true, the | 127 // experimental group). When |show_ssl_decision_revoke_button| is true, the |
128 // connection area of the page info will include an option for the user to | 128 // connection area of the page info will include an option for the user to |
129 // revoke their decision to bypass the SSL error for this host. | 129 // revoke their decision to bypass the SSL error for this host. |
130 bool show_ssl_decision_revoke_button; | 130 bool show_ssl_decision_revoke_button; |
131 }; | 131 }; |
132 | 132 |
133 using CookieInfoList = std::vector<CookieInfo>; | 133 using CookieInfoList = std::vector<CookieInfo>; |
134 using PermissionInfoList = std::vector<PermissionInfo>; | 134 using PermissionInfoList = std::vector<PermissionInfo>; |
135 using ChosenObjectInfoList = std::vector<std::unique_ptr<ChosenObjectInfo>>; | 135 using ChosenObjectInfoList = std::vector<std::unique_ptr<ChosenObjectInfo>>; |
136 | 136 |
137 virtual ~WebsiteSettingsUI(); | 137 virtual ~PageInfoUI(); |
138 | 138 |
139 // Returns the UI string for the given permission |type|. | 139 // Returns the UI string for the given permission |type|. |
140 static base::string16 PermissionTypeToUIString(ContentSettingsType type); | 140 static base::string16 PermissionTypeToUIString(ContentSettingsType type); |
141 | 141 |
142 // Returns the UI string for the given permission |value|, used in the | 142 // Returns the UI string for the given permission |value|, used in the |
143 // permission-changing menu. Generally this will be a verb in the imperative | 143 // permission-changing menu. Generally this will be a verb in the imperative |
144 // form, e.g. "ask", "allow", "block". | 144 // form, e.g. "ask", "allow", "block". |
145 static base::string16 PermissionValueToUIString(ContentSetting value); | 145 static base::string16 PermissionValueToUIString(ContentSetting value); |
146 | 146 |
147 // Returns the UI string describing the action taken for a permission, | 147 // Returns the UI string describing the action taken for a permission, |
(...skipping 17 matching lines...) Expand all Loading... |
165 static const gfx::Image& GetPermissionIcon(const PermissionInfo& info); | 165 static const gfx::Image& GetPermissionIcon(const PermissionInfo& info); |
166 | 166 |
167 // Returns the UI string describing the given object |info|. | 167 // Returns the UI string describing the given object |info|. |
168 static base::string16 ChosenObjectToUIString(const ChosenObjectInfo& info); | 168 static base::string16 ChosenObjectToUIString(const ChosenObjectInfo& info); |
169 | 169 |
170 // Returns the icon for the given object |info|. | 170 // Returns the icon for the given object |info|. |
171 static const gfx::Image& GetChosenObjectIcon(const ChosenObjectInfo& info, | 171 static const gfx::Image& GetChosenObjectIcon(const ChosenObjectInfo& info, |
172 bool deleted); | 172 bool deleted); |
173 | 173 |
174 // Returns the identity icon ID for the given identity |status|. | 174 // Returns the identity icon ID for the given identity |status|. |
175 static int GetIdentityIconID(WebsiteSettings::SiteIdentityStatus status); | 175 static int GetIdentityIconID(PageInfo::SiteIdentityStatus status); |
176 | 176 |
177 // Returns the identity icon for the given identity |status|. | 177 // Returns the identity icon for the given identity |status|. |
178 static const gfx::Image& GetIdentityIcon( | 178 static const gfx::Image& GetIdentityIcon(PageInfo::SiteIdentityStatus status); |
179 WebsiteSettings::SiteIdentityStatus status); | |
180 | 179 |
181 // Returns the connection icon ID for the given connection |status|. | 180 // Returns the connection icon ID for the given connection |status|. |
182 static int GetConnectionIconID(WebsiteSettings::SiteConnectionStatus status); | 181 static int GetConnectionIconID(PageInfo::SiteConnectionStatus status); |
183 | 182 |
184 // Returns the connection icon for the given connection |status|. | 183 // Returns the connection icon for the given connection |status|. |
185 static const gfx::Image& GetConnectionIcon( | 184 static const gfx::Image& GetConnectionIcon( |
186 WebsiteSettings::SiteConnectionStatus status); | 185 PageInfo::SiteConnectionStatus status); |
187 | 186 |
188 // Sets cookie information. | 187 // Sets cookie information. |
189 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0; | 188 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0; |
190 | 189 |
191 // Sets permission information. | 190 // Sets permission information. |
192 virtual void SetPermissionInfo( | 191 virtual void SetPermissionInfo( |
193 const PermissionInfoList& permission_info_list, | 192 const PermissionInfoList& permission_info_list, |
194 ChosenObjectInfoList chosen_object_info_list) = 0; | 193 ChosenObjectInfoList chosen_object_info_list) = 0; |
195 | 194 |
196 // Sets site identity information. | 195 // Sets site identity information. |
197 virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0; | 196 virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0; |
198 }; | 197 }; |
199 | 198 |
200 typedef WebsiteSettingsUI::CookieInfoList CookieInfoList; | 199 typedef PageInfoUI::CookieInfoList CookieInfoList; |
201 typedef WebsiteSettingsUI::PermissionInfoList PermissionInfoList; | 200 typedef PageInfoUI::PermissionInfoList PermissionInfoList; |
202 typedef WebsiteSettingsUI::ChosenObjectInfoList ChosenObjectInfoList; | 201 typedef PageInfoUI::ChosenObjectInfoList ChosenObjectInfoList; |
203 | 202 |
204 #endif // CHROME_BROWSER_UI_PAGE_INFO_WEBSITE_SETTINGS_UI_H_ | 203 #endif // CHROME_BROWSER_UI_PAGE_INFO_PAGE_INFO_UI_H_ |
OLD | NEW |