| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 // Returns the object given a RenderFrameHost ids. | 95 // Returns the object given a RenderFrameHost ids. |
| 96 static TabSpecificContentSettings* GetForFrame(int render_process_id, | 96 static TabSpecificContentSettings* GetForFrame(int render_process_id, |
| 97 int render_frame_id); | 97 int render_frame_id); |
| 98 | 98 |
| 99 // Static methods called on the UI threads. | 99 // Static methods called on the UI threads. |
| 100 // Called when cookies for the given URL were read either from within the | 100 // Called when cookies for the given URL were read either from within the |
| 101 // current page or while loading it. |blocked_by_policy| should be true, if | 101 // current page or while loading it. |blocked_by_policy| should be true, if |
| 102 // reading cookies was blocked due to the user's content settings. In that | 102 // reading cookies was blocked due to the user's content settings. In that |
| 103 // case, this function should invoke OnContentBlocked. | 103 // case, this function should invoke OnContentBlocked. |
| 104 static void CookiesRead( | 104 static void CookiesRead(int render_process_id, |
| 105 const base::Callback<content::WebContents*(void)>& wc_getter, | 105 int render_frame_id, |
| 106 const GURL& url, | 106 const GURL& url, |
| 107 const GURL& first_party_url, | 107 const GURL& first_party_url, |
| 108 const net::CookieList& cookie_list, | 108 const net::CookieList& cookie_list, |
| 109 bool blocked_by_policy); | 109 bool blocked_by_policy); |
| 110 | 110 |
| 111 // Called when a specific cookie in the current page was changed. | 111 // Called when a specific cookie in the current page was changed. |
| 112 // |blocked_by_policy| should be true, if the cookie was blocked due to the | 112 // |blocked_by_policy| should be true, if the cookie was blocked due to the |
| 113 // user's content settings. In that case, this function should invoke | 113 // user's content settings. In that case, this function should invoke |
| 114 // OnContentBlocked. | 114 // OnContentBlocked. |
| 115 static void CookieChanged( | 115 static void CookieChanged(int render_process_id, |
| 116 const base::Callback<content::WebContents*(void)>& wc_getter, | 116 int render_frame_id, |
| 117 const GURL& url, | 117 const GURL& url, |
| 118 const GURL& first_party_url, | 118 const GURL& first_party_url, |
| 119 const std::string& cookie_line, | 119 const std::string& cookie_line, |
| 120 const net::CookieOptions& options, | 120 const net::CookieOptions& options, |
| 121 bool blocked_by_policy); | 121 bool blocked_by_policy); |
| 122 | 122 |
| 123 // Called when a specific Web database in the current page was accessed. If | 123 // Called when a specific Web database in the current page was accessed. If |
| 124 // access was blocked due to the user's content settings, | 124 // access was blocked due to the user's content settings, |
| 125 // |blocked_by_policy| should be true, and this function should invoke | 125 // |blocked_by_policy| should be true, and this function should invoke |
| 126 // OnContentBlocked. | 126 // OnContentBlocked. |
| 127 static void WebDatabaseAccessed(int render_process_id, | 127 static void WebDatabaseAccessed(int render_process_id, |
| 128 int render_frame_id, | 128 int render_frame_id, |
| 129 const GURL& url, | 129 const GURL& url, |
| 130 const base::string16& name, | 130 const base::string16& name, |
| 131 const base::string16& display_name, | 131 const base::string16& display_name, |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 private: | 390 private: |
| 391 friend class content::WebContentsUserData<TabSpecificContentSettings>; | 391 friend class content::WebContentsUserData<TabSpecificContentSettings>; |
| 392 | 392 |
| 393 explicit TabSpecificContentSettings(content::WebContents* tab); | 393 explicit TabSpecificContentSettings(content::WebContents* tab); |
| 394 | 394 |
| 395 // content::WebContentsObserver overrides. | 395 // content::WebContentsObserver overrides. |
| 396 void RenderFrameForInterstitialPageCreated( | 396 void RenderFrameForInterstitialPageCreated( |
| 397 content::RenderFrameHost* render_frame_host) override; | 397 content::RenderFrameHost* render_frame_host) override; |
| 398 bool OnMessageReceived(const IPC::Message& message, | 398 bool OnMessageReceived(const IPC::Message& message, |
| 399 content::RenderFrameHost* render_frame_host) override; | 399 content::RenderFrameHost* render_frame_host) override; |
| 400 void DidStartNavigation( | 400 void DidNavigateMainFrame( |
| 401 content::NavigationHandle* navigation_handle) override; | 401 const content::LoadCommittedDetails& details, |
| 402 void DidFinishNavigation( | 402 const content::FrameNavigateParams& params) override; |
| 403 content::NavigationHandle* navigation_handle) override; | 403 void DidStartProvisionalLoadForFrame( |
| 404 content::RenderFrameHost* render_frame_host, |
| 405 const GURL& validated_url, |
| 406 bool is_error_page, |
| 407 bool is_iframe_srcdoc) override; |
| 404 void AppCacheAccessed(const GURL& manifest_url, | 408 void AppCacheAccessed(const GURL& manifest_url, |
| 405 bool blocked_by_policy) override; | 409 bool blocked_by_policy) override; |
| 406 | 410 |
| 407 // content_settings::Observer implementation. | 411 // content_settings::Observer implementation. |
| 408 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, | 412 void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, |
| 409 const ContentSettingsPattern& secondary_pattern, | 413 const ContentSettingsPattern& secondary_pattern, |
| 410 ContentSettingsType content_type, | 414 ContentSettingsType content_type, |
| 411 std::string resource_identifier) override; | 415 std::string resource_identifier) override; |
| 412 | 416 |
| 413 // Notifies all registered |SiteDataObserver|s. | 417 // Notifies all registered |SiteDataObserver|s. |
| 414 void NotifySiteDataObservers(); | 418 void NotifySiteDataObservers(); |
| 415 | 419 |
| 416 // Clears the Geolocation settings. | 420 // Clears the Geolocation settings. |
| 417 void ClearGeolocationContentSettings(); | 421 void ClearGeolocationContentSettings(); |
| 418 | 422 |
| 419 // Clears the MIDI settings. | 423 // Clears the MIDI settings. |
| 420 void ClearMidiContentSettings(); | 424 void ClearMidiContentSettings(); |
| 421 | 425 |
| 422 // Updates Geolocation settings on navigation. | 426 // Updates Geolocation settings on navigation. |
| 423 void GeolocationDidNavigate(content::NavigationHandle* navigation_handle); | 427 void GeolocationDidNavigate( |
| 428 const content::LoadCommittedDetails& details); |
| 424 | 429 |
| 425 // Updates MIDI settings on navigation. | 430 // Updates MIDI settings on navigation. |
| 426 void MidiDidNavigate(content::NavigationHandle* navigation_handle); | 431 void MidiDidNavigate(const content::LoadCommittedDetails& details); |
| 427 | 432 |
| 428 // All currently registered |SiteDataObserver|s. | 433 // All currently registered |SiteDataObserver|s. |
| 429 base::ObserverList<SiteDataObserver> observer_list_; | 434 base::ObserverList<SiteDataObserver> observer_list_; |
| 430 | 435 |
| 431 struct ContentSettingsStatus { | 436 struct ContentSettingsStatus { |
| 432 bool blocked; | 437 bool blocked; |
| 433 bool blockage_indicated_to_user; | 438 bool blockage_indicated_to_user; |
| 434 bool allowed; | 439 bool allowed; |
| 435 }; | 440 }; |
| 436 // Stores which content setting types actually have blocked content. | 441 // Stores which content setting types actually have blocked content. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 485 |
| 481 // The devices to be displayed in the media bubble when the media stream | 486 // The devices to be displayed in the media bubble when the media stream |
| 482 // request is requesting certain specific devices. | 487 // request is requesting certain specific devices. |
| 483 std::string media_stream_requested_audio_device_; | 488 std::string media_stream_requested_audio_device_; |
| 484 std::string media_stream_requested_video_device_; | 489 std::string media_stream_requested_video_device_; |
| 485 | 490 |
| 486 // Manages information about Subresource filtering activation. | 491 // Manages information about Subresource filtering activation. |
| 487 bool subresource_filter_enabled_; | 492 bool subresource_filter_enabled_; |
| 488 bool subresource_filter_blockage_indicated_; | 493 bool subresource_filter_blockage_indicated_; |
| 489 | 494 |
| 490 // Holds the previous committed url during a navigation. | |
| 491 GURL previous_url_; | |
| 492 | |
| 493 // Observer to watch for content settings changed. | 495 // Observer to watch for content settings changed. |
| 494 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 496 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
| 495 | 497 |
| 496 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 498 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
| 497 }; | 499 }; |
| 498 | 500 |
| 499 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 501 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| OLD | NEW |