OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ | |
6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "chrome/common/content_settings.h" | |
12 #include "content/public/common/media_stream_request.h" | |
13 | |
14 class ContentSettingsPattern; | |
15 class GURL; | |
16 class PrefService; | |
17 class Profile; | |
18 | |
19 class MediaStreamDevicesPrefs { | |
20 public: | |
21 explicit MediaStreamDevicesPrefs(Profile* profile); | |
22 | |
23 // Registers the preferences related to Media Stream devices whitelist. | |
24 static void RegisterUserPrefs(PrefService* user_prefs); | |
25 | |
26 // The following functions are public methods to be called by the media | |
27 // stream inforbar delegate. | |
28 | |
29 // Returns true if the media section in content settings is set to | |
30 // |CONTENT_SETTING_BLOCK|, otherwise returns false. | |
31 bool IsMediaDeviceBlocked(); | |
32 | |
33 // Returns true if the origin has been always allowed to get access to media | |
34 // devices by the users, otherwise returns false. | |
35 bool IsOriginAlwaysAllowed(const GURL& origin); | |
36 | |
37 // Gets the always allowed audio device for this origin, returns an empty | |
38 // string if the device is not available. | |
39 std::string GetAlwaysAllowedAudioDevice( | |
40 const GURL& origin, const content::MediaStreamDevices& devices); | |
41 | |
42 // Gets the always allowed video device for this origin, returns an empty | |
43 // string if the device is not available. | |
44 std::string GetAlwaysAllowedVideoDevice( | |
45 const GURL& origin, const content::MediaStreamDevices& devices); | |
46 | |
47 // Adds the origin and devices to the media device whitelists. | |
48 // This function is called after the user grants a always allow permission to | |
49 // the origin. | |
50 void WhitelistOriginAndDevices(const GURL& origin, | |
51 const content::MediaStreamDevices& devices); | |
tommi (sloooow) - chröme
2012/06/11 20:59:21
fix indent
no longer working on chromium
2012/06/14 13:03:25
Done.
| |
52 | |
53 // Remove the origin and devices from the media device whitelists. | |
54 // This function does nothing if the origin is not in the whitelists. | |
55 void RemoveOriginFromWhitelists(const GURL& origin); | |
56 | |
57 private: | |
58 // Helper functions. | |
59 void AddExceptionToContentSettings(const GURL& origin); | |
60 std::string GetAlwaysAllowedDevice( | |
61 const char* pref_id, | |
62 const GURL& origin, | |
63 const content::MediaStreamDevices& devices); | |
64 bool IsDevicePairedWithOrigin(const char* pref_id, | |
65 const GURL& origin, | |
66 const std::string& device); | |
67 void AddOrigin(const char* pref_id, | |
68 const GURL& origin, | |
69 const std::string& device); | |
70 void RemoveOrigin(const char* pref_id, const GURL& security_origin); | |
71 | |
72 // The profile which owns this object. | |
Bernhard Bauer
2012/06/11 18:16:00
That's not true. The infobar delegate owns this ob
no longer working on chromium
2012/06/14 13:03:25
Remove this invalid comment.
| |
73 Profile* profile_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesPrefs); | |
76 }; | |
77 | |
78 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ | |
OLD | NEW |