Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / website_settings / website_settings_ui.h
blob912cf3f613dc7f2e8704d426f06e9600648f5d09
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_UI_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_UI_H_
8 #include <string>
9 #include <vector>
11 #include "base/strings/string16.h"
12 #include "chrome/browser/ui/website_settings/website_settings.h"
13 #include "components/content_settings/core/common/content_settings.h"
14 #include "components/content_settings/core/common/content_settings_types.h"
15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h"
16 #include "ui/gfx/native_widget_types.h"
19 class GURL;
20 class Profile;
21 class WebsiteSettings;
22 namespace content {
23 struct SSLStatus;
26 namespace gfx {
27 class Image;
30 // The class |WebsiteSettingsUI| specifies the platform independent
31 // interface of the website settings UI. The website settings UI displays
32 // information and controls for site specific data (local stored objects like
33 // cookies), site specific permissions (location, popup, plugin, etc.
34 // permissions) and site specific information (identity, connection status,
35 // etc.).
36 class WebsiteSettingsUI {
37 public:
38 // The Website Settings UI contains several tabs. Each tab is assiciated with
39 // a unique tab id. The enum |TabId| contains all the ids for the tabs.
40 enum TabId {
41 TAB_ID_PERMISSIONS = 0,
42 TAB_ID_CONNECTION,
43 NUM_TAB_IDS,
46 // |CookieInfo| contains information about the cookies from a specific source.
47 // A source can for example be a specific origin or an entire domain.
48 struct CookieInfo {
49 CookieInfo();
51 // String describing the cookie source.
52 std::string cookie_source;
53 // The number of allowed cookies.
54 int allowed;
55 // The number of blocked cookies.
56 int blocked;
59 // |PermissionInfo| contains information about a single permission |type| for
60 // the current website.
61 struct PermissionInfo {
62 PermissionInfo();
63 // Site permission |type|.
64 ContentSettingsType type;
65 // The current value for the permission |type| (e.g. ALLOW or BLOCK).
66 ContentSetting setting;
67 // The global default settings for this permission |type|.
68 ContentSetting default_setting;
69 // The settings source e.g. user, extensions, policy, ... .
70 content_settings::SettingSource source;
73 // |IdentityInfo| contains information about the site's identity and
74 // connection.
75 struct IdentityInfo {
76 IdentityInfo();
77 ~IdentityInfo();
79 // The site's identity: the certificate's Organization Name for sites with
80 // Extended Validation certificates, or the URL's hostname for all other
81 // sites.
82 std::string site_identity;
83 // Status of the site's identity.
84 WebsiteSettings::SiteIdentityStatus identity_status;
85 // Helper to get the status text to display to the user.
86 base::string16 GetIdentityStatusText() const;
87 // Textual description of the site's identity status that is displayed to
88 // the user.
89 std::string identity_status_description;
90 // The ID is the server certificate of a secure connection or 0.
91 int cert_id;
92 // Signed Certificate Timestamp ids and status
93 content::SignedCertificateTimestampIDStatusList
94 signed_certificate_timestamp_ids;
95 // Status of the site's connection.
96 WebsiteSettings::SiteConnectionStatus connection_status;
97 // Textual description of the site's connection status that is displayed to
98 // the user.
99 std::string connection_status_description;
100 // Set when the user has explicitly bypassed an SSL error for this host and
101 // has a flag set to remember ssl decisions (explicit flag or in the
102 // experimental group). When |show_ssl_decision_revoke_button| is true, the
103 // connection area of the page info will include an option for the user to
104 // revoke their decision to bypass the SSL error for this host.
105 bool show_ssl_decision_revoke_button;
108 typedef std::vector<CookieInfo> CookieInfoList;
110 typedef std::vector<PermissionInfo> PermissionInfoList;
112 virtual ~WebsiteSettingsUI();
114 // Returns the UI string for the given permission |type|.
115 static base::string16 PermissionTypeToUIString(ContentSettingsType type);
117 // Returns the UI string for the given permission |value|, used in the
118 // permission-changing menu. Generally this will be a verb in the imperative
119 // form, e.g. "ask", "allow", "block".
120 static base::string16 PermissionValueToUIString(ContentSetting value);
122 // Returns the UI string describing the action taken for a permission,
123 // including why that action was taken. E.g. "Allowed by you",
124 // "Blocked by default".
125 static base::string16 PermissionActionToUIString(
126 ContentSettingsType type,
127 ContentSetting setting,
128 ContentSetting default_setting,
129 content_settings::SettingSource source);
131 // Returns the icon resource ID for the given permission |type| and |setting|.
132 static int GetPermissionIconID(ContentSettingsType type,
133 ContentSetting setting);
135 // Returns the icon for the given permissionInfo |info|. If |info|'s current
136 // setting is CONTENT_SETTING_DEFAULT, it will return the icon for |info|'s
137 // default setting.
138 static const gfx::Image& GetPermissionIcon(const PermissionInfo& info);
140 // Returns the identity icon ID for the given identity |status|.
141 static int GetIdentityIconID(WebsiteSettings::SiteIdentityStatus status);
143 // Returns the identity icon for the given identity |status|.
144 static const gfx::Image& GetIdentityIcon(
145 WebsiteSettings::SiteIdentityStatus status);
147 // Returns the connection icon ID for the given connection |status|.
148 static int GetConnectionIconID(
149 WebsiteSettings::SiteConnectionStatus status);
151 // Returns the connection icon for the given connection |status|.
152 static const gfx::Image& GetConnectionIcon(
153 WebsiteSettings::SiteConnectionStatus status);
155 // Returns the icon ID to show along with the first visit information.
156 static int GetFirstVisitIconID(const base::string16& first_visit);
158 // Returns the icon to show along with the first visit information.
159 static const gfx::Image& GetFirstVisitIcon(const base::string16& first_visit);
161 // Sets cookie information.
162 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
164 // Sets permision information.
165 virtual void SetPermissionInfo(
166 const PermissionInfoList& permission_info_list) = 0;
168 // Sets site identity information.
169 virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0;
171 // Sets the first visited data. |first_visit| can be an empty string.
172 virtual void SetFirstVisit(const base::string16& first_visit) = 0;
174 // Selects the tab with the given |tab_id|.
175 virtual void SetSelectedTab(TabId tab_id) = 0;
178 typedef WebsiteSettingsUI::CookieInfoList CookieInfoList;
179 typedef WebsiteSettingsUI::PermissionInfoList PermissionInfoList;
181 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_UI_H_