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

Unified Diff: chrome/browser/extensions/api/input/input.cc

Issue 16972006: Insert text directly from the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix include Created 7 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
« no previous file with comments | « chrome/browser/extensions/api/input/input.h ('k') | chrome/browser/extensions/api/input/input_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/input/input.cc
diff --git a/chrome/browser/extensions/api/input/input.cc b/chrome/browser/extensions/api/input/input.cc
index f0eecbeb303d338e25d6c34953cc53bc1d89dcd3..b4d264fcbec26bc28dc068196428d7b505126d8a 100644
--- a/chrome/browser/extensions/api/input/input.cc
+++ b/chrome/browser/extensions/api/input/input.cc
@@ -4,17 +4,15 @@
#include "chrome/browser/extensions/api/input/input.h"
-#include <string>
-
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string16.h"
#include "chrome/browser/extensions/extension_function_registry.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/events/event.h"
#if defined(USE_ASH)
#include "ash/shell.h"
-#include "ui/aura/root_window.h"
#include "ui/keyboard/keyboard_util.h"
#endif
@@ -27,19 +25,14 @@ const char kNotYetImplementedError[] =
namespace extensions {
-bool SendKeyboardEventInputFunction::RunImpl() {
+bool InsertTextInputFunction::RunImpl() {
#if defined(USE_ASH)
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- scoped_ptr<ui::KeyEvent> event(
- keyboard::KeyEventFromArgs(args_.get(), &error_));
- if (!event)
- return false;
-
- ash::Shell::GetActiveRootWindow()->AsRootWindowHostDelegate()->OnHostKeyEvent(
- event.get());
+ string16 text;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &text));
- return true;
+ return keyboard::InsertText(text, ash::Shell::GetPrimaryRootWindow());
#endif
error_ = kNotYetImplementedError;
return false;
@@ -48,7 +41,7 @@ bool SendKeyboardEventInputFunction::RunImpl() {
InputAPI::InputAPI(Profile* profile) {
ExtensionFunctionRegistry* registry =
ExtensionFunctionRegistry::GetInstance();
- registry->RegisterFunction<SendKeyboardEventInputFunction>();
+ registry->RegisterFunction<InsertTextInputFunction>();
}
InputAPI::~InputAPI() {
« no previous file with comments | « chrome/browser/extensions/api/input/input.h ('k') | chrome/browser/extensions/api/input/input_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698