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

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

Issue 13375004: Fixed the problem that cookie blocking notification bubble is not displayed in the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comment Created 7 years, 8 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 | « no previous file | chrome/browser/content_settings/tab_specific_content_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 void TabSpecificContentSettings::OnContentBlocked( 259 void TabSpecificContentSettings::OnContentBlocked(
260 ContentSettingsType type, 260 ContentSettingsType type,
261 const std::string& resource_identifier) { 261 const std::string& resource_identifier) {
262 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) 262 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
263 << "Geolocation settings handled by OnGeolocationPermissionSet"; 263 << "Geolocation settings handled by OnGeolocationPermissionSet";
264 if (type < 0 || type >= CONTENT_SETTINGS_NUM_TYPES) 264 if (type < 0 || type >= CONTENT_SETTINGS_NUM_TYPES)
265 return; 265 return;
266 266
267 content_allowed_[type] = false; 267 // Media is different from other content setting types since it allows new
268 // setting to kick in without reloading the page, and the UI for media is
269 // always reflecting the newest permission setting.
270 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM)
271 content_allowed_[type] = false;
272 else
273 content_allowed_[type] = true;
268 274
269 // Unless UI for resource content settings is enabled, ignore the resource 275 // Unless UI for resource content settings is enabled, ignore the resource
270 // identifier. 276 // identifier.
271 // TODO(bauerb): The UI to unblock content should be disabled if the content 277 // TODO(bauerb): The UI to unblock content should be disabled if the content
272 // setting was not set by the user. 278 // setting was not set by the user.
273 std::string identifier; 279 std::string identifier;
274 if (CommandLine::ForCurrentProcess()->HasSwitch( 280 if (CommandLine::ForCurrentProcess()->HasSwitch(
275 switches::kEnableResourceContentSettings)) { 281 switches::kEnableResourceContentSettings)) {
276 identifier = resource_identifier; 282 identifier = resource_identifier;
277 } 283 }
(...skipping 18 matching lines...) Expand all
296 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 302 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
297 content::Source<WebContents>(web_contents()), 303 content::Source<WebContents>(web_contents()),
298 content::NotificationService::NoDetails()); 304 content::NotificationService::NoDetails());
299 } 305 }
300 } 306 }
301 307
302 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { 308 void TabSpecificContentSettings::OnContentAllowed(ContentSettingsType type) {
303 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION) 309 DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
304 << "Geolocation settings handled by OnGeolocationPermissionSet"; 310 << "Geolocation settings handled by OnGeolocationPermissionSet";
305 bool access_changed = false; 311 bool access_changed = false;
306 if (content_blocked_[type]) { 312 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
307 content_blocked_[type] = false; 313 // The setting for media is overwritten here because media does not need to
308 access_changed = true; 314 // reload the page to have the new setting kick in. See issue/175993.
315 if (content_blocked_[type]) {
316 content_blocked_[type] = false;
317 access_changed = true;
318 }
309 } 319 }
310 320
311 if (!content_allowed_[type]) { 321 if (!content_allowed_[type]) {
312 content_allowed_[type] = true; 322 content_allowed_[type] = true;
313 access_changed = true; 323 access_changed = true;
314 } 324 }
315 325
316 if (access_changed) { 326 if (access_changed) {
317 content::NotificationService::current()->Notify( 327 content::NotificationService::current()->Notify(
318 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 328 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 596 }
587 597
588 void TabSpecificContentSettings::RemoveSiteDataObserver( 598 void TabSpecificContentSettings::RemoveSiteDataObserver(
589 SiteDataObserver* observer) { 599 SiteDataObserver* observer) {
590 observer_list_.RemoveObserver(observer); 600 observer_list_.RemoveObserver(observer);
591 } 601 }
592 602
593 void TabSpecificContentSettings::NotifySiteDataObservers() { 603 void TabSpecificContentSettings::NotifySiteDataObservers() {
594 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); 604 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed());
595 } 605 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/tab_specific_content_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698