Chromium Code Reviews| 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 tight either to a single content | |
|
msramek
2016/07/27 13:28:26
nit: tied
melandory
2016/07/27 15:05:49
Done.
| |
| 43 // setting or to any content setting. This state is not ideal, potential | |
| 44 // solution is to use a map<WebContents*, bool> in the | |
| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 188 |
| 182 // Returns whether a particular kind of content has been blocked for this | 189 // Returns whether a particular kind of content has been blocked for this |
| 183 // page. | 190 // page. |
| 184 bool IsContentBlocked(ContentSettingsType content_type) const; | 191 bool IsContentBlocked(ContentSettingsType content_type) const; |
| 185 | 192 |
| 186 // Returns true if content blockage was indicated to the user. | 193 // Returns true if content blockage was indicated to the user. |
| 187 bool IsBlockageIndicated(ContentSettingsType content_type) const; | 194 bool IsBlockageIndicated(ContentSettingsType content_type) const; |
| 188 | 195 |
| 189 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); | 196 void SetBlockageHasBeenIndicated(ContentSettingsType content_type); |
| 190 | 197 |
| 198 void SetSubresourceFilteringActivationIndicated(); | |
|
msramek
2016/07/27 13:28:27
Why the renaming to "FilteringActivation"? Since t
melandory
2016/07/27 15:05:48
Done.
| |
| 199 | |
| 200 bool IsSubresourceFilteringActivationIndicated() const; | |
| 201 | |
| 191 // Returns whether a particular kind of content has been allowed. Currently | 202 // Returns whether a particular kind of content has been allowed. Currently |
| 192 // only tracks cookies. | 203 // only tracks cookies. |
| 193 bool IsContentAllowed(ContentSettingsType content_type) const; | 204 bool IsContentAllowed(ContentSettingsType content_type) const; |
| 194 | 205 |
| 195 // Returns the names of plugins that have been blocked for this tab. | 206 // Returns the names of plugins that have been blocked for this tab. |
| 196 const std::vector<base::string16>& blocked_plugin_names() const { | 207 const std::vector<base::string16>& blocked_plugin_names() const { |
| 197 return blocked_plugin_names_; | 208 return blocked_plugin_names_; |
| 198 } | 209 } |
| 199 | 210 |
| 200 const GURL& media_stream_access_origin() const { | 211 const GURL& media_stream_access_origin() const { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 const ContentSettingsUsagesState& geolocation_usages_state() const { | 244 const ContentSettingsUsagesState& geolocation_usages_state() const { |
| 234 return geolocation_usages_state_; | 245 return geolocation_usages_state_; |
| 235 } | 246 } |
| 236 | 247 |
| 237 // Returns the ContentSettingsUsageState that controls the MIDI usage on | 248 // Returns the ContentSettingsUsageState that controls the MIDI usage on |
| 238 // this page. | 249 // this page. |
| 239 const ContentSettingsUsagesState& midi_usages_state() const { | 250 const ContentSettingsUsagesState& midi_usages_state() const { |
| 240 return midi_usages_state_; | 251 return midi_usages_state_; |
| 241 } | 252 } |
| 242 | 253 |
| 254 bool IsSubresourceBlocked() const { return subresource_filter_enabled_; } | |
|
msramek
2016/07/27 13:28:26
AFAIU, in general a method can be inlined in .cc f
melandory
2016/07/27 15:05:49
Done
| |
| 255 | |
| 256 void SetSubresourceFilterEnabledd(bool enabled) { | |
|
msramek
2016/07/27 13:28:27
typo: Enabled (single "d")
melandory
2016/07/27 15:05:48
Done.
| |
| 257 subresource_filter_enabled_ = enabled; | |
| 258 } | |
| 259 | |
| 243 // Call to indicate that there is a protocol handler pending user approval. | 260 // Call to indicate that there is a protocol handler pending user approval. |
| 244 void set_pending_protocol_handler(const ProtocolHandler& handler) { | 261 void set_pending_protocol_handler(const ProtocolHandler& handler) { |
| 245 pending_protocol_handler_ = handler; | 262 pending_protocol_handler_ = handler; |
| 246 } | 263 } |
| 247 | 264 |
| 248 const ProtocolHandler& pending_protocol_handler() const { | 265 const ProtocolHandler& pending_protocol_handler() const { |
| 249 return pending_protocol_handler_; | 266 return pending_protocol_handler_; |
| 250 } | 267 } |
| 251 | 268 |
| 252 void ClearPendingProtocolHandler() { | 269 void ClearPendingProtocolHandler() { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 MicrophoneCameraState microphone_camera_state_; | 477 MicrophoneCameraState microphone_camera_state_; |
| 461 // The selected devices at the last media stream request. | 478 // The selected devices at the last media stream request. |
| 462 std::string media_stream_selected_audio_device_; | 479 std::string media_stream_selected_audio_device_; |
| 463 std::string media_stream_selected_video_device_; | 480 std::string media_stream_selected_video_device_; |
| 464 | 481 |
| 465 // 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 |
| 466 // request is requesting certain specific devices. | 483 // request is requesting certain specific devices. |
| 467 std::string media_stream_requested_audio_device_; | 484 std::string media_stream_requested_audio_device_; |
| 468 std::string media_stream_requested_video_device_; | 485 std::string media_stream_requested_video_device_; |
| 469 | 486 |
| 487 // Manages information about Subresource filtering activation. | |
| 488 bool subresource_filter_enabled_; | |
| 489 bool subresource_filter_blockage_indicated_; | |
| 490 | |
| 470 // Observer to watch for content settings changed. | 491 // Observer to watch for content settings changed. |
| 471 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 492 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
| 472 | 493 |
| 473 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 494 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
| 474 }; | 495 }; |
| 475 | 496 |
| 476 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 497 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
| OLD | NEW |