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

Unified Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 415433002: Turn webspeech on/off when tab goes fore/background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the issue for webrtc Created 6 years, 5 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
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/media_stream_devices_controller.cc
diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc
index 1103f9af842553ecfca9291206d657caa8c569f8..7d2bf245050f0a464d6c6348c43b24efead6c61e 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -23,12 +23,12 @@
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/media_stream_request.h"
#include "extensions/common/constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
-
DaleCurtis 2014/07/23 22:17:19 Line break is normally kept here.
qinmin 2014/07/23 22:28:48 Done.
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/users/user_manager.h"
#endif
@@ -662,7 +662,7 @@ bool MediaStreamDevicesController::IsDeviceAudioCaptureRequestedAndAllowed()
const {
MediaStreamTypeSettingsMap::const_iterator it =
request_permissions_.find(content::MEDIA_DEVICE_AUDIO_CAPTURE);
- return (it != request_permissions_.end() &&
+ return (it != request_permissions_.end() && IsCaptureDeviceRequestAllowed() &&
it->second.permission == MEDIA_ALLOWED);
}
@@ -670,6 +670,14 @@ bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed()
const {
MediaStreamTypeSettingsMap::const_iterator it =
request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE);
- return (it != request_permissions_.end() &&
+ return (it != request_permissions_.end() && IsCaptureDeviceRequestAllowed() &&
it->second.permission == MEDIA_ALLOWED);
}
+
+bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const {
+#if defined(OS_ANDROID)
+ // Don't approve device requests if the tab was hidden.
+ return web_contents_->GetRenderWidgetHostView()->IsShowing();
+#endif
+ return true;
+}
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698