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

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

Issue 19375002: Move GeolocationSettingsState to ContentSettingsUsagesState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review #6 Created 7 years, 5 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void TabSpecificContentSettings::SiteDataObserver::ContentSettingsDestroyed() { 73 void TabSpecificContentSettings::SiteDataObserver::ContentSettingsDestroyed() {
74 tab_specific_content_settings_ = NULL; 74 tab_specific_content_settings_ = NULL;
75 } 75 }
76 76
77 TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab) 77 TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab)
78 : content::WebContentsObserver(tab), 78 : content::WebContentsObserver(tab),
79 profile_(Profile::FromBrowserContext(tab->GetBrowserContext())), 79 profile_(Profile::FromBrowserContext(tab->GetBrowserContext())),
80 allowed_local_shared_objects_(profile_), 80 allowed_local_shared_objects_(profile_),
81 blocked_local_shared_objects_(profile_), 81 blocked_local_shared_objects_(profile_),
82 geolocation_settings_state_(profile_), 82 geolocation_usages_state_(profile_, CONTENT_SETTINGS_TYPE_GEOLOCATION),
83 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), 83 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()),
84 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), 84 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()),
85 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT), 85 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT),
86 load_plugins_link_enabled_(true) { 86 load_plugins_link_enabled_(true) {
87 ClearBlockedContentSettingsExceptForCookies(); 87 ClearBlockedContentSettingsExceptForCookies();
88 ClearCookieSpecificContentSettings(); 88 ClearCookieSpecificContentSettings();
89 89
90 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, 90 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
91 content::Source<HostContentSettingsMap>( 91 content::Source<HostContentSettingsMap>(
92 profile_->GetHostContentSettingsMap())); 92 profile_->GetHostContentSettingsMap()));
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 fileapi::kFileSystemTypeTemporary, 0); 443 fileapi::kFileSystemTypeTemporary, 0);
444 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); 444 OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES);
445 } 445 }
446 446
447 NotifySiteDataObservers(); 447 NotifySiteDataObservers();
448 } 448 }
449 449
450 void TabSpecificContentSettings::OnGeolocationPermissionSet( 450 void TabSpecificContentSettings::OnGeolocationPermissionSet(
451 const GURL& requesting_origin, 451 const GURL& requesting_origin,
452 bool allowed) { 452 bool allowed) {
453 geolocation_settings_state_.OnGeolocationPermissionSet(requesting_origin, 453 geolocation_usages_state_.OnPermissionSet(requesting_origin, allowed);
454 allowed);
455 content::NotificationService::current()->Notify( 454 content::NotificationService::current()->Notify(
456 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 455 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
457 content::Source<WebContents>(web_contents()), 456 content::Source<WebContents>(web_contents()),
458 content::NotificationService::NoDetails()); 457 content::NotificationService::NoDetails());
459 } 458 }
460 459
461 TabSpecificContentSettings::MicrophoneCameraState 460 TabSpecificContentSettings::MicrophoneCameraState
462 TabSpecificContentSettings::GetMicrophoneCameraState() const { 461 TabSpecificContentSettings::GetMicrophoneCameraState() const {
463 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && 462 if (IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) &&
464 IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)) { 463 IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked; 539 content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked;
541 content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_POPUPS] = false; 540 content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_POPUPS] = false;
542 content::NotificationService::current()->Notify( 541 content::NotificationService::current()->Notify(
543 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 542 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
544 content::Source<WebContents>(web_contents()), 543 content::Source<WebContents>(web_contents()),
545 content::NotificationService::NoDetails()); 544 content::NotificationService::NoDetails());
546 } 545 }
547 546
548 void TabSpecificContentSettings::GeolocationDidNavigate( 547 void TabSpecificContentSettings::GeolocationDidNavigate(
549 const content::LoadCommittedDetails& details) { 548 const content::LoadCommittedDetails& details) {
550 geolocation_settings_state_.DidNavigate(details); 549 geolocation_usages_state_.DidNavigate(details);
551 } 550 }
552 551
553 void TabSpecificContentSettings::ClearGeolocationContentSettings() { 552 void TabSpecificContentSettings::ClearGeolocationContentSettings() {
554 geolocation_settings_state_.ClearStateMap(); 553 geolocation_usages_state_.ClearStateMap();
555 } 554 }
556 555
557 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { 556 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) {
558 if (allowed) { 557 if (allowed) {
559 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); 558 OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
560 } else { 559 } else {
561 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()); 560 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string());
562 } 561 }
563 } 562 }
564 563
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 649 }
651 650
652 void TabSpecificContentSettings::RemoveSiteDataObserver( 651 void TabSpecificContentSettings::RemoveSiteDataObserver(
653 SiteDataObserver* observer) { 652 SiteDataObserver* observer) {
654 observer_list_.RemoveObserver(observer); 653 observer_list_.RemoveObserver(observer);
655 } 654 }
656 655
657 void TabSpecificContentSettings::NotifySiteDataObservers() { 656 void TabSpecificContentSettings::NotifySiteDataObservers() {
658 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); 657 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed());
659 } 658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698