Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3052)

Unified Diff: chrome/browser/ui/media_stream_infobar_delegate.h

Issue 10537099: add "always allow" option to the mediastream infobar and allow user to allow/not allow acces to devi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed sky's comment and replaced "Do not allow any site to" with "Do not allow sites to" Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/media_stream_infobar_delegate.h
diff --git a/chrome/browser/ui/media_stream_infobar_delegate.h b/chrome/browser/ui/media_stream_infobar_delegate.h
index ca19cddefe85e88e40e4bdccb0a16c17afd2a3fc..d0f66e573add5d2cd98d59916dc587bb2274bcca 100644
--- a/chrome/browser/ui/media_stream_infobar_delegate.h
+++ b/chrome/browser/ui/media_stream_infobar_delegate.h
@@ -7,14 +7,9 @@
#include <string>
-#include "base/callback.h"
#include "base/compiler_specific.h"
#include "chrome/browser/infobars/infobar_delegate.h"
-#include "content/public/browser/web_contents_delegate.h"
-#include "content/public/common/media_stream_request.h"
-
-class MessageLoop;
-class TabContents;
+#include "chrome/browser/media/media_stream_devices_controller.h"
// This class configures an infobar shown when a page requests access to a
// user's microphone and/or video camera. The user is shown a message asking
@@ -23,16 +18,16 @@ class TabContents;
// to them.
class MediaStreamInfoBarDelegate : public InfoBarDelegate {
public:
+ // MediaStreamInfoBarDelegate takes the ownership of the |controller|.
MediaStreamInfoBarDelegate(
InfoBarTabHelper* tab_helper,
- const content::MediaStreamRequest* request,
- const content::MediaResponseCallback& callback);
+ MediaStreamDevicesController* controller);
virtual ~MediaStreamInfoBarDelegate();
// These tell whether the user has to select audio and/or video devices.
- bool has_audio() const { return has_audio_; }
- bool has_video() const { return has_video_; }
+ bool HasAudio() const;
+ bool HasVideo() const;
// Returns lists of audio and/or video devices from which the user will have
// to choose.
@@ -43,20 +38,18 @@ class MediaStreamInfoBarDelegate : public InfoBarDelegate {
// of this request.
const GURL& GetSecurityOrigin() const;
+
// Callbacks to handle accepting devices or denying the request. |audio_id|
// and |video_id| are the device IDs of the accepted audio and video devices.
+ // |always_allow| is true if the "always allow" option is checked.
// The |audio_id| or |video_id| values are ignored if the request did not ask
// for audio or video devices respectively.
- void Accept(const std::string& audio_id, const std::string& video_id);
+ 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|,
- // and adds it to the |devices| array.
- void AddDeviceWithId(content::MediaStreamDeviceType type,
- const std::string& id,
- content::MediaStreamDevices* devices);
-
// InfoBarDelegate:
virtual InfoBar* CreateInfoBar(InfoBarTabHelper* owner) OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
@@ -64,16 +57,9 @@ class MediaStreamInfoBarDelegate : public InfoBarDelegate {
virtual Type GetInfoBarType() const OVERRIDE;
virtual MediaStreamInfoBarDelegate* AsMediaStreamInfoBarDelegate() OVERRIDE;
- // 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_;
-
- // Whether the request is for audio and/or video devices.
- bool has_audio_;
- bool has_video_;
+ private:
+ scoped_ptr<MediaStreamDevicesController> controller_;
DISALLOW_COPY_AND_ASSIGN(MediaStreamInfoBarDelegate);
};
« no previous file with comments | « chrome/browser/ui/gtk/infobars/media_stream_infobar_gtk.cc ('k') | chrome/browser/ui/media_stream_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698