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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 DCHECK(content_type != CONTENT_SETTINGS_TYPE_NOTIFICATIONS) | 200 DCHECK(content_type != CONTENT_SETTINGS_TYPE_NOTIFICATIONS) |
201 << "Notifications settings handled by " | 201 << "Notifications settings handled by " |
202 << "ContentSettingsNotificationsImageModel"; | 202 << "ContentSettingsNotificationsImageModel"; |
203 | 203 |
204 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || | 204 if (content_type == CONTENT_SETTINGS_TYPE_IMAGES || |
205 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || | 205 content_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || |
206 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || | 206 content_type == CONTENT_SETTINGS_TYPE_PLUGINS || |
207 content_type == CONTENT_SETTINGS_TYPE_COOKIES || | 207 content_type == CONTENT_SETTINGS_TYPE_COOKIES || |
208 content_type == CONTENT_SETTINGS_TYPE_POPUPS || | 208 content_type == CONTENT_SETTINGS_TYPE_POPUPS || |
209 content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT || | 209 content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT || |
210 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) | 210 content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM || |
| 211 content_type == CONTENT_SETTINGS_TYPE_PPAPI_BROKER) |
211 return content_blocked_[content_type]; | 212 return content_blocked_[content_type]; |
212 | 213 |
213 return false; | 214 return false; |
214 } | 215 } |
215 | 216 |
216 bool TabSpecificContentSettings::IsBlockageIndicated( | 217 bool TabSpecificContentSettings::IsBlockageIndicated( |
217 ContentSettingsType content_type) const { | 218 ContentSettingsType content_type) const { |
218 return content_blockage_indicated_to_user_[content_type]; | 219 return content_blockage_indicated_to_user_[content_type]; |
219 } | 220 } |
220 | 221 |
221 void TabSpecificContentSettings::SetBlockageHasBeenIndicated( | 222 void TabSpecificContentSettings::SetBlockageHasBeenIndicated( |
222 ContentSettingsType content_type) { | 223 ContentSettingsType content_type) { |
223 content_blockage_indicated_to_user_[content_type] = true; | 224 content_blockage_indicated_to_user_[content_type] = true; |
224 } | 225 } |
225 | 226 |
226 bool TabSpecificContentSettings::IsContentAccessed( | 227 bool TabSpecificContentSettings::IsContentAccessed( |
227 ContentSettingsType content_type) const { | 228 ContentSettingsType content_type) const { |
228 // This method currently only returns meaningful values for the content type | 229 // This method currently only returns meaningful values for the content type |
229 // cookies and mediastream. | 230 // cookies, mediastream, and PPAPI broker. |
230 if (content_type != CONTENT_SETTINGS_TYPE_COOKIES && | 231 if (content_type != CONTENT_SETTINGS_TYPE_COOKIES && |
231 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM) | 232 content_type != CONTENT_SETTINGS_TYPE_MEDIASTREAM && |
| 233 content_type != CONTENT_SETTINGS_TYPE_PPAPI_BROKER) { |
232 return false; | 234 return false; |
| 235 } |
233 | 236 |
234 return content_accessed_[content_type]; | 237 return content_accessed_[content_type]; |
235 } | 238 } |
236 | 239 |
237 const std::set<std::string>& | 240 const std::set<std::string>& |
238 TabSpecificContentSettings::BlockedResourcesForType( | 241 TabSpecificContentSettings::BlockedResourcesForType( |
239 ContentSettingsType content_type) const { | 242 ContentSettingsType content_type) const { |
240 if (blocked_resources_[content_type].get()) { | 243 if (blocked_resources_[content_type].get()) { |
241 return *blocked_resources_[content_type]; | 244 return *blocked_resources_[content_type]; |
242 } else { | 245 } else { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 471 |
469 void TabSpecificContentSettings::GeolocationDidNavigate( | 472 void TabSpecificContentSettings::GeolocationDidNavigate( |
470 const content::LoadCommittedDetails& details) { | 473 const content::LoadCommittedDetails& details) { |
471 geolocation_settings_state_.DidNavigate(details); | 474 geolocation_settings_state_.DidNavigate(details); |
472 } | 475 } |
473 | 476 |
474 void TabSpecificContentSettings::ClearGeolocationContentSettings() { | 477 void TabSpecificContentSettings::ClearGeolocationContentSettings() { |
475 geolocation_settings_state_.ClearStateMap(); | 478 geolocation_settings_state_.ClearStateMap(); |
476 } | 479 } |
477 | 480 |
| 481 void TabSpecificContentSettings::SetPepperBrokerAllowed(bool allowed) { |
| 482 if (allowed) { |
| 483 OnContentAccessed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
| 484 } else { |
| 485 OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()); |
| 486 } |
| 487 } |
| 488 |
478 void TabSpecificContentSettings::RenderViewForInterstitialPageCreated( | 489 void TabSpecificContentSettings::RenderViewForInterstitialPageCreated( |
479 RenderViewHost* render_view_host) { | 490 RenderViewHost* render_view_host) { |
480 // We want to tell the renderer-side code to ignore content settings for this | 491 // We want to tell the renderer-side code to ignore content settings for this |
481 // page but we must wait until the RenderView is created. | 492 // page but we must wait until the RenderView is created. |
482 new InterstitialHostObserver(render_view_host); | 493 new InterstitialHostObserver(render_view_host); |
483 } | 494 } |
484 | 495 |
485 bool TabSpecificContentSettings::OnMessageReceived( | 496 bool TabSpecificContentSettings::OnMessageReceived( |
486 const IPC::Message& message) { | 497 const IPC::Message& message) { |
487 bool handled = true; | 498 bool handled = true; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 574 } |
564 | 575 |
565 void TabSpecificContentSettings::RemoveSiteDataObserver( | 576 void TabSpecificContentSettings::RemoveSiteDataObserver( |
566 SiteDataObserver* observer) { | 577 SiteDataObserver* observer) { |
567 observer_list_.RemoveObserver(observer); | 578 observer_list_.RemoveObserver(observer); |
568 } | 579 } |
569 | 580 |
570 void TabSpecificContentSettings::NotifySiteDataObservers() { | 581 void TabSpecificContentSettings::NotifySiteDataObservers() { |
571 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); | 582 FOR_EACH_OBSERVER(SiteDataObserver, observer_list_, OnSiteDataAccessed()); |
572 } | 583 } |
OLD | NEW |