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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 10092013: Display third party cookies and site data counts in the WebsiteSettings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Fix CannedBrowsingDataDatabaseHelperTest.*" Created 8 years, 7 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 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return (*i); 91 return (*i);
92 } 92 }
93 93
94 return NULL; 94 return NULL;
95 } 95 }
96 96
97 // static 97 // static
98 void TabSpecificContentSettings::CookiesRead(int render_process_id, 98 void TabSpecificContentSettings::CookiesRead(int render_process_id,
99 int render_view_id, 99 int render_view_id,
100 const GURL& url, 100 const GURL& url,
101 const GURL& first_party_url, 101 const GURL& frame_url,
102 const net::CookieList& cookie_list, 102 const net::CookieList& cookie_list,
103 bool blocked_by_policy) { 103 bool blocked_by_policy) {
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
104 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 105 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
105 if (settings) { 106 if (settings) {
106 settings->OnCookiesRead(url, first_party_url, cookie_list, 107 settings->OnCookiesRead(url, frame_url, cookie_list,
107 blocked_by_policy); 108 blocked_by_policy);
108 } 109 }
109 } 110 }
110 111
111 // static 112 // static
112 void TabSpecificContentSettings::CookieChanged( 113 void TabSpecificContentSettings::CookieChanged(
113 int render_process_id, 114 int render_process_id,
114 int render_view_id, 115 int render_view_id,
115 const GURL& url, 116 const GURL& url,
116 const GURL& first_party_url, 117 const GURL& frame_url,
117 const std::string& cookie_line, 118 const std::string& cookie_line,
118 const net::CookieOptions& options, 119 const net::CookieOptions& options,
119 bool blocked_by_policy) { 120 bool blocked_by_policy) {
121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
120 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 122 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
121 if (settings) 123 if (settings)
122 settings->OnCookieChanged(url, first_party_url, cookie_line, options, 124 settings->OnCookieChanged(url, frame_url, cookie_line, options,
123 blocked_by_policy); 125 blocked_by_policy);
124 } 126 }
125 127
126 // static 128 // static
127 void TabSpecificContentSettings::WebDatabaseAccessed( 129 void TabSpecificContentSettings::WebDatabaseAccessed(
128 int render_process_id, 130 int render_process_id,
129 int render_view_id, 131 int render_view_id,
130 const GURL& url, 132 const GURL& url,
131 const string16& name, 133 const string16& name,
132 const string16& display_name, 134 const string16& display_name,
133 bool blocked_by_policy) { 135 bool blocked_by_policy) {
136 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
134 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 137 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
135 if (settings) 138 if (settings)
136 settings->OnWebDatabaseAccessed(url, name, display_name, blocked_by_policy); 139 settings->OnWebDatabaseAccessed(url, name, display_name, blocked_by_policy);
137 } 140 }
138 141
139 // static 142 // static
140 void TabSpecificContentSettings::DOMStorageAccessed(int render_process_id, 143 void TabSpecificContentSettings::DOMStorageAccessed(int render_process_id,
141 int render_view_id, 144 int render_view_id,
142 const GURL& url, 145 const GURL& url,
143 bool local, 146 bool local,
144 bool blocked_by_policy) { 147 bool blocked_by_policy) {
148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 149 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
146 if (settings) 150 if (settings)
147 settings->OnLocalStorageAccessed(url, local, blocked_by_policy); 151 settings->OnLocalStorageAccessed(url, local, blocked_by_policy);
148 } 152 }
149 153
150 // static 154 // static
151 void TabSpecificContentSettings::IndexedDBAccessed(int render_process_id, 155 void TabSpecificContentSettings::IndexedDBAccessed(int render_process_id,
152 int render_view_id, 156 int render_view_id,
153 const GURL& url, 157 const GURL& url,
154 const string16& description, 158 const string16& description,
155 bool blocked_by_policy) { 159 bool blocked_by_policy) {
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
156 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 161 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
157 if (settings) 162 if (settings)
158 settings->OnIndexedDBAccessed(url, description, blocked_by_policy); 163 settings->OnIndexedDBAccessed(url, description, blocked_by_policy);
159 } 164 }
160 165
161 // static 166 // static
162 void TabSpecificContentSettings::FileSystemAccessed(int render_process_id, 167 void TabSpecificContentSettings::FileSystemAccessed(int render_process_id,
163 int render_view_id, 168 int render_view_id,
164 const GURL& url, 169 const GURL& url,
165 bool blocked_by_policy) { 170 bool blocked_by_policy) {
171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
166 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id); 172 TabSpecificContentSettings* settings = Get(render_process_id, render_view_id);
167 if (settings) 173 if (settings)
168 settings->OnFileSystemAccessed(url, blocked_by_policy); 174 settings->OnFileSystemAccessed(url, blocked_by_policy);
169 } 175 }
170 176
171 bool TabSpecificContentSettings::IsContentBlocked( 177 bool TabSpecificContentSettings::IsContentBlocked(
172 ContentSettingsType content_type) const { 178 ContentSettingsType content_type) const {
173 DCHECK(content_type != CONTENT_SETTINGS_TYPE_GEOLOCATION) 179 DCHECK(content_type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
174 << "Geolocation settings handled by ContentSettingGeolocationImageModel"; 180 << "Geolocation settings handled by ContentSettingGeolocationImageModel";
175 DCHECK(content_type != CONTENT_SETTINGS_TYPE_NOTIFICATIONS) 181 DCHECK(content_type != CONTENT_SETTINGS_TYPE_NOTIFICATIONS)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 content_accessed_[type] = true; 264 content_accessed_[type] = true;
259 content::NotificationService::current()->Notify( 265 content::NotificationService::current()->Notify(
260 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 266 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
261 content::Source<WebContents>(web_contents()), 267 content::Source<WebContents>(web_contents()),
262 content::NotificationService::NoDetails()); 268 content::NotificationService::NoDetails());
263 } 269 }
264 } 270 }
265 271
266 void TabSpecificContentSettings::OnCookiesRead( 272 void TabSpecificContentSettings::OnCookiesRead(
267 const GURL& url, 273 const GURL& url,
268 const GURL& first_party_url, 274 const GURL& frame_url,
269 const net::CookieList& cookie_list, 275 const net::CookieList& cookie_list,
270 bool blocked_by_policy) { 276 bool blocked_by_policy) {
271 if (cookie_list.empty()) 277 if (cookie_list.empty())
272 return; 278 return;
273 if (blocked_by_policy) { 279 if (blocked_by_policy) {
274 blocked_local_shared_objects_.cookies()->AddReadCookies( 280 blocked_local_shared_objects_.cookies()->AddReadCookies(
275 url, cookie_list); 281 frame_url, url, cookie_list);
276 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); 282 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
277 } else { 283 } else {
278 allowed_local_shared_objects_.cookies()->AddReadCookies( 284 allowed_local_shared_objects_.cookies()->AddReadCookies(
279 url, cookie_list); 285 frame_url, url, cookie_list);
280 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); 286 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
281 } 287 }
282 288
283 NotifySiteDataObservers(); 289 NotifySiteDataObservers();
284 } 290 }
285 291
286 void TabSpecificContentSettings::OnCookieChanged( 292 void TabSpecificContentSettings::OnCookieChanged(
287 const GURL& url, 293 const GURL& url,
288 const GURL& first_party_url, 294 const GURL& frame_url,
289 const std::string& cookie_line, 295 const std::string& cookie_line,
290 const net::CookieOptions& options, 296 const net::CookieOptions& options,
291 bool blocked_by_policy) { 297 bool blocked_by_policy) {
292 if (blocked_by_policy) { 298 if (blocked_by_policy) {
293 blocked_local_shared_objects_.cookies()->AddChangedCookie( 299 blocked_local_shared_objects_.cookies()->AddChangedCookie(
294 url, cookie_line, options); 300 frame_url, url, cookie_line, options);
295 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); 301 OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
296 } else { 302 } else {
297 allowed_local_shared_objects_.cookies()->AddChangedCookie( 303 allowed_local_shared_objects_.cookies()->AddChangedCookie(
298 url, cookie_line, options); 304 frame_url, url, cookie_line, options);
299 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); 305 OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
300 } 306 }
301 307
302 NotifySiteDataObservers(); 308 NotifySiteDataObservers();
303 } 309 }
304 310
305 void TabSpecificContentSettings::OnIndexedDBAccessed( 311 void TabSpecificContentSettings::OnIndexedDBAccessed(
306 const GURL& url, 312 const GURL& url,
307 const string16& description, 313 const string16& description,
308 bool blocked_by_policy) { 314 bool blocked_by_policy) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 513 }
508 514
509 void TabSpecificContentSettings::RemoveSiteDataObserver( 515 void TabSpecificContentSettings::RemoveSiteDataObserver(
510 SiteDataObserver* observer) { 516 SiteDataObserver* observer) {
511 observer_list_.RemoveObserver(observer); 517 observer_list_.RemoveObserver(observer);
512 } 518 }
513 519
514 void TabSpecificContentSettings::NotifySiteDataObservers() { 520 void TabSpecificContentSettings::NotifySiteDataObservers() {
515 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); 521 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed());
516 } 522 }
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/local_shared_objects_container.cc ('k') | chrome/browser/website_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698