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

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

Issue 20145004: Switch from text insertion to key press and release events on the virtual k… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting. Created 7 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
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 b4d264fcbec26bc28dc068196428d7b505126d8a..c4f93d54732a725023b63070ec4a6da16eda1c1a 100644
--- a/chrome/browser/extensions/api/input/input.cc
+++ b/chrome/browser/extensions/api/input/input.cc
@@ -1,11 +1,10 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 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/extensions/api/input/input.h"
#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"
@@ -38,10 +37,29 @@ bool InsertTextInputFunction::RunImpl() {
return false;
}
+bool DispatchKeyEventFunction::RunImpl() {
+#if defined(USE_ASH)
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
+ // Extract type and charcter code
+ std::string typeStr;
+ int charCode;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &typeStr));
+ EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &charCode));
+
+ return keyboard::DispatchKeyEvent(typeStr,
+ charCode,
+ ash::Shell::GetPrimaryRootWindow());
+#endif
+ error_ = kNotYetImplementedError;
+ return false;
+}
+
InputAPI::InputAPI(Profile* profile) {
ExtensionFunctionRegistry* registry =
ExtensionFunctionRegistry::GetInstance();
registry->RegisterFunction<InsertTextInputFunction>();
+ registry->RegisterFunction<DispatchKeyEventFunction>();
}
InputAPI::~InputAPI() {

Powered by Google App Engine
This is Rietveld 408576698