NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / website_settings / website_settings_ui.h
blob2c45c5e5f26e026bafdc3deb85a4239e0da1bec2
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 "chrome/common/content_settings.h"
14 #include "chrome/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();
64 // Site permission |type|.
65 ContentSettingsType type;
66 // The current value for the permission |type| (e.g. ALLOW or BLOCK).
67 ContentSetting setting;
68 // The global default settings for this permission |type|.
69 ContentSetting default_setting;
70 // The settings source e.g. user, extensions, policy, ... .
71 content_settings::SettingSource source;
74 // |IdentityInfo| contains information about the site's identity and
75 // connection.
76 struct IdentityInfo {
77 IdentityInfo();
78 ~IdentityInfo();
80 // The site's identity.
81 std::string site_identity;
82 // Status of the site's identity.
83 WebsiteSettings::SiteIdentityStatus identity_status;
84 // Helper to get the status text to display to the user.
85 base::string16 GetIdentityStatusText() const;
86 // Textual description of the site's identity status that is displayed to
87 // the user.
88 std::string identity_status_description;
89 // The ID is the server certificate of a secure connection or 0.
90 int cert_id;
91 // Signed Certificate Timestamp ids and status
92 content::SignedCertificateTimestampIDStatusList
93 signed_certificate_timestamp_ids;
94 // Status of the site's connection.
95 WebsiteSettings::SiteConnectionStatus connection_status;
96 // Textual description of the site's connection status that is displayed to
97 // the user.
98 std::string connection_status_description;
101 typedef std::vector<CookieInfo> CookieInfoList;
102 typedef std::vector<PermissionInfo> PermissionInfoList;
104 virtual ~WebsiteSettingsUI();
106 // Returns the UI string for the given permission |type|.
107 static base::string16 PermissionTypeToUIString(ContentSettingsType type);
109 // Returns the UI string for the given permission |value|, used in the
110 // permission-changing menu. Generally this will be a verb in the imperative
111 // form, e.g. "ask", "allow", "block".
112 static base::string16 PermissionValueToUIString(ContentSetting value);
114 // Returns the UI string describing the action taken for a permission,
115 // including why that action was taken. E.g. "Allowed by you",
116 // "Blocked by default".
117 static base::string16 PermissionActionToUIString(
118 ContentSetting setting,
119 ContentSetting default_setting,
120 content_settings::SettingSource source);
122 // Returns the icon resource ID for the given permission |type| and |setting|.
123 static int GetPermissionIconID(ContentSettingsType type,
124 ContentSetting setting);
126 // Returns the icon for the given permission |type| and |setting|.
127 static const gfx::Image& GetPermissionIcon(ContentSettingsType type,
128 ContentSetting setting);
130 // Returns the identity icon ID for the given identity |status|.
131 static int GetIdentityIconID(WebsiteSettings::SiteIdentityStatus status);
133 // Returns the identity icon for the given identity |status|.
134 static const gfx::Image& GetIdentityIcon(
135 WebsiteSettings::SiteIdentityStatus status);
137 // Returns the connection icon ID for the given connection |status|.
138 static int GetConnectionIconID(
139 WebsiteSettings::SiteConnectionStatus status);
141 // Returns the connection icon for the given connection |status|.
142 static const gfx::Image& GetConnectionIcon(
143 WebsiteSettings::SiteConnectionStatus status);
145 // Returns the icon ID to show along with the first visit information.
146 static int GetFirstVisitIconID(const base::string16& first_visit);
148 // Returns the icon to show along with the first visit information.
149 static const gfx::Image& GetFirstVisitIcon(const base::string16& first_visit);
151 // Sets cookie information.
152 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
154 // Sets permision information.
155 virtual void SetPermissionInfo(
156 const PermissionInfoList& permission_info_list) = 0;
158 // Sets site identity information.
159 virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0;
161 // Sets the first visited data. |first_visit| can be an empty string.
162 virtual void SetFirstVisit(const base::string16& first_visit) = 0;
164 // Selects the tab with the given |tab_id|.
165 virtual void SetSelectedTab(TabId tab_id) = 0;
168 typedef WebsiteSettingsUI::CookieInfoList CookieInfoList;
169 typedef WebsiteSettingsUI::PermissionInfoList PermissionInfoList;
171 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_WEBSITE_SETTINGS_UI_H_