| 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <set> | |
| 9 #include <string> | 8 #include <string> |
| 10 | 9 |
| 11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 15 #include "chrome/browser/content_settings/content_settings_usages_state.h" | 14 #include "chrome/browser/content_settings/content_settings_usages_state.h" |
| 16 #include "chrome/browser/content_settings/local_shared_objects_container.h" | 15 #include "chrome/browser/content_settings/local_shared_objects_container.h" |
| 17 #include "chrome/browser/media/media_stream_devices_controller.h" | 16 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 18 #include "chrome/common/content_settings.h" | 17 #include "chrome/common/content_settings.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return media_stream_requested_audio_device_; | 197 return media_stream_requested_audio_device_; |
| 199 } | 198 } |
| 200 | 199 |
| 201 const std::string& media_stream_requested_video_device() const { | 200 const std::string& media_stream_requested_video_device() const { |
| 202 return media_stream_requested_video_device_; | 201 return media_stream_requested_video_device_; |
| 203 } | 202 } |
| 204 | 203 |
| 205 // Returns the state of the camera and microphone usage. | 204 // Returns the state of the camera and microphone usage. |
| 206 MicrophoneCameraState GetMicrophoneCameraState() const; | 205 MicrophoneCameraState GetMicrophoneCameraState() const; |
| 207 | 206 |
| 208 const std::set<std::string>& BlockedResourcesForType( | |
| 209 ContentSettingsType content_type) const; | |
| 210 | |
| 211 // Returns the ContentSettingsUsagesState that controls the | 207 // Returns the ContentSettingsUsagesState that controls the |
| 212 // geolocation API usage on this page. | 208 // geolocation API usage on this page. |
| 213 const ContentSettingsUsagesState& geolocation_usages_state() const { | 209 const ContentSettingsUsagesState& geolocation_usages_state() const { |
| 214 return geolocation_usages_state_; | 210 return geolocation_usages_state_; |
| 215 } | 211 } |
| 216 | 212 |
| 217 // Returns the ContentSettingsUsageState that controls the MIDI usage on | 213 // Returns the ContentSettingsUsageState that controls the MIDI usage on |
| 218 // this page. | 214 // this page. |
| 219 const ContentSettingsUsagesState& midi_usages_state() const { | 215 const ContentSettingsUsagesState& midi_usages_state() const { |
| 220 return midi_usages_state_; | 216 return midi_usages_state_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 int64 parent_frame_id, | 283 int64 parent_frame_id, |
| 288 bool is_main_frame, | 284 bool is_main_frame, |
| 289 const GURL& validated_url, | 285 const GURL& validated_url, |
| 290 bool is_error_page, | 286 bool is_error_page, |
| 291 bool is_iframe_srcdoc, | 287 bool is_iframe_srcdoc, |
| 292 content::RenderViewHost* render_view_host) OVERRIDE; | 288 content::RenderViewHost* render_view_host) OVERRIDE; |
| 293 virtual void AppCacheAccessed(const GURL& manifest_url, | 289 virtual void AppCacheAccessed(const GURL& manifest_url, |
| 294 bool blocked_by_policy) OVERRIDE; | 290 bool blocked_by_policy) OVERRIDE; |
| 295 | 291 |
| 296 // Message handlers. Public for testing. | 292 // Message handlers. Public for testing. |
| 297 void OnContentBlocked(ContentSettingsType type, | 293 void OnContentBlocked(ContentSettingsType type); |
| 298 const std::string& resource_identifier); | |
| 299 void OnContentAllowed(ContentSettingsType type); | 294 void OnContentAllowed(ContentSettingsType type); |
| 300 | 295 |
| 301 // These methods are invoked on the UI thread by the static functions above. | 296 // These methods are invoked on the UI thread by the static functions above. |
| 302 // Public for testing. | 297 // Public for testing. |
| 303 void OnCookiesRead(const GURL& url, | 298 void OnCookiesRead(const GURL& url, |
| 304 const GURL& first_party_url, | 299 const GURL& first_party_url, |
| 305 const net::CookieList& cookie_list, | 300 const net::CookieList& cookie_list, |
| 306 bool blocked_by_policy); | 301 bool blocked_by_policy); |
| 307 void OnCookieChanged(const GURL& url, | 302 void OnCookieChanged(const GURL& url, |
| 308 const GURL& first_party_url, | 303 const GURL& first_party_url, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // locale shared object, like for example a cookie, is accessed. | 339 // locale shared object, like for example a cookie, is accessed. |
| 345 void AddSiteDataObserver(SiteDataObserver* observer); | 340 void AddSiteDataObserver(SiteDataObserver* observer); |
| 346 | 341 |
| 347 // Removes the given |SiteDataObserver|. | 342 // Removes the given |SiteDataObserver|. |
| 348 void RemoveSiteDataObserver(SiteDataObserver* observer); | 343 void RemoveSiteDataObserver(SiteDataObserver* observer); |
| 349 | 344 |
| 350 private: | 345 private: |
| 351 explicit TabSpecificContentSettings(content::WebContents* tab); | 346 explicit TabSpecificContentSettings(content::WebContents* tab); |
| 352 friend class content::WebContentsUserData<TabSpecificContentSettings>; | 347 friend class content::WebContentsUserData<TabSpecificContentSettings>; |
| 353 | 348 |
| 354 void AddBlockedResource(ContentSettingsType content_type, | |
| 355 const std::string& resource_identifier); | |
| 356 | |
| 357 // content::NotificationObserver implementation. | 349 // content::NotificationObserver implementation. |
| 358 virtual void Observe(int type, | 350 virtual void Observe(int type, |
| 359 const content::NotificationSource& source, | 351 const content::NotificationSource& source, |
| 360 const content::NotificationDetails& details) OVERRIDE; | 352 const content::NotificationDetails& details) OVERRIDE; |
| 361 | 353 |
| 362 // Notifies all registered |SiteDataObserver|s. | 354 // Notifies all registered |SiteDataObserver|s. |
| 363 void NotifySiteDataObservers(); | 355 void NotifySiteDataObservers(); |
| 364 | 356 |
| 365 // All currently registered |SiteDataObserver|s. | 357 // All currently registered |SiteDataObserver|s. |
| 366 ObserverList<SiteDataObserver> observer_list_; | 358 ObserverList<SiteDataObserver> observer_list_; |
| 367 | 359 |
| 368 // Stores which content setting types actually have blocked content. | 360 // Stores which content setting types actually have blocked content. |
| 369 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; | 361 bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES]; |
| 370 | 362 |
| 371 // Stores if the blocked content was messaged to the user. | 363 // Stores if the blocked content was messaged to the user. |
| 372 bool content_blockage_indicated_to_user_[CONTENT_SETTINGS_NUM_TYPES]; | 364 bool content_blockage_indicated_to_user_[CONTENT_SETTINGS_NUM_TYPES]; |
| 373 | 365 |
| 374 // Stores which content setting types actually were allowed. | 366 // Stores which content setting types actually were allowed. |
| 375 bool content_allowed_[CONTENT_SETTINGS_NUM_TYPES]; | 367 bool content_allowed_[CONTENT_SETTINGS_NUM_TYPES]; |
| 376 | 368 |
| 377 // Stores the blocked resources for each content type. | |
| 378 // Currently only used for plugins. | |
| 379 scoped_ptr<std::set<std::string> > | |
| 380 blocked_resources_[CONTENT_SETTINGS_NUM_TYPES]; | |
| 381 | |
| 382 // The profile of the tab. | 369 // The profile of the tab. |
| 383 Profile* profile_; | 370 Profile* profile_; |
| 384 | 371 |
| 385 // Stores the blocked/allowed cookies. | 372 // Stores the blocked/allowed cookies. |
| 386 LocalSharedObjectsContainer allowed_local_shared_objects_; | 373 LocalSharedObjectsContainer allowed_local_shared_objects_; |
| 387 LocalSharedObjectsContainer blocked_local_shared_objects_; | 374 LocalSharedObjectsContainer blocked_local_shared_objects_; |
| 388 | 375 |
| 389 // Manages information about Geolocation API usage in this page. | 376 // Manages information about Geolocation API usage in this page. |
| 390 ContentSettingsUsagesState geolocation_usages_state_; | 377 ContentSettingsUsagesState geolocation_usages_state_; |
| 391 | 378 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 419 | 406 |
| 420 // The devices to be displayed in the media bubble when the media stream | 407 // The devices to be displayed in the media bubble when the media stream |
| 421 // request is requesting certain specific devices. | 408 // request is requesting certain specific devices. |
| 422 std::string media_stream_requested_audio_device_; | 409 std::string media_stream_requested_audio_device_; |
| 423 std::string media_stream_requested_video_device_; | 410 std::string media_stream_requested_video_device_; |
| 424 | 411 |
| 425 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 412 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
| 426 }; | 413 }; |
| 427 | 414 |
| 428 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 415 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| OLD | NEW |