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