OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab) | 62 TabSpecificContentSettings::TabSpecificContentSettings(WebContents* tab) |
63 : content::WebContentsObserver(tab), | 63 : content::WebContentsObserver(tab), |
64 profile_(Profile::FromBrowserContext(tab->GetBrowserContext())), | 64 profile_(Profile::FromBrowserContext(tab->GetBrowserContext())), |
65 allowed_local_shared_objects_(profile_), | 65 allowed_local_shared_objects_(profile_), |
66 blocked_local_shared_objects_(profile_), | 66 blocked_local_shared_objects_(profile_), |
67 geolocation_usages_state_(profile_, CONTENT_SETTINGS_TYPE_GEOLOCATION), | 67 geolocation_usages_state_(profile_, CONTENT_SETTINGS_TYPE_GEOLOCATION), |
68 midi_usages_state_(profile_, CONTENT_SETTINGS_TYPE_MIDI_SYSEX), | 68 midi_usages_state_(profile_, CONTENT_SETTINGS_TYPE_MIDI_SYSEX), |
69 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), | 69 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), |
70 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), | 70 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), |
71 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT), | 71 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT), |
72 load_plugins_link_enabled_(true) { | 72 plugin_bubble_setting_(CONTENT_SETTING_BLOCK) { |
73 ClearBlockedContentSettingsExceptForCookies(); | 73 ClearBlockedContentSettingsExceptForCookies(); |
74 ClearCookieSpecificContentSettings(); | 74 ClearCookieSpecificContentSettings(); |
75 | 75 |
76 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, | 76 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
77 content::Source<HostContentSettingsMap>( | 77 content::Source<HostContentSettingsMap>( |
78 profile_->GetHostContentSettingsMap())); | 78 profile_->GetHostContentSettingsMap())); |
79 } | 79 } |
80 | 80 |
81 TabSpecificContentSettings::~TabSpecificContentSettings() { | 81 TabSpecificContentSettings::~TabSpecificContentSettings() { |
82 FOR_EACH_OBSERVER( | 82 FOR_EACH_OBSERVER( |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 } | 558 } |
559 | 559 |
560 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { | 560 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { |
561 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { | 561 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { |
562 if (i == CONTENT_SETTINGS_TYPE_COOKIES) | 562 if (i == CONTENT_SETTINGS_TYPE_COOKIES) |
563 continue; | 563 continue; |
564 content_blocked_[i] = false; | 564 content_blocked_[i] = false; |
565 content_allowed_[i] = false; | 565 content_allowed_[i] = false; |
566 content_blockage_indicated_to_user_[i] = false; | 566 content_blockage_indicated_to_user_[i] = false; |
567 } | 567 } |
568 load_plugins_link_enabled_ = true; | |
569 content::NotificationService::current()->Notify( | 568 content::NotificationService::current()->Notify( |
570 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 569 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
571 content::Source<WebContents>(web_contents()), | 570 content::Source<WebContents>(web_contents()), |
572 content::NotificationService::NoDetails()); | 571 content::NotificationService::NoDetails()); |
573 } | 572 } |
574 | 573 |
575 void TabSpecificContentSettings::ClearCookieSpecificContentSettings() { | 574 void TabSpecificContentSettings::ClearCookieSpecificContentSettings() { |
576 blocked_local_shared_objects_.Reset(); | 575 blocked_local_shared_objects_.Reset(); |
577 allowed_local_shared_objects_.Reset(); | 576 allowed_local_shared_objects_.Reset(); |
578 content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false; | 577 content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 } | 722 } |
724 | 723 |
725 void TabSpecificContentSettings::RemoveSiteDataObserver( | 724 void TabSpecificContentSettings::RemoveSiteDataObserver( |
726 SiteDataObserver* observer) { | 725 SiteDataObserver* observer) { |
727 observer_list_.RemoveObserver(observer); | 726 observer_list_.RemoveObserver(observer); |
728 } | 727 } |
729 | 728 |
730 void TabSpecificContentSettings::NotifySiteDataObservers() { | 729 void TabSpecificContentSettings::NotifySiteDataObservers() { |
731 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 730 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
732 } | 731 } |
OLD | NEW |