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