Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/browser/website_settings.h

Issue 10440092: Remove any platform specific code from the chrome/browser/website_settings.* . (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort includes Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/website_settings_ui.cc ('k') | chrome/browser/website_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_WEBSITE_SETTINGS_H_
6 #define CHROME_BROWSER_WEBSITE_SETTINGS_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h"
10 #include "base/time.h"
11 #include "chrome/browser/cancelable_request.h"
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
13 #include "chrome/browser/history/history.h"
14 #include "chrome/common/content_settings.h"
15 #include "chrome/common/content_settings_types.h"
16 #include "googleurl/src/gurl.h"
17 #include "ui/gfx/native_widget_types.h"
18
19 namespace content {
20 class CertStore;
21 struct SSLStatus;
22 }
23
24 class HostContentSettingsMap;
25 class Profile;
26 class TabContentsWrapper;
27 class WebsiteSettingsUI;
28
29 // The |WebsiteSettings| provides information about a website's permissions,
30 // connection state and its identity. It owns a UI that displays the
31 // information and allows users to change the permissions. |WebsiteSettings|
32 // objects must be created on the heap. They destroy themselves after the UI is
33 // closed.
34 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver {
35 public:
36 // Status of a connection to a website.
37 enum SiteConnectionStatus {
38 SITE_CONNECTION_STATUS_UNKNOWN = 0, // No status available.
39 SITE_CONNECTION_STATUS_ENCRYPTED, // Connection is encrypted.
40 SITE_CONNECTION_STATUS_MIXED_CONTENT, // Site has unencrypted content.
41 SITE_CONNECTION_STATUS_UNENCRYPTED, // Connection is not encrypted.
42 SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, // Connection error occured.
43 SITE_CONNECTION_STATUS_INTERNAL_PAGE, // Internal site.
44 };
45
46 // Validation status of a website's identity.
47 enum SiteIdentityStatus {
48 // No status about the website's identity available.
49 SITE_IDENTITY_STATUS_UNKNOWN = 0,
50 // The website provided a valid certificate.
51 SITE_IDENTITY_STATUS_CERT,
52 // The website provided a valid EV certificate.
53 SITE_IDENTITY_STATUS_EV_CERT,
54 // The website provided a valid DNSSEC certificate.
55 SITE_IDENTITY_STATUS_DNSSEC_CERT,
56 // The website provided a valid certificate but no revocation check could be
57 // performed.
58 SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN,
59 // Site identity could not be verified because the site did not provide a
60 // certificate. This is the expected state for HTTP connections.
61 SITE_IDENTITY_STATUS_NO_CERT,
62 // An error occured while verifying the site identity.
63 SITE_IDENTITY_STATUS_ERROR,
64 // The site is a trusted internal chrome page.
65 SITE_IDENTITY_STATUS_INTERNAL_PAGE,
66 };
67
68 // Creates a |WebsiteSettingsModel| incl. a |WebsiteSettingsUI| and displays
69 // the UI. The |url| contains the omnibox URL of the currently active tab,
70 // |parent| contains the currently active window, |profile| contains the
71 // currently active profile and |ssl| contains the |SSLStatus| of the
72 // connection to the website in the currently active tab that is wrapped by
73 // the |tab_contents_wrapper|.
74 static void Show(gfx::NativeWindow parent,
75 Profile* profile,
76 TabContentsWrapper* tab_contents_wrapper,
77 const GURL& url,
78 const content::SSLStatus& ssl);
79
80 // Creates a WebsiteSettings for the passed |url| using the given |ssl| status
81 // object to determine the status of the site's connection. The
82 // |WebsiteSettings| takes ownership of the |ui|.
83 WebsiteSettings(WebsiteSettingsUI* ui,
84 Profile* profile,
85 TabSpecificContentSettings* tab_specific_content_settings,
86 const GURL& url,
87 const content::SSLStatus& ssl,
88 content::CertStore* cert_store);
89
90 // This method is called when the WebsiteSettingsUI is closed. It triggers
91 // the destruction of this |WebsiteSettings| object. So it is not safe to use
92 // this object afterwards. Any pointers to this object will be invalid.
93 void OnUIClosing();
94
95 // This method is called when ever a permission setting is changed.
96 void OnSitePermissionChanged(ContentSettingsType type,
97 ContentSetting value);
98
99 // Callback used for requests to fetch the number of page visits from history
100 // service and the time of the first visit.
101 void OnGotVisitCountToHost(HistoryService::Handle handle,
102 bool found_visits,
103 int visit_count,
104 base::Time first_visit);
105
106 // Accessors.
107 SiteConnectionStatus site_connection_status() const {
108 return site_connection_status_;
109 }
110
111 SiteIdentityStatus site_identity_status() const {
112 return site_identity_status_;
113 }
114
115 string16 site_connection_details() const {
116 return site_connection_details_;
117 }
118
119 string16 site_identity_details() const {
120 return site_identity_details_;
121 }
122
123 string16 organization_name() const {
124 return organization_name_;
125 }
126
127 // SiteDataObserver implementation.
128 virtual void OnSiteDataAccessed() OVERRIDE;
129
130 private:
131 virtual ~WebsiteSettings();
132
133 // Initializes the |WebsiteSettings|.
134 void Init(Profile* profile,
135 const GURL& url,
136 const content::SSLStatus& ssl);
137
138 // Sets (presents) the information about the site's permissions in the |ui_|.
139 void PresentSitePermissions();
140
141 // Sets (presents) the information about the site's data in the |ui_|.
142 void PresentSiteData();
143
144 // Sets (presents) the information about the site's identity and connection
145 // in the |ui_|.
146 void PresentSiteIdentity();
147
148 // Sets (presents) history information about the site in the |ui_|. Passing
149 // base::Time() as value for |first_visit| will clear the history information
150 // in the UI.
151 void PresentHistoryInfo(base::Time first_visit);
152
153 // The website settings UI displays information and controls for site
154 // specific data (local stored objects like cookies), site specific
155 // permissions (location, popup, plugin, etc. permissions) and site specific
156 // information (identity, connection status, etc.).
157 scoped_ptr<WebsiteSettingsUI> ui_;
158
159 // The Omnibox URL of the website for which to display site permissions and
160 // site information.
161 GURL site_url_;
162
163 // Status of the website's identity verification check.
164 SiteIdentityStatus site_identity_status_;
165
166 // For secure connection |cert_id_| is set to the ID of the server
167 // certificate. For non secure connections |cert_id_| is 0.
168 int cert_id_;
169
170 // Status of the connection to the website.
171 SiteConnectionStatus site_connection_status_;
172
173 // TODO(markusheintz): Move the creation of all the string16 typed UI
174 // strings below to the corresponding UI code, in order to prevent
175 // unnecessary UTF-8 string conversions.
176
177 // Details about the website's identity. If the website's identity has been
178 // verified then |site_identity_details_| contains who verified the identity.
179 // This string will be displayed in the UI.
180 string16 site_identity_details_;
181
182 // Details about the connection to the website. In case of an encrypted
183 // connection |site_connection_details_| contains encryption details, like
184 // encryption strength and ssl protocol version. This string will be
185 // displayed in the UI.
186 string16 site_connection_details_;
187
188 // For websites that provided an EV certificate |orgainization_name_|
189 // contains the organization name of the certificate. In all other cases
190 // |organization_name| is an empty string. This string will be displayed in
191 // the UI.
192 string16 organization_name_;
193
194 // The |CertStore| provides all X509Certificates.
195 content::CertStore* cert_store_;
196
197 // The |HostContentSettingsMap| is the service that provides and manages
198 // content settings (aka. site permissions).
199 HostContentSettingsMap* content_settings_;
200
201 // Used to request the number of page visits.
202 CancelableRequestConsumer visit_count_request_consumer_;
203
204 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings);
205 };
206
207 #endif // CHROME_BROWSER_WEBSITE_SETTINGS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings_ui.cc ('k') | chrome/browser/website_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698