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

Unified Diff: chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc

Issue 14646041: Allow virtual keyboard window to access audio stream and speech api for voice input (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/ash/ash_keyboard_controller_proxy.cc
diff --git a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
index fd38ee0c3c5899e9d2ad9cecac3efdb6204c0d0f..26bbcfd250d51a648ea11b03f655457c9d0af675 100644
--- a/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
+++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
@@ -7,12 +7,17 @@
#include "ash/display/display_controller.h"
#include "ash/shell.h"
#include "chrome/browser/extensions/extension_function_dispatcher.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
+#include "extensions/browser/view_type_utils.h"
+#include "extensions/common/constants.h"
#include "ipc/ipc_message_macros.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
@@ -41,11 +46,30 @@ ui::InputMethod* AshKeyboardControllerProxy::GetInputMethod() {
return root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
}
+void AshKeyboardControllerProxy::RequestAudioInput(
+ content::WebContents* web_contents,
+ const content::MediaStreamRequest& request,
+ const content::MediaResponseCallback& callback) {
+ const extensions::Extension* extension = NULL;
+ GURL origin(request.security_origin);
+ if (origin.SchemeIs(extensions::kExtensionScheme)) {
+ ExtensionService* extensions_service =
+ extensions::ExtensionSystem::Get(ProfileManager::GetDefaultProfile())->
+ extension_service();
+ extension = extensions_service->extensions()->GetByID(origin.host());
+ DCHECK(extension);
+ }
+
+ MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
+ web_contents, request, callback, extension);
+}
+
void AshKeyboardControllerProxy::SetupWebContents(
content::WebContents* contents) {
extension_function_dispatcher_.reset(
new ExtensionFunctionDispatcher(ProfileManager::GetDefaultProfile(),
this));
bshe 2013/05/14 18:35:21 This is probably hacky? The reason I set it to VIE
sadrul 2013/05/16 19:34:08 I am not really sure. bryeung@ or someone more fam
bryeung 2013/05/16 20:34:49 Sadly I'm not really sure either. You'd probably
Matt Perry 2013/05/17 19:19:53 I don't think I have enough context. AFAICT, this
+ extensions::SetViewType(contents, extensions::VIEW_TYPE_TAB_CONTENTS);
Observe(contents);
}

Powered by Google App Engine
This is Rietveld 408576698