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

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: " 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
OLDNEW
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_WEBSITE_SETTINGS_H_ 5 #ifndef CHROME_BROWSER_WEBSITE_SETTINGS_H_
6 #define CHROME_BROWSER_WEBSITE_SETTINGS_H_ 6 #define CHROME_BROWSER_WEBSITE_SETTINGS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 13 matching lines...) Expand all
24 class HostContentSettingsMap; 24 class HostContentSettingsMap;
25 class Profile; 25 class Profile;
26 class TabContentsWrapper; 26 class TabContentsWrapper;
27 class WebsiteSettingsUI; 27 class WebsiteSettingsUI;
28 28
29 // The |WebsiteSettings| provides information about a website's permissions, 29 // The |WebsiteSettings| provides information about a website's permissions,
30 // connection state and its identity. It owns a UI that displays the 30 // connection state and its identity. It owns a UI that displays the
31 // information and allows users to change the permissions. |WebsiteSettings| 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 32 // objects must be created on the heap. They destroy themselves after the UI is
33 // closed. 33 // closed.
34 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver { 34 class WebsiteSettings : public TabSpecificContentSettings::SiteDataObserver {
tfarina 2012/05/31 19:23:01 I have another suggestion that you could consider,
markusheintz_ 2012/06/01 10:06:06 SGTM. Done.
35 public: 35 public:
36 // Status of a connection to a website. 36 // Status of a connection to a website.
37 enum SiteConnectionStatus { 37 enum SiteConnectionStatus {
38 SITE_CONNECTION_STATUS_UNKNOWN = 0, // No status available. 38 SITE_CONNECTION_STATUS_UNKNOWN = 0, // No status available.
39 SITE_CONNECTION_STATUS_ENCRYPTED, // Connection is encrypted. 39 SITE_CONNECTION_STATUS_ENCRYPTED, // Connection is encrypted.
40 SITE_CONNECTION_STATUS_MIXED_CONTENT, // Site has unencrypted content. 40 SITE_CONNECTION_STATUS_MIXED_CONTENT, // Site has unencrypted content.
41 SITE_CONNECTION_STATUS_UNENCRYPTED, // Connection is not encrypted. 41 SITE_CONNECTION_STATUS_UNENCRYPTED, // Connection is not encrypted.
42 SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, // Connection error occured. 42 SITE_CONNECTION_STATUS_ENCRYPTED_ERROR, // Connection error occured.
43 SITE_CONNECTION_STATUS_INTERNAL_PAGE, // Internal site. 43 SITE_CONNECTION_STATUS_INTERNAL_PAGE, // Internal site.
44 }; 44 };
(...skipping 13 matching lines...) Expand all
58 SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN, 58 SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN,
59 // Site identity could not be verified because the site did not provide a 59 // Site identity could not be verified because the site did not provide a
60 // certificate. This is the expected state for HTTP connections. 60 // certificate. This is the expected state for HTTP connections.
61 SITE_IDENTITY_STATUS_NO_CERT, 61 SITE_IDENTITY_STATUS_NO_CERT,
62 // An error occured while verifying the site identity. 62 // An error occured while verifying the site identity.
63 SITE_IDENTITY_STATUS_ERROR, 63 SITE_IDENTITY_STATUS_ERROR,
64 // The site is a trusted internal chrome page. 64 // The site is a trusted internal chrome page.
65 SITE_IDENTITY_STATUS_INTERNAL_PAGE, 65 SITE_IDENTITY_STATUS_INTERNAL_PAGE,
66 }; 66 };
67 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 68 // Creates a WebsiteSettings for the passed |url| using the given |ssl| status
81 // object to determine the status of the site's connection. The 69 // object to determine the status of the site's connection. The
82 // |WebsiteSettings| takes ownership of the |ui|. 70 // |WebsiteSettings| takes ownership of the |ui|.
83 WebsiteSettings(WebsiteSettingsUI* ui, 71 WebsiteSettings(WebsiteSettingsUI* ui,
84 Profile* profile, 72 Profile* profile,
85 TabSpecificContentSettings* tab_specific_content_settings, 73 TabSpecificContentSettings* tab_specific_content_settings,
86 const GURL& url, 74 const GURL& url,
87 const content::SSLStatus& ssl, 75 const content::SSLStatus& ssl,
88 content::CertStore* cert_store); 76 content::CertStore* cert_store);
89 77 virtual ~WebsiteSettings();
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 78
95 // This method is called when ever a permission setting is changed. 79 // This method is called when ever a permission setting is changed.
96 void OnSitePermissionChanged(ContentSettingsType type, 80 void OnSitePermissionChanged(ContentSettingsType type,
97 ContentSetting value); 81 ContentSetting value);
98 82
99 // Callback used for requests to fetch the number of page visits from history 83 // Callback used for requests to fetch the number of page visits from history
100 // service and the time of the first visit. 84 // service and the time of the first visit.
101 void OnGotVisitCountToHost(HistoryService::Handle handle, 85 void OnGotVisitCountToHost(HistoryService::Handle handle,
102 bool found_visits, 86 bool found_visits,
103 int visit_count, 87 int visit_count,
(...skipping 17 matching lines...) Expand all
121 } 105 }
122 106
123 string16 organization_name() const { 107 string16 organization_name() const {
124 return organization_name_; 108 return organization_name_;
125 } 109 }
126 110
127 // SiteDataObserver implementation. 111 // SiteDataObserver implementation.
128 virtual void OnSiteDataAccessed() OVERRIDE; 112 virtual void OnSiteDataAccessed() OVERRIDE;
129 113
130 private: 114 private:
131 virtual ~WebsiteSettings();
132
133 // Initializes the |WebsiteSettings|. 115 // Initializes the |WebsiteSettings|.
134 void Init(Profile* profile, 116 void Init(Profile* profile,
135 const GURL& url, 117 const GURL& url,
136 const content::SSLStatus& ssl); 118 const content::SSLStatus& ssl);
137 119
138 // Sets (presents) the information about the site's permissions in the |ui_|. 120 // Sets (presents) the information about the site's permissions in the |ui_|.
139 void PresentSitePermissions(); 121 void PresentSitePermissions();
140 122
141 // Sets (presents) the information about the site's data in the |ui_|. 123 // Sets (presents) the information about the site's data in the |ui_|.
142 void PresentSiteData(); 124 void PresentSiteData();
143 125
144 // Sets (presents) the information about the site's identity and connection 126 // Sets (presents) the information about the site's identity and connection
145 // in the |ui_|. 127 // in the |ui_|.
146 void PresentSiteIdentity(); 128 void PresentSiteIdentity();
147 129
148 // Sets (presents) history information about the site in the |ui_|. Passing 130 // Sets (presents) history information about the site in the |ui_|. Passing
149 // base::Time() as value for |first_visit| will clear the history information 131 // base::Time() as value for |first_visit| will clear the history information
150 // in the UI. 132 // in the UI.
151 void PresentHistoryInfo(base::Time first_visit); 133 void PresentHistoryInfo(base::Time first_visit);
152 134
153 // The website settings UI displays information and controls for site 135 // The website settings UI displays information and controls for site
154 // specific data (local stored objects like cookies), site specific 136 // specific data (local stored objects like cookies), site specific
155 // permissions (location, popup, plugin, etc. permissions) and site specific 137 // permissions (location, popup, plugin, etc. permissions) and site specific
156 // information (identity, connection status, etc.). 138 // information (identity, connection status, etc.).
157 scoped_ptr<WebsiteSettingsUI> ui_; 139 WebsiteSettingsUI* ui_;
158 140
159 // The Omnibox URL of the website for which to display site permissions and 141 // The Omnibox URL of the website for which to display site permissions and
160 // site information. 142 // site information.
161 GURL site_url_; 143 GURL site_url_;
162 144
163 // Status of the website's identity verification check. 145 // Status of the website's identity verification check.
164 SiteIdentityStatus site_identity_status_; 146 SiteIdentityStatus site_identity_status_;
165 147
166 // For secure connection |cert_id_| is set to the ID of the server 148 // For secure connection |cert_id_| is set to the ID of the server
167 // certificate. For non secure connections |cert_id_| is 0. 149 // certificate. For non secure connections |cert_id_| is 0.
(...skipping 30 matching lines...) Expand all
198 // content settings (aka. site permissions). 180 // content settings (aka. site permissions).
199 HostContentSettingsMap* content_settings_; 181 HostContentSettingsMap* content_settings_;
200 182
201 // Used to request the number of page visits. 183 // Used to request the number of page visits.
202 CancelableRequestConsumer visit_count_request_consumer_; 184 CancelableRequestConsumer visit_count_request_consumer_;
203 185
204 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings); 186 DISALLOW_COPY_AND_ASSIGN(WebsiteSettings);
205 }; 187 };
206 188
207 #endif // CHROME_BROWSER_WEBSITE_SETTINGS_H_ 189 #endif // CHROME_BROWSER_WEBSITE_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698