| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 CONTENT_SETTINGS_TYPE_GEOLOCATION), | 96 CONTENT_SETTINGS_TYPE_GEOLOCATION), |
| 97 midi_usages_state_( | 97 midi_usages_state_( |
| 98 HostContentSettingsMapFactory::GetForProfile( | 98 HostContentSettingsMapFactory::GetForProfile( |
| 99 Profile::FromBrowserContext(tab->GetBrowserContext())), | 99 Profile::FromBrowserContext(tab->GetBrowserContext())), |
| 100 CONTENT_SETTINGS_TYPE_MIDI_SYSEX), | 100 CONTENT_SETTINGS_TYPE_MIDI_SYSEX), |
| 101 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), | 101 pending_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), |
| 102 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), | 102 previous_protocol_handler_(ProtocolHandler::EmptyProtocolHandler()), |
| 103 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT), | 103 pending_protocol_handler_setting_(CONTENT_SETTING_DEFAULT), |
| 104 load_plugins_link_enabled_(true), | 104 load_plugins_link_enabled_(true), |
| 105 microphone_camera_state_(MICROPHONE_CAMERA_NOT_ACCESSED), | 105 microphone_camera_state_(MICROPHONE_CAMERA_NOT_ACCESSED), |
| 106 subresource_filter_enabled_(false), |
| 107 subresource_filter_blockage_indicated_(false), |
| 106 observer_(this) { | 108 observer_(this) { |
| 107 ClearBlockedContentSettingsExceptForCookies(); | 109 ClearBlockedContentSettingsExceptForCookies(); |
| 108 ClearCookieSpecificContentSettings(); | 110 ClearCookieSpecificContentSettings(); |
| 109 | 111 |
| 110 observer_.Add(HostContentSettingsMapFactory::GetForProfile( | 112 observer_.Add(HostContentSettingsMapFactory::GetForProfile( |
| 111 Profile::FromBrowserContext(tab->GetBrowserContext()))); | 113 Profile::FromBrowserContext(tab->GetBrowserContext()))); |
| 112 } | 114 } |
| 113 | 115 |
| 114 TabSpecificContentSettings::~TabSpecificContentSettings() { | 116 TabSpecificContentSettings::~TabSpecificContentSettings() { |
| 115 FOR_EACH_OBSERVER( | 117 FOR_EACH_OBSERVER( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (it != content_settings_status_.end()) | 265 if (it != content_settings_status_.end()) |
| 264 return it->second.blockage_indicated_to_user; | 266 return it->second.blockage_indicated_to_user; |
| 265 return false; | 267 return false; |
| 266 } | 268 } |
| 267 | 269 |
| 268 void TabSpecificContentSettings::SetBlockageHasBeenIndicated( | 270 void TabSpecificContentSettings::SetBlockageHasBeenIndicated( |
| 269 ContentSettingsType content_type) { | 271 ContentSettingsType content_type) { |
| 270 content_settings_status_[content_type].blockage_indicated_to_user = true; | 272 content_settings_status_[content_type].blockage_indicated_to_user = true; |
| 271 } | 273 } |
| 272 | 274 |
| 275 void TabSpecificContentSettings::SetSubresourceFilteringActivationIndicated() { |
| 276 subresource_filter_blockage_indicated_ = true; |
| 277 } |
| 278 |
| 279 bool TabSpecificContentSettings::IsSubresourceFilteringActivationIndicated() |
| 280 const { |
| 281 return subresource_filter_blockage_indicated_; |
| 282 } |
| 283 |
| 273 bool TabSpecificContentSettings::IsContentAllowed( | 284 bool TabSpecificContentSettings::IsContentAllowed( |
| 274 ContentSettingsType content_type) const { | 285 ContentSettingsType content_type) const { |
| 275 // This method currently only returns meaningful values for the content type | 286 // This method currently only returns meaningful values for the content type |
| 276 // cookies, media, PPAPI broker, downloads, and MIDI sysex. | 287 // cookies, media, PPAPI broker, downloads, and MIDI sysex. |
| 277 if (content_type != CONTENT_SETTINGS_TYPE_COOKIES && | 288 if (content_type != CONTENT_SETTINGS_TYPE_COOKIES && |
| 278 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && | 289 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC && |
| 279 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA && | 290 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA && |
| 280 content_type != CONTENT_SETTINGS_TYPE_PPAPI_BROKER && | 291 content_type != CONTENT_SETTINGS_TYPE_PPAPI_BROKER && |
| 281 content_type != CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS && | 292 content_type != CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS && |
| 282 content_type != CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { | 293 content_type != CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 static_cast<MicrophoneCameraStateFlags>( | 860 static_cast<MicrophoneCameraStateFlags>( |
| 850 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 861 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
| 851 TabSpecificContentSettings::MICROPHONE_BLOCKED | | 862 TabSpecificContentSettings::MICROPHONE_BLOCKED | |
| 852 TabSpecificContentSettings::CAMERA_ACCESSED | | 863 TabSpecificContentSettings::CAMERA_ACCESSED | |
| 853 TabSpecificContentSettings::CAMERA_BLOCKED); | 864 TabSpecificContentSettings::CAMERA_BLOCKED); |
| 854 OnMediaStreamPermissionSet( | 865 OnMediaStreamPermissionSet( |
| 855 web_contents()->GetLastCommittedURL(), | 866 web_contents()->GetLastCommittedURL(), |
| 856 media_blocked, | 867 media_blocked, |
| 857 std::string(), std::string(), std::string(), std::string()); | 868 std::string(), std::string(), std::string(), std::string()); |
| 858 } | 869 } |
| OLD | NEW |