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 use a map<WebContents*, bool> in the | |
Bernhard Bauer
2016/07/27 19:27:44
Instead of using a map, could you attach this info
melandory
2016/07/28 14:04:56
Done.
| |
45 // ContentSettingMediaImageModel. | |
46 | |
40 // This class manages state about permissions, content settings, cookies and | 47 // This class manages state about permissions, content settings, cookies and |
41 // site data for a specific WebContents. It tracks which content was accessed | 48 // 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 | 49 // and which content was blocked. Based on this it provides information about |
43 // which types of content were accessed and blocked. | 50 // which types of content were accessed and blocked. |
44 class TabSpecificContentSettings | 51 class TabSpecificContentSettings |
45 : public content::WebContentsObserver, | 52 : public content::WebContentsObserver, |
46 public content_settings::Observer, | 53 public content_settings::Observer, |
47 public content::WebContentsUserData<TabSpecificContentSettings> { | 54 public content::WebContentsUserData<TabSpecificContentSettings> { |
48 public: | 55 public: |
49 // Fields describing the current mic/camera state. If a page has attempted to | 56 // 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. | 179 // Resets all cookies related information. |
173 // TODO(vabr): Only public for tests. Move to a test client. | 180 // TODO(vabr): Only public for tests. Move to a test client. |
174 void ClearCookieSpecificContentSettings(); | 181 void ClearCookieSpecificContentSettings(); |
175 | 182 |
176 // Changes the |content_blocked_| entry for popups. | 183 // Changes the |content_blocked_| entry for popups. |
177 void SetPopupsBlocked(bool blocked); | 184 void SetPopupsBlocked(bool blocked); |
178 | 185 |
179 // Changes the |content_blocked_| entry for downloads. | 186 // Changes the |content_blocked_| entry for downloads. |
180 void SetDownloadsBlocked(bool blocked); | 187 void SetDownloadsBlocked(bool blocked); |
181 | 188 |
189 void SetSubresourceBlocked(bool enabled); | |
msramek
2016/07/27 15:47:40
nit: Comments for public methods, here and below.
melandory
2016/07/28 14:04:56
Done.
| |
190 | |
182 // 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 |
183 // page. | 192 // page. |
184 bool IsContentBlocked(ContentSettingsType content_type) const; | 193 bool IsContentBlocked(ContentSettingsType content_type) const; |
185 | 194 |
195 // Returns true if Safe Browsing Subresource Filter is active for the page. | |
196 bool IsSubresourceBlocked() const; | |
raymes
2016/07/28 05:10:58
Again, we could make several simplifications here
melandory
2016/07/28 14:04:56
Added TODO.
| |
197 | |
186 // Returns true if content blockage was indicated to the user. | 198 // Returns true if content blockage was indicated to the user. |
187 bool IsBlockageIndicated(ContentSettingsType content_type) const; | 199 bool IsBlockageIndicated(ContentSettingsType content_type) const; |
188 | 200 |
201 // Returns true if the activation of the Safe Browsing Subresource Filter was | |
202 // indicated to the user. | |
203 bool IsSubresourceBlockageIndicated() const; | |
204 | |
189 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); | 205 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); |
190 | 206 |
207 void SetSubresourceBlockageIndicated(); | |
208 | |
191 // Returns whether a particular kind of content has been allowed. Currently | 209 // Returns whether a particular kind of content has been allowed. Currently |
192 // only tracks cookies. | 210 // only tracks cookies. |
193 bool IsContentAllowed(ContentSettingsType content_type) const; | 211 bool IsContentAllowed(ContentSettingsType content_type) const; |
194 | 212 |
195 // Returns the names of plugins that have been blocked for this tab. | 213 // Returns the names of plugins that have been blocked for this tab. |
196 const std::vector<base::string16>& blocked_plugin_names() const { | 214 const std::vector<base::string16>& blocked_plugin_names() const { |
197 return blocked_plugin_names_; | 215 return blocked_plugin_names_; |
198 } | 216 } |
199 | 217 |
200 const GURL& media_stream_access_origin() const { | 218 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_; | 478 MicrophoneCameraState microphone_camera_state_; |
461 // The selected devices at the last media stream request. | 479 // The selected devices at the last media stream request. |
462 std::string media_stream_selected_audio_device_; | 480 std::string media_stream_selected_audio_device_; |
463 std::string media_stream_selected_video_device_; | 481 std::string media_stream_selected_video_device_; |
464 | 482 |
465 // The devices to be displayed in the media bubble when the media stream | 483 // The devices to be displayed in the media bubble when the media stream |
466 // request is requesting certain specific devices. | 484 // request is requesting certain specific devices. |
467 std::string media_stream_requested_audio_device_; | 485 std::string media_stream_requested_audio_device_; |
468 std::string media_stream_requested_video_device_; | 486 std::string media_stream_requested_video_device_; |
469 | 487 |
488 // Manages information about Subresource filtering activation. | |
489 bool subresource_filter_enabled_; | |
490 bool subresource_filter_blockage_indicated_; | |
491 | |
470 // Observer to watch for content settings changed. | 492 // Observer to watch for content settings changed. |
471 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 493 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
472 | 494 |
473 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 495 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
474 }; | 496 }; |
475 | 497 |
476 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 498 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
OLD | NEW |