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 18 matching lines...) Expand all Loading... |
29 class HostContentSettingsMap; | 29 class HostContentSettingsMap; |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 class NavigationHandle; | 32 class NavigationHandle; |
33 } | 33 } |
34 | 34 |
35 namespace net { | 35 namespace net { |
36 class CookieOptions; | 36 class CookieOptions; |
37 } | 37 } |
38 | 38 |
39 // TODO(msramek): Subresource filter and media currently are storing their state | 39 // TODO(msramek): Media is storing their state in TabSpecificContentSettings: |
40 // in TabSpecificContentSettings: |microphone_camera_state_| and | 40 // |microphone_camera_state_| without being tied to a single content setting. |
41 // |subresource_filter_enabled_| without being tied either to a single content | 41 // This state is not ideal, potential solution is to save this information via |
42 // setting or to any content setting. This state is not ideal, potential | 42 // content::WebContentsUserData |
43 // solution is to save this information via content::WebContentsUserData | |
44 | 43 |
45 // This class manages state about permissions, content settings, cookies and | 44 // This class manages state about permissions, content settings, cookies and |
46 // site data for a specific WebContents. It tracks which content was accessed | 45 // site data for a specific WebContents. It tracks which content was accessed |
47 // and which content was blocked. Based on this it provides information about | 46 // and which content was blocked. Based on this it provides information about |
48 // which types of content were accessed and blocked. | 47 // which types of content were accessed and blocked. |
49 class TabSpecificContentSettings | 48 class TabSpecificContentSettings |
50 : public content::WebContentsObserver, | 49 : public content::WebContentsObserver, |
51 public content_settings::Observer, | 50 public content_settings::Observer, |
52 public content::WebContentsUserData<TabSpecificContentSettings> { | 51 public content::WebContentsUserData<TabSpecificContentSettings> { |
53 public: | 52 public: |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // CONTENT_SETTINGS_TYPE_JAVASCRIPT). | 181 // CONTENT_SETTINGS_TYPE_JAVASCRIPT). |
183 // TODO(vabr): Only public for tests. Move to a test client. | 182 // TODO(vabr): Only public for tests. Move to a test client. |
184 void ClearNavigationRelatedContentSettings(); | 183 void ClearNavigationRelatedContentSettings(); |
185 | 184 |
186 // Notifies that a Flash download has been blocked. | 185 // Notifies that a Flash download has been blocked. |
187 void FlashDownloadBlocked(); | 186 void FlashDownloadBlocked(); |
188 | 187 |
189 // Changes the |content_blocked_| entry for popups. | 188 // Changes the |content_blocked_| entry for popups. |
190 void SetPopupsBlocked(bool blocked); | 189 void SetPopupsBlocked(bool blocked); |
191 | 190 |
192 // Changes |subresource_filter_enabled_| entry for the Safe Browsing | |
193 // Subresource Filter. | |
194 void SetSubresourceBlocked(bool enabled); | |
195 | |
196 // Returns whether a particular kind of content has been blocked for this | 191 // Returns whether a particular kind of content has been blocked for this |
197 // page. | 192 // page. |
198 bool IsContentBlocked(ContentSettingsType content_type) const; | 193 bool IsContentBlocked(ContentSettingsType content_type) const; |
199 | 194 |
200 // Returns true if Safe Browsing Subresource Filter is active for the page. | |
201 // TODO(melandory): revisit this method if/once content setting will be added. | |
202 bool IsSubresourceBlocked() const; | |
203 | |
204 // Returns true if content blockage was indicated to the user. | 195 // Returns true if content blockage was indicated to the user. |
205 bool IsBlockageIndicated(ContentSettingsType content_type) const; | 196 bool IsBlockageIndicated(ContentSettingsType content_type) const; |
206 | 197 |
207 // Returns true if the activation of the Safe Browsing Subresource Filter was | |
208 // indicated to the user. | |
209 bool IsSubresourceBlockageIndicated() const; | |
210 | |
211 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); | 198 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); |
212 | 199 |
213 // Changes |subresource_filter_blockage_indicated_| in order to mark that | |
214 // Safe Browsing Subresource Filter was activated. | |
215 void SetSubresourceBlockageIndicated(); | |
216 | |
217 // Returns whether a particular kind of content has been allowed. Currently | 200 // Returns whether a particular kind of content has been allowed. Currently |
218 // only tracks cookies. | 201 // only tracks cookies. |
219 bool IsContentAllowed(ContentSettingsType content_type) const; | 202 bool IsContentAllowed(ContentSettingsType content_type) const; |
220 | 203 |
221 // Returns the names of plugins that have been blocked for this tab. | 204 // Returns the names of plugins that have been blocked for this tab. |
222 const std::vector<base::string16>& blocked_plugin_names() const { | 205 const std::vector<base::string16>& blocked_plugin_names() const { |
223 return blocked_plugin_names_; | 206 return blocked_plugin_names_; |
224 } | 207 } |
225 | 208 |
226 const GURL& media_stream_access_origin() const { | 209 const GURL& media_stream_access_origin() const { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 MicrophoneCameraState microphone_camera_state_; | 455 MicrophoneCameraState microphone_camera_state_; |
473 // The selected devices at the last media stream request. | 456 // The selected devices at the last media stream request. |
474 std::string media_stream_selected_audio_device_; | 457 std::string media_stream_selected_audio_device_; |
475 std::string media_stream_selected_video_device_; | 458 std::string media_stream_selected_video_device_; |
476 | 459 |
477 // The devices to be displayed in the media bubble when the media stream | 460 // The devices to be displayed in the media bubble when the media stream |
478 // request is requesting certain specific devices. | 461 // request is requesting certain specific devices. |
479 std::string media_stream_requested_audio_device_; | 462 std::string media_stream_requested_audio_device_; |
480 std::string media_stream_requested_video_device_; | 463 std::string media_stream_requested_video_device_; |
481 | 464 |
482 // Manages information about Subresource filtering activation. | |
483 bool subresource_filter_enabled_; | |
484 bool subresource_filter_blockage_indicated_; | |
485 | |
486 // Holds the previous committed url during a navigation. | 465 // Holds the previous committed url during a navigation. |
487 GURL previous_url_; | 466 GURL previous_url_; |
488 | 467 |
489 // Observer to watch for content settings changed. | 468 // Observer to watch for content settings changed. |
490 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 469 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
491 | 470 |
492 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 471 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
493 }; | 472 }; |
494 | 473 |
495 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 474 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
OLD | NEW |