Index: chrome/browser/media/media_stream_devices_prefs.h |
diff --git a/chrome/browser/media/media_stream_devices_prefs.h b/chrome/browser/media/media_stream_devices_prefs.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a26d4d38b43f287d30633d98499be2f972c98ad9 |
--- /dev/null |
+++ b/chrome/browser/media/media_stream_devices_prefs.h |
@@ -0,0 +1,78 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ |
+#define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "chrome/common/content_settings.h" |
+#include "content/public/common/media_stream_request.h" |
+ |
+class ContentSettingsPattern; |
+class GURL; |
+class PrefService; |
+class Profile; |
+ |
+class MediaStreamDevicesPrefs { |
+ public: |
+ explicit MediaStreamDevicesPrefs(Profile* profile); |
+ |
+ // Registers the preferences related to Media Stream devices whitelist. |
+ static void RegisterUserPrefs(PrefService* user_prefs); |
+ |
+ // The following functions are public methods to be called by the media |
+ // stream inforbar delegate. |
+ |
+ // Returns true if the media section in content settings is set to |
+ // |CONTENT_SETTING_BLOCK|, otherwise returns false. |
+ bool IsMediaDeviceBlocked(); |
+ |
+ // Returns true if the origin has been always allowed to get access to media |
+ // devices by the users, otherwise returns false. |
+ bool IsOriginAlwaysAllowed(const GURL& origin); |
+ |
+ // Gets the always allowed audio device for this origin, returns an empty |
+ // string if the device is not available. |
+ std::string GetAlwaysAllowedAudioDevice( |
+ const GURL& origin, const content::MediaStreamDevices& devices); |
+ |
+ // Gets the always allowed video device for this origin, returns an empty |
+ // string if the device is not available. |
+ std::string GetAlwaysAllowedVideoDevice( |
+ const GURL& origin, const content::MediaStreamDevices& devices); |
+ |
+ // Adds the origin and devices to the media device whitelists. |
+ // This function is called after the user grants a always allow permission to |
+ // the origin. |
+ void WhitelistOriginAndDevices(const GURL& origin, |
+ 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.
|
+ |
+ // Remove the origin and devices from the media device whitelists. |
+ // This function does nothing if the origin is not in the whitelists. |
+ void RemoveOriginFromWhitelists(const GURL& origin); |
+ |
+ private: |
+ // Helper functions. |
+ void AddExceptionToContentSettings(const GURL& origin); |
+ std::string GetAlwaysAllowedDevice( |
+ const char* pref_id, |
+ const GURL& origin, |
+ const content::MediaStreamDevices& devices); |
+ bool IsDevicePairedWithOrigin(const char* pref_id, |
+ const GURL& origin, |
+ const std::string& device); |
+ void AddOrigin(const char* pref_id, |
+ const GURL& origin, |
+ const std::string& device); |
+ void RemoveOrigin(const char* pref_id, const GURL& security_origin); |
+ |
+ // 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.
|
+ Profile* profile_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesPrefs); |
+}; |
+ |
+#endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_PREFS_H_ |