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

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

Issue 13164002: Create and show the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix upstream Created 7 years, 8 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
new file mode 100644
index 0000000000000000000000000000000000000000..be6550b6e868f07d60ab250feec82add5f85a068
--- /dev/null
+++ b/chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc
@@ -0,0 +1,71 @@
+// Copyright (c) 2013 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.
+
+#include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h"
+
+#include "chrome/browser/extensions/extension_function_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 "ipc/ipc_message_macros.h"
+#include "ui/aura/window.h"
+#include "ui/keyboard/keyboard_controller.h"
+
+AshKeyboardControllerProxy::AshKeyboardControllerProxy() {}
+
+AshKeyboardControllerProxy::~AshKeyboardControllerProxy() {}
+
+aura::Window* AshKeyboardControllerProxy::GetKeyboardWindow() {
+ if (!web_contents_) {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+
+ extension_function_dispatcher_.reset(
+ new ExtensionFunctionDispatcher(profile, this));
+
+ GURL keyboard_url("chrome://keyboard/");
+ web_contents_.reset(content::WebContents::Create(
+ content::WebContents::CreateParams(
+ profile,
+ content::SiteInstance::CreateForURL(profile, keyboard_url))));
+
+ content::WebContentsObserver::Observe(web_contents_.get());
+
+ web_contents_->GetController().LoadURL(
+ keyboard_url,
+ content::Referrer(),
+ content::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ std::string());
+ }
+ return web_contents_->GetView()->GetNativeView();
+}
+
+extensions::WindowController*
+ AshKeyboardControllerProxy::GetExtensionWindowController() const {
+ // The keyboard doesn't have a window controller.
+ return NULL;
+}
+
+content::WebContents*
+ AshKeyboardControllerProxy::GetAssociatedWebContents() const {
+ return web_contents_.get();
+}
+
+void AshKeyboardControllerProxy::OnRequest(
+ const ExtensionHostMsg_Request_Params& params) {
+ extension_function_dispatcher_->Dispatch(
+ params, web_contents_->GetRenderViewHost());
+}
+
+bool AshKeyboardControllerProxy::OnMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(AshKeyboardControllerProxy, message)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
« no previous file with comments | « chrome/browser/ui/ash/ash_keyboard_controller_proxy.h ('k') | chrome/browser/ui/ash/chrome_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698