Index: chrome/browser/media/media_stream_devices_controller.h |
diff --git a/chrome/browser/media/media_stream_devices_controller.h b/chrome/browser/media/media_stream_devices_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..98758757b67f5cb4e9d49b8dbc51047374612263 |
--- /dev/null |
+++ b/chrome/browser/media/media_stream_devices_controller.h |
@@ -0,0 +1,89 @@ |
+// 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_CONTROLLER_H_ |
+#define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "base/callback.h" |
+#include "chrome/browser/media/media_stream_devices_controller.h" |
+#include "content/public/browser/content_browser_client.h" |
+#include "content/public/common/media_stream_request.h" |
+ |
+ |
+class ContentSettingsPattern; |
+class GURL; |
+class Profile; |
+ |
+class MediaStreamDevicesController { |
+ public: |
+ MediaStreamDevicesController(Profile* profile, |
+ const content::MediaStreamRequest* request, |
+ const content::MediaResponseCallback& callback); |
+ |
+ virtual ~MediaStreamDevicesController(); |
+ |
+ // Public method to be called before creating the MediaStreamInfoBarDelegate. |
+ // This function will check the content settings exceptions and take the |
+ // corresponding action on exception which matches the request. |
+ bool DismissInfoBarAndTakeActionOnSettings(); |
+ |
+ // Public methods to be called by MediaStreamInfoBarDelegate; |
+ bool has_audio() const { return has_audio_; } |
+ bool has_video() const { return has_video_; } |
+ content::MediaStreamDevices GetAudioDevices() const; |
+ content::MediaStreamDevices GetVideoDevices() const; |
+ const GURL& GetSecurityOrigin() const; |
+ void Accept(const std::string& audio_id, const std::string& video_id, |
+ bool always_allow); |
+ void Deny(); |
+ |
+ private: |
+ // Finds a device in the current request with the specified |id| and |type|, |
+ // adds it to the |devices| array and also return the name of the device. |
+ void AddDeviceWithId(content::MediaStreamDeviceType type, |
+ const std::string& id, |
+ content::MediaStreamDevices* devices, |
+ std::string* device_name); |
+ |
+ // Returns true if request's origin is from internal objects like |
+ // chrome://URLs, otherwise returns false. |
+ bool IsInternalContent(); |
+ |
+ // Returns true if the media section in content settings is set to |
+ // |CONTENT_SETTING_BLOCK|, otherwise returns false. |
+ bool IsMediaDeviceBlocked(); |
+ |
+ // Grants "always allow" exception for the origin to use the selected devices. |
+ void AlwaysAllowOriginAndDevices(const std::string& audio_device, |
+ const std::string& video_device); |
+ |
+ // Gets the respective "always allowed" devices for the origin in |request_|. |
+ // |audio_id| and |video_id| will be empty if there is no "always allowed" |
+ // device for the origin, or any of the devices is not listed on the devices |
+ // list in |request_|. |
+ void GetAlwaysAllowedDevices(std::string* audio_id, |
+ std::string* video_id); |
+ |
+ std::string GetDeviceIdByName(content::MediaStreamDeviceType type, |
+ const std::string& name); |
+ |
+ std::string GetFirstDevice(content::MediaStreamDeviceType type); |
+ |
+ bool has_audio_; |
+ bool has_video_; |
+ |
+ Profile* profile_; |
Bernhard Bauer
2012/06/18 17:38:14
Could you add a comment that the owner of this cla
no longer working on chromium
2012/06/19 12:23:16
Done.
|
+ |
+ // The original request for access to devices. |
+ const content::MediaStreamRequest* request_; |
+ |
+ // The callback that needs to be Run to notify WebRTC of whether access to |
+ // audio/video devices was granted or not. |
+ content::MediaResponseCallback callback_; |
Ivan Korotkov
2012/06/14 17:14:12
Please rename to something more meaningful, like r
no longer working on chromium
2012/06/15 16:52:07
Since there is only one type of callback used by t
|
+}; |
+ |
+#endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |