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

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: 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 586120c2db7f0a8f19df90ff641e0f8acf8cb9d7..1ec403508e33ad97fdc22b9251bed5bcecb2e392 100644
--- a/chrome/browser/ui/media_stream_infobar_delegate.h
+++ b/chrome/browser/ui/media_stream_infobar_delegate.h
@@ -10,10 +10,12 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "chrome/browser/infobars/infobar_delegate.h"
+#include "chrome/browser/media/media_stream_devices_prefs.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/media_stream_request.h"
class MessageLoop;
+class PrefService;
class TabContents;
typedef TabContents TabContentsWrapper;
@@ -26,6 +28,7 @@ class MediaStreamInfoBarDelegate : public InfoBarDelegate {
public:
MediaStreamInfoBarDelegate(
InfoBarTabHelper* tab_helper,
+ Profile* profile,
const content::MediaStreamRequest* request,
const content::MediaResponseCallback& callback);
@@ -44,20 +47,37 @@ class MediaStreamInfoBarDelegate : public InfoBarDelegate {
// of this request.
const GURL& GetSecurityOrigin() const;
+ // Returns true if we should show the infobar for this request, otherwise
+ // returns false.
+ bool ShouldShowInfoBar();
+
// 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 option t
// 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:
+ // Gets an array of selected devices and add them to |devices| array.
+ void GetDevicesWithId(const std::string& audio_id,
+ const std::string& video_id,
+ content::MediaStreamDevices* devices);
+
// 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);
+ // Gets the always allowed audio and/or video devices. This function is called
+ // by ShouldShowInfoBar().
+ // Returns true if the always allowed devices are available for this
+ // request, otherwise returns false.
+ bool GetAlwaysAllowedDevices(std::string* audio_id, std::string* video_id);
+
// InfoBarDelegate:
virtual InfoBar* CreateInfoBar(InfoBarTabHelper* owner) OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
@@ -76,6 +96,10 @@ class MediaStreamInfoBarDelegate : public InfoBarDelegate {
bool has_audio_;
bool has_video_;
+ private:
+ // The media stram capture devices related preferences.
+ MediaStreamDevicesPrefs prefs_;
+
DISALLOW_COPY_AND_ASSIGN(MediaStreamInfoBarDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698