| 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 plugin_bubble_setting_(CONTENT_SETTING_DEFAULT), |
| 72 load_plugins_link_enabled_(true) { | 73 load_plugins_link_enabled_(true) { |
| 73 ClearBlockedContentSettingsExceptForCookies(); | 74 ClearBlockedContentSettingsExceptForCookies(); |
| 74 ClearCookieSpecificContentSettings(); | 75 ClearCookieSpecificContentSettings(); |
| 75 | 76 |
| 76 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, | 77 registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
| 77 content::Source<HostContentSettingsMap>( | 78 content::Source<HostContentSettingsMap>( |
| 78 profile_->GetHostContentSettingsMap())); | 79 profile_->GetHostContentSettingsMap())); |
| 79 } | 80 } |
| 80 | 81 |
| 81 TabSpecificContentSettings::~TabSpecificContentSettings() { | 82 TabSpecificContentSettings::~TabSpecificContentSettings() { |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 560 |
| 560 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { | 561 void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { |
| 561 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { | 562 for (size_t i = 0; i < arraysize(content_blocked_); ++i) { |
| 562 if (i == CONTENT_SETTINGS_TYPE_COOKIES) | 563 if (i == CONTENT_SETTINGS_TYPE_COOKIES) |
| 563 continue; | 564 continue; |
| 564 content_blocked_[i] = false; | 565 content_blocked_[i] = false; |
| 565 content_allowed_[i] = false; | 566 content_allowed_[i] = false; |
| 566 content_blockage_indicated_to_user_[i] = false; | 567 content_blockage_indicated_to_user_[i] = false; |
| 567 } | 568 } |
| 568 load_plugins_link_enabled_ = true; | 569 load_plugins_link_enabled_ = true; |
| 570 |
| 569 content::NotificationService::current()->Notify( | 571 content::NotificationService::current()->Notify( |
| 570 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 572 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
| 571 content::Source<WebContents>(web_contents()), | 573 content::Source<WebContents>(web_contents()), |
| 572 content::NotificationService::NoDetails()); | 574 content::NotificationService::NoDetails()); |
| 573 } | 575 } |
| 574 | 576 |
| 575 void TabSpecificContentSettings::ClearCookieSpecificContentSettings() { | 577 void TabSpecificContentSettings::ClearCookieSpecificContentSettings() { |
| 576 blocked_local_shared_objects_.Reset(); | 578 blocked_local_shared_objects_.Reset(); |
| 577 allowed_local_shared_objects_.Reset(); | 579 allowed_local_shared_objects_.Reset(); |
| 578 content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false; | 580 content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 } | 725 } |
| 724 | 726 |
| 725 void TabSpecificContentSettings::RemoveSiteDataObserver( | 727 void TabSpecificContentSettings::RemoveSiteDataObserver( |
| 726 SiteDataObserver* observer) { | 728 SiteDataObserver* observer) { |
| 727 observer_list_.RemoveObserver(observer); | 729 observer_list_.RemoveObserver(observer); |
| 728 } | 730 } |
| 729 | 731 |
| 730 void TabSpecificContentSettings::NotifySiteDataObservers() { | 732 void TabSpecificContentSettings::NotifySiteDataObservers() { |
| 731 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 733 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
| 732 } | 734 } |
| OLD | NEW |