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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 // This class manages state about permissions, content settings, cookies and | 39 // This class manages state about permissions, content settings, cookies and |
40 // site data for a specific WebContents. It tracks which content was accessed | 40 // site data for a specific WebContents. It tracks which content was accessed |
41 // and which content was blocked. Based on this it provides information about | 41 // and which content was blocked. Based on this it provides information about |
42 // which types of content were accessed and blocked. | 42 // which types of content were accessed and blocked. |
43 class TabSpecificContentSettings | 43 class TabSpecificContentSettings |
44 : public content::WebContentsObserver, | 44 : public content::WebContentsObserver, |
45 public content_settings::Observer, | 45 public content_settings::Observer, |
46 public content::WebContentsUserData<TabSpecificContentSettings> { | 46 public content::WebContentsUserData<TabSpecificContentSettings> { |
47 public: | 47 public: |
48 // Flags for use in microphone_camera_state_. If *_BLOCKED is set, then | |
49 // its corresponding *_ALLOWED flag must also be set. | |
Peter Kasting
2014/09/24 01:33:00
Was _ALLOWED here supposed to be _ACCESSED? If so
| |
48 enum MicrophoneCameraState { | 50 enum MicrophoneCameraState { |
Peter Kasting
2014/09/24 01:33:00
Nit: Don't use an enum to declare bitmasks. Use c
robwu
2014/09/24 23:38:44
Done.
| |
49 MICROPHONE_CAMERA_NOT_ACCESSED = 0, | 51 MICROPHONE_CAMERA_NOT_ACCESSED = 0, |
50 MICROPHONE_ACCESSED, | 52 MICROPHONE_ACCESSED = 1 << 0, |
51 CAMERA_ACCESSED, | 53 MICROPHONE_BLOCKED = 1 << 1, |
52 MICROPHONE_CAMERA_ACCESSED, | 54 CAMERA_ACCESSED = 1 << 2, |
53 MICROPHONE_BLOCKED, | 55 CAMERA_BLOCKED = 1 << 3, |
54 CAMERA_BLOCKED, | |
55 MICROPHONE_CAMERA_BLOCKED, | |
56 }; | 56 }; |
57 | 57 |
58 // Classes that want to be notified about site data events must implement | 58 // Classes that want to be notified about site data events must implement |
59 // this abstract class and add themselves as observer to the | 59 // this abstract class and add themselves as observer to the |
60 // |TabSpecificContentSettings|. | 60 // |TabSpecificContentSettings|. |
61 class SiteDataObserver { | 61 class SiteDataObserver { |
62 public: | 62 public: |
63 explicit SiteDataObserver( | 63 explicit SiteDataObserver( |
64 TabSpecificContentSettings* tab_specific_content_settings); | 64 TabSpecificContentSettings* tab_specific_content_settings); |
65 virtual ~SiteDataObserver(); | 65 virtual ~SiteDataObserver(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 } | 204 } |
205 | 205 |
206 const std::string& media_stream_requested_audio_device() const { | 206 const std::string& media_stream_requested_audio_device() const { |
207 return media_stream_requested_audio_device_; | 207 return media_stream_requested_audio_device_; |
208 } | 208 } |
209 | 209 |
210 const std::string& media_stream_requested_video_device() const { | 210 const std::string& media_stream_requested_video_device() const { |
211 return media_stream_requested_video_device_; | 211 return media_stream_requested_video_device_; |
212 } | 212 } |
213 | 213 |
214 const std::string& media_stream_selected_audio_device() const { | |
215 return media_stream_selected_audio_device_; | |
216 } | |
217 | |
218 const std::string& media_stream_selected_video_device() const { | |
219 return media_stream_selected_video_device_; | |
220 } | |
221 | |
214 // Returns the state of the camera and microphone usage. | 222 // Returns the state of the camera and microphone usage. |
215 MicrophoneCameraState GetMicrophoneCameraState() const; | 223 unsigned GetMicrophoneCameraState() const; |
Peter Kasting
2014/09/24 01:33:00
(Here and elsewhere) Use types like uint32_t inste
robwu
2014/09/24 23:38:44
Done.
| |
224 | |
225 // Returns whether the state of the camera and microphone usage or device has | |
226 // changed. | |
227 bool IsMicrophoneCameraStateChanged() const; | |
216 | 228 |
217 // Returns the ContentSettingsUsagesState that controls the | 229 // Returns the ContentSettingsUsagesState that controls the |
218 // geolocation API usage on this page. | 230 // geolocation API usage on this page. |
219 const ContentSettingsUsagesState& geolocation_usages_state() const { | 231 const ContentSettingsUsagesState& geolocation_usages_state() const { |
220 return geolocation_usages_state_; | 232 return geolocation_usages_state_; |
221 } | 233 } |
222 | 234 |
223 // Returns the ContentSettingsUsageState that controls the MIDI usage on | 235 // Returns the ContentSettingsUsageState that controls the MIDI usage on |
224 // this page. | 236 // this page. |
225 const ContentSettingsUsagesState& midi_usages_state() const { | 237 const ContentSettingsUsagesState& midi_usages_state() const { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 ContentSetting pending_protocol_handler_setting_; | 418 ContentSetting pending_protocol_handler_setting_; |
407 | 419 |
408 // Stores whether the user can load blocked plugins on this page. | 420 // Stores whether the user can load blocked plugins on this page. |
409 bool load_plugins_link_enabled_; | 421 bool load_plugins_link_enabled_; |
410 | 422 |
411 // The origin of the media stream request. Note that we only support handling | 423 // The origin of the media stream request. Note that we only support handling |
412 // settings for one request per tab. The latest request's origin will be | 424 // settings for one request per tab. The latest request's origin will be |
413 // stored here. http://crbug.com/259794 | 425 // stored here. http://crbug.com/259794 |
414 GURL media_stream_access_origin_; | 426 GURL media_stream_access_origin_; |
415 | 427 |
428 // The microphone and camera state at the last media stream request. | |
429 // This value is composed of MicrophoneCameraState values. | |
430 unsigned microphone_camera_state_; | |
431 // The selected devices at the last media stream request. | |
432 std::string media_stream_selected_audio_device_; | |
433 std::string media_stream_selected_video_device_; | |
434 | |
416 // The devices to be displayed in the media bubble when the media stream | 435 // The devices to be displayed in the media bubble when the media stream |
417 // request is requesting certain specific devices. | 436 // request is requesting certain specific devices. |
418 std::string media_stream_requested_audio_device_; | 437 std::string media_stream_requested_audio_device_; |
419 std::string media_stream_requested_video_device_; | 438 std::string media_stream_requested_video_device_; |
420 | 439 |
421 // Observer to watch for content settings changed. | 440 // Observer to watch for content settings changed. |
422 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 441 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
423 | 442 |
424 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 443 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
425 }; | 444 }; |
426 | 445 |
427 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 446 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
OLD | NEW |