summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 04:43:13 +0000
committerbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 04:43:13 +0000
commit858e344a47d5b8bb4b91841585d6e027e95acb42 (patch)
tree890cce63f8f53bf2a63dab32ecab241b68fe379a
parent96ac19b2ca3cb54a28bd3da112851cee64fa9e4e (diff)
downloadchromium_src-858e344a47d5b8bb4b91841585d6e027e95acb42.zip
chromium_src-858e344a47d5b8bb4b91841585d6e027e95acb42.tar.gz
chromium_src-858e344a47d5b8bb4b91841585d6e027e95acb42.tar.bz2
[Code cleanup]Remove webui virtual keyboard code
BUG=354657 Review URL: https://codereview.chromium.org/208633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259486 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc4
-rw-r--r--chrome/common/extensions/manifest_url_handler.cc2
-rw-r--r--ui/keyboard/keyboard.cc60
-rw-r--r--ui/keyboard/keyboard.gyp4
-rw-r--r--ui/keyboard/keyboard.h5
-rw-r--r--ui/keyboard/keyboard_constants.cc4
-rw-r--r--ui/keyboard/keyboard_constants.h8
-rw-r--r--ui/keyboard/keyboard_controller_proxy.cc46
-rw-r--r--ui/keyboard/keyboard_controller_proxy.h4
-rw-r--r--ui/keyboard/keyboard_resources.grd5
-rw-r--r--ui/keyboard/keyboard_ui_controller.cc110
-rw-r--r--ui/keyboard/keyboard_ui_controller.h29
-rw-r--r--ui/keyboard/keyboard_ui_handler.cc142
-rw-r--r--ui/keyboard/keyboard_ui_handler.h45
-rw-r--r--ui/keyboard/resources/layouts/webui_qwerty.html122
-rw-r--r--ui/keyboard/resources/webui/api_adapter.js89
-rw-r--r--ui/keyboard/resources/webui/constants.js26
-rw-r--r--ui/keyboard/resources/webui/main.css172
-rw-r--r--ui/keyboard/resources/webui_index.html45
19 files changed, 11 insertions, 911 deletions
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 6328745..abf539f 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -127,8 +127,6 @@
#if defined(USE_AURA)
#include "chrome/browser/ui/webui/gesture_config_ui.h"
-#include "ui/keyboard/keyboard_constants.h"
-#include "ui/keyboard/keyboard_ui_controller.h"
#endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
@@ -459,8 +457,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
#if defined(USE_AURA)
if (url.host() == chrome::kChromeUIGestureConfigHost)
return &NewWebUI<GestureConfigUI>;
- if (url.host() == keyboard::kKeyboardWebUIHost)
- return &NewWebUI<keyboard::KeyboardUIController>;
#endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc
index 08bed8b02c..557c1c2 100644
--- a/chrome/common/extensions/manifest_url_handler.cc
+++ b/chrome/common/extensions/manifest_url_handler.cc
@@ -292,7 +292,7 @@ bool URLOverridesHandler::Parse(Extension* extension, base::string16* error) {
page != chrome::kChromeUIActivationMessageHost);
#endif
#if defined(OS_CHROMEOS)
- is_override = (is_override && page != keyboard::kKeyboardWebUIHost);
+ is_override = (is_override && page != keyboard::kKeyboardHost);
#endif
if (is_override || !iter.value().GetAsString(&val)) {
diff --git a/ui/keyboard/keyboard.cc b/ui/keyboard/keyboard.cc
index d790127..436b935 100644
--- a/ui/keyboard/keyboard.cc
+++ b/ui/keyboard/keyboard.cc
@@ -5,71 +5,14 @@
#include "ui/keyboard/keyboard.h"
#include "base/files/file_path.h"
-#include "base/memory/singleton.h"
#include "base/path_service.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/web_ui_controller_factory.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/keyboard/keyboard_constants.h"
-#include "ui/keyboard/keyboard_ui_controller.h"
-#include "url/gurl.h"
-
-namespace {
-
-using content::BrowserContext;
-using content::WebUI;
-using content::WebUIController;
-
-class KeyboardWebUIControllerFactory : public content::WebUIControllerFactory {
- public:
- // |WebUIControllerFactory| implementation:
- virtual content::WebUI::TypeID GetWebUIType(
- content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE {
- if (url == GURL(keyboard::kKeyboardWebUIURL))
- return const_cast<KeyboardWebUIControllerFactory*>(this);
-
- return WebUI::kNoWebUI;
- }
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE {
- return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
- }
- virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE {
- return UseWebUIForURL(browser_context, url);
- }
- virtual content::WebUIController* CreateWebUIControllerForURL(
- content::WebUI* web_ui,
- const GURL& url) const OVERRIDE {
- if (url == GURL(keyboard::kKeyboardWebUIURL))
- return new keyboard::KeyboardUIController(web_ui);
- return NULL;
- }
-
- static KeyboardWebUIControllerFactory* GetInstance() {
- return Singleton<KeyboardWebUIControllerFactory>::get();
- }
-
- protected:
- KeyboardWebUIControllerFactory() {}
- virtual ~KeyboardWebUIControllerFactory() {}
-
- private:
- friend struct DefaultSingletonTraits<KeyboardWebUIControllerFactory>;
-
- DISALLOW_COPY_AND_ASSIGN(KeyboardWebUIControllerFactory);
-};
-
-} // namespace
namespace keyboard {
static bool initialized = false;
void ResetKeyboardForTesting() {
- content::WebUIControllerFactory::UnregisterFactoryForTesting(
- KeyboardWebUIControllerFactory::GetInstance());
initialized = false;
}
@@ -84,9 +27,6 @@ void InitializeKeyboard() {
FILE_PATH_LITERAL("keyboard_resources.pak"));
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
pak_file, ui::SCALE_FACTOR_100P);
-
- content::WebUIControllerFactory::RegisterFactory(
- KeyboardWebUIControllerFactory::GetInstance());
}
} // namespace keyboard
diff --git a/ui/keyboard/keyboard.gyp b/ui/keyboard/keyboard.gyp
index 27ea38e..fe359c6 100644
--- a/ui/keyboard/keyboard.gyp
+++ b/ui/keyboard/keyboard.gyp
@@ -69,10 +69,6 @@
'keyboard_export.h',
'keyboard_switches.cc',
'keyboard_switches.h',
- 'keyboard_ui_controller.cc',
- 'keyboard_ui_controller.h',
- 'keyboard_ui_handler.cc',
- 'keyboard_ui_handler.h',
'keyboard_util.cc',
'keyboard_util.h',
]
diff --git a/ui/keyboard/keyboard.h b/ui/keyboard/keyboard.h
index c47cf8c..a0aed8a 100644
--- a/ui/keyboard/keyboard.h
+++ b/ui/keyboard/keyboard.h
@@ -10,9 +10,8 @@
namespace keyboard {
// Initializes the keyboard module. This includes adding the necessary pak files
-// for loading resources used in for the virtual keyboard, and registers
-// a WebUIControllerFactory for creating a WebUIController necessary for the
-// virtual keyboard. This becomes a no-op after the first call.
+// for loading resources used in for the virtual keyboard. This becomes a no-op
+// after the first call.
KEYBOARD_EXPORT void InitializeKeyboard();
// Resets the keyboard to an uninitialized state. Required for
diff --git a/ui/keyboard/keyboard_constants.cc b/ui/keyboard/keyboard_constants.cc
index 35f8130..b13a604 100644
--- a/ui/keyboard/keyboard_constants.cc
+++ b/ui/keyboard/keyboard_constants.cc
@@ -6,7 +6,7 @@
namespace keyboard {
-const char kKeyboardWebUIURL[] = "chrome://keyboard";
-const char kKeyboardWebUIHost[] = "keyboard";
+const char kKeyboardURL[] = "chrome://keyboard";
+const char kKeyboardHost[] = "keyboard";
} // namespace keyboard
diff --git a/ui/keyboard/keyboard_constants.h b/ui/keyboard/keyboard_constants.h
index eff96ea..75607c1 100644
--- a/ui/keyboard/keyboard_constants.h
+++ b/ui/keyboard/keyboard_constants.h
@@ -9,11 +9,11 @@
namespace keyboard {
-// The URL of the keyboard WebUI.
-KEYBOARD_EXPORT extern const char kKeyboardWebUIURL[];
+// The URL of the keyboard extension.
+KEYBOARD_EXPORT extern const char kKeyboardURL[];
-// The host of the keyboard WebUI URL.
-KEYBOARD_EXPORT extern const char kKeyboardWebUIHost[];
+// The host of the keyboard extension URL.
+KEYBOARD_EXPORT extern const char kKeyboardHost[];
} // namespace keyboard
diff --git a/ui/keyboard/keyboard_controller_proxy.cc b/ui/keyboard/keyboard_controller_proxy.cc
index b17c6b7..acd78f8 100644
--- a/ui/keyboard/keyboard_controller_proxy.cc
+++ b/ui/keyboard/keyboard_controller_proxy.cc
@@ -22,39 +22,6 @@
namespace {
-// Converts ui::TextInputType to string.
-std::string TextInputTypeToString(ui::TextInputType type) {
- switch (type) {
- case ui::TEXT_INPUT_TYPE_NONE:
- return "none";
- case ui::TEXT_INPUT_TYPE_PASSWORD:
- return "password";
- case ui::TEXT_INPUT_TYPE_EMAIL:
- return "email";
- case ui::TEXT_INPUT_TYPE_NUMBER:
- return "number";
- case ui::TEXT_INPUT_TYPE_TELEPHONE:
- return "tel";
- case ui::TEXT_INPUT_TYPE_URL:
- return "url";
- case ui::TEXT_INPUT_TYPE_DATE:
- return "date";
- case ui::TEXT_INPUT_TYPE_TEXT:
- case ui::TEXT_INPUT_TYPE_SEARCH:
- case ui::TEXT_INPUT_TYPE_DATE_TIME:
- case ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL:
- case ui::TEXT_INPUT_TYPE_MONTH:
- case ui::TEXT_INPUT_TYPE_TIME:
- case ui::TEXT_INPUT_TYPE_WEEK:
- case ui::TEXT_INPUT_TYPE_TEXT_AREA:
- case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE:
- case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD:
- return "text";
- }
- NOTREACHED();
- return "";
-}
-
// The WebContentsDelegate for the keyboard.
// The delegate deletes itself when the keyboard is destroyed.
class KeyboardContentsDelegate : public content::WebContentsDelegate,
@@ -114,7 +81,7 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
namespace keyboard {
KeyboardControllerProxy::KeyboardControllerProxy()
- : default_url_(kKeyboardWebUIURL), resizing_from_contents_(false) {
+ : default_url_(kKeyboardURL), resizing_from_contents_(false) {
}
KeyboardControllerProxy::~KeyboardControllerProxy() {
@@ -171,17 +138,6 @@ void KeyboardControllerProxy::HideKeyboardContainer(aura::Window* container) {
}
void KeyboardControllerProxy::SetUpdateInputType(ui::TextInputType type) {
- content::WebUI* webui = keyboard_contents_ ?
- keyboard_contents_->GetCommittedWebUI() : NULL;
-
- if (webui &&
- (0 != (webui->GetBindings() & content::BINDINGS_POLICY_WEB_UI))) {
- // Only call OnTextInputBoxFocused function if it is a web ui keyboard,
- // not an extension based keyboard.
- base::DictionaryValue input_context;
- input_context.SetString("type", TextInputTypeToString(type));
- webui->CallJavascriptFunction("OnTextInputBoxFocused", input_context);
- }
}
void KeyboardControllerProxy::EnsureCaretInWorkArea() {
diff --git a/ui/keyboard/keyboard_controller_proxy.h b/ui/keyboard/keyboard_controller_proxy.h
index 35af78c..8f48c0c 100644
--- a/ui/keyboard/keyboard_controller_proxy.h
+++ b/ui/keyboard/keyboard_controller_proxy.h
@@ -70,9 +70,7 @@ class KEYBOARD_EXPORT KeyboardControllerProxy {
// necesasry animation, or delay the visibility change as it desires.
virtual void HideKeyboardContainer(aura::Window* container);
- // Updates the type of the focused text input box. The default implementation
- // calls OnTextInputBoxFocused javascript function through webui to update the
- // type the of focused input box.
+ // Updates the type of the focused text input box.
virtual void SetUpdateInputType(ui::TextInputType type);
// Ensures caret in current work area (not occluded by virtual keyboard
diff --git a/ui/keyboard/keyboard_resources.grd b/ui/keyboard/keyboard_resources.grd
index 7a76aef..9aec103 100644
--- a/ui/keyboard/keyboard_resources.grd
+++ b/ui/keyboard/keyboard_resources.grd
@@ -55,11 +55,6 @@
<include name="IDR_KEYBOARD_SOUNDS_KEYPRESS_SPACEBAR" file="resources/sounds/keypress-spacebar.wav" type="BINDATA" />
<include name="IDR_KEYBOARD_SOUNDS_KEYPRESS_STANDARD" file="resources/sounds/keypress-standard.wav" type="BINDATA" />
<include name="IDR_KEYBOARD_SPACEBAR_ROW" file="resources/layouts/spacebar-row.html" type="BINDATA" />
- <include name="IDR_KEYBOARD_WEBUI_INDEX" file="resources/webui_index.html" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_KEYBOARD_WEBUI_API_ADAPTER_JS" file="resources/webui/api_adapter.js" type="BINDATA" />
- <include name="IDR_KEYBOARD_WEBUI_CONSTANTS_JS" file="resources/webui/constants.js" type="BINDATA" />
- <include name="IDR_KEYBOARD_WEBUI_MAIN_CSS" file="resources/webui/main.css" type="BINDATA" />
- <include name="IDR_KEYBOARD_WEBUI_QWERTY" file="resources/layouts/webui_qwerty.html" type="BINDATA" />
</includes>
</release>
</grit>
diff --git a/ui/keyboard/keyboard_ui_controller.cc b/ui/keyboard/keyboard_ui_controller.cc
deleted file mode 100644
index a8af676..0000000
--- a/ui/keyboard/keyboard_ui_controller.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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 "ui/keyboard/keyboard_ui_controller.h"
-
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "grit/keyboard_resources.h"
-#include "ui/keyboard/keyboard_constants.h"
-#include "ui/keyboard/keyboard_ui_handler.h"
-
-namespace {
-
-content::WebUIDataSource* CreateKeyboardUIDataSource() {
- content::WebUIDataSource* source =
- content::WebUIDataSource::Create(keyboard::kKeyboardWebUIHost);
-
- source->SetDefaultResource(IDR_KEYBOARD_WEBUI_INDEX);
- source->AddResourcePath("images/back.svg",
- IDR_KEYBOARD_IMAGES_BACK);
- source->AddResourcePath("images/backspace.svg",
- IDR_KEYBOARD_IMAGES_BACKSPACE);
- source->AddResourcePath("images/brightness-down.svg",
- IDR_KEYBOARD_IMAGES_BRIGHTNESS_DOWN);
- source->AddResourcePath("images/brightness-up.svg",
- IDR_KEYBOARD_IMAGES_BRIGHTNESS_UP);
- source->AddResourcePath("images/change-window.svg",
- IDR_KEYBOARD_IMAGES_CHANGE_WINDOW);
- source->AddResourcePath("images/down.svg",
- IDR_KEYBOARD_IMAGES_DOWN);
- source->AddResourcePath("images/forward.svg",
- IDR_KEYBOARD_IMAGES_FORWARD);
- source->AddResourcePath("images/fullscreen.svg",
- IDR_KEYBOARD_IMAGES_FULLSCREEN);
- source->AddResourcePath("images/hide-keyboard.svg",
- IDR_KEYBOARD_IMAGES_HIDE_KEYBOARD);
- source->AddResourcePath("images/left.svg",
- IDR_KEYBOARD_IMAGES_LEFT);
- source->AddResourcePath("images/microphone.svg",
- IDR_KEYBOARD_IMAGES_MICROPHONE);
- source->AddResourcePath("images/microphone-green.svg",
- IDR_KEYBOARD_IMAGES_MICROPHONE_GREEN);
- source->AddResourcePath("images/mute.svg",
- IDR_KEYBOARD_IMAGES_MUTE);
- source->AddResourcePath("images/reload.svg",
- IDR_KEYBOARD_IMAGES_RELOAD);
- source->AddResourcePath("images/return.svg",
- IDR_KEYBOARD_IMAGES_RETURN);
- source->AddResourcePath("images/right.svg",
- IDR_KEYBOARD_IMAGES_RIGHT);
- source->AddResourcePath("images/search.svg",
- IDR_KEYBOARD_IMAGES_SEARCH);
- source->AddResourcePath("images/shift.svg",
- IDR_KEYBOARD_IMAGES_SHIFT);
- source->AddResourcePath("images/shift-filled.svg",
- IDR_KEYBOARD_IMAGES_SHIFT_FILLED);
- source->AddResourcePath("images/shutdown.svg",
- IDR_KEYBOARD_IMAGES_SHUTDOWN);
- source->AddResourcePath("images/tab.svg",
- IDR_KEYBOARD_IMAGES_TAB);
- source->AddResourcePath("images/up.svg",
- IDR_KEYBOARD_IMAGES_UP);
- source->AddResourcePath("images/volume-down.svg",
- IDR_KEYBOARD_IMAGES_VOLUME_DOWN);
- source->AddResourcePath("images/volume-up.svg",
- IDR_KEYBOARD_IMAGES_VOLUME_UP);
- source->AddResourcePath("keyboard.js", IDR_KEYBOARD_JS);
- source->AddResourcePath("layouts/numeric.html", IDR_KEYBOARD_LAYOUTS_NUMERIC);
- source->AddResourcePath("layouts/system-qwerty.html",
- IDR_KEYBOARD_LAYOUTS_SYSTEM_QWERTY);
- source->AddResourcePath("polymer_loader.js", IDR_KEYBOARD_POLYMER_LOADER);
- source->AddResourcePath("roboto_bold.ttf", IDR_KEYBOARD_ROBOTO_BOLD_TTF);
- source->AddResourcePath("sounds/keypress-delete.wav",
- IDR_KEYBOARD_SOUNDS_KEYPRESS_DELETE);
- source->AddResourcePath("sounds/keypress-return.wav",
- IDR_KEYBOARD_SOUNDS_KEYPRESS_RETURN);
- source->AddResourcePath("sounds/keypress-spacebar.wav",
- IDR_KEYBOARD_SOUNDS_KEYPRESS_SPACEBAR);
- source->AddResourcePath("sounds/keypress-standard.wav",
- IDR_KEYBOARD_SOUNDS_KEYPRESS_STANDARD);
-
- // These files are specific to the WebUI version
- source->AddResourcePath("api_adapter.js", IDR_KEYBOARD_WEBUI_API_ADAPTER_JS);
- source->AddResourcePath("constants.js", IDR_KEYBOARD_WEBUI_CONSTANTS_JS);
- source->AddResourcePath("layouts/qwerty.html", IDR_KEYBOARD_WEBUI_QWERTY);
- source->AddResourcePath("main.css", IDR_KEYBOARD_WEBUI_MAIN_CSS);
-
- return source;
-}
-
-} // namespace
-
-namespace keyboard {
-
-KeyboardUIController::KeyboardUIController(content::WebUI* web_ui)
- : WebUIController(web_ui) {
- content::BrowserContext* browser_context =
- web_ui->GetWebContents()->GetBrowserContext();
- web_ui->AddMessageHandler(new KeyboardUIHandler());
- content::WebUIDataSource::Add(
- browser_context,
- CreateKeyboardUIDataSource());
-}
-
-KeyboardUIController::~KeyboardUIController() {}
-
-} // namespace keyboard
diff --git a/ui/keyboard/keyboard_ui_controller.h b/ui/keyboard/keyboard_ui_controller.h
deleted file mode 100644
index b06ec26..0000000
--- a/ui/keyboard/keyboard_ui_controller.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-#ifndef UI_KEYBOARD_KEYBOARD_UI_CONTROLLER_H_
-#define UI_KEYBOARD_KEYBOARD_UI_CONTROLLER_H_
-
-#include "content/public/browser/web_ui_controller.h"
-#include "ui/keyboard/keyboard_export.h"
-
-namespace content {
-class WebUI;
-};
-
-namespace keyboard {
-
-// WebUIController for chrome://keyboard/.
-class KEYBOARD_EXPORT KeyboardUIController : public content::WebUIController {
- public:
- explicit KeyboardUIController(content::WebUI* web_ui);
- virtual ~KeyboardUIController();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(KeyboardUIController);
-};
-
-} // namespace keyboard
-
-#endif // UI_KEYBOARD_KEYBOARD_UI_CONTROLLER_H_
diff --git a/ui/keyboard/keyboard_ui_handler.cc b/ui/keyboard/keyboard_ui_handler.cc
deleted file mode 100644
index 88f4751..0000000
--- a/ui/keyboard/keyboard_ui_handler.cc
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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 "ui/keyboard/keyboard_ui_handler.h"
-
-#include <string>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/values.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_view.h"
-#include "content/public/browser/web_ui.h"
-#include "ui/aura/client/aura_constants.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_tree_host.h"
-#include "ui/base/ime/input_method.h"
-#include "ui/base/ime/text_input_client.h"
-#include "ui/keyboard/keyboard_controller.h"
-#include "ui/keyboard/keyboard_util.h"
-
-namespace keyboard {
-
-KeyboardUIHandler::KeyboardUIHandler() {
-}
-
-KeyboardUIHandler::~KeyboardUIHandler() {
-}
-
-void KeyboardUIHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "insertText",
- base::Bind(&KeyboardUIHandler::HandleInsertTextMessage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "getInputContext",
- base::Bind(&KeyboardUIHandler::HandleGetInputContextMessage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "sendKeyEvent",
- base::Bind(&KeyboardUIHandler::HandleSendKeyEventMessage,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback(
- "hideKeyboard",
- base::Bind(&KeyboardUIHandler::HandleHideKeyboard,
- base::Unretained(this)));
-}
-
-void KeyboardUIHandler::HandleInsertTextMessage(const base::ListValue* args) {
- base::string16 text;
- if (!args->GetString(0, &text)) {
- LOG(ERROR) << "insertText failed: bad argument";
- return;
- }
-
- aura::Window* root_window =
- web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow();
- if (!root_window) {
- LOG(ERROR) << "insertText failed: no root window";
- return;
- }
-
- if (!keyboard::InsertText(text, root_window))
- LOG(ERROR) << "insertText failed";
-}
-
-void KeyboardUIHandler::HandleGetInputContextMessage(
- const base::ListValue* args) {
- int request_id;
- if (!args->GetInteger(0, &request_id)) {
- LOG(ERROR) << "getInputContext failed: bad argument";
- return;
- }
- base::DictionaryValue results;
- results.SetInteger("requestId", request_id);
-
- aura::Window* root_window =
- web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow();
- if (!root_window) {
- LOG(ERROR) << "getInputContext failed: no root window";
- return;
- }
- ui::InputMethod* input_method =
- root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
- if (!input_method) {
- LOG(ERROR) << "getInputContext failed: no input method";
- return;
- }
-
- ui::TextInputClient* tic = input_method->GetTextInputClient();
- results.SetInteger("type",
- tic ? tic->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE);
-
- web_ui()->CallJavascriptFunction("GetInputContextCallback",
- results);
-}
-
-void KeyboardUIHandler::HandleSendKeyEventMessage(
- const base::ListValue* args) {
- const base::DictionaryValue* params = NULL;
- std::string type;
- int char_value;
- int key_code;
- std::string key_name;
- int modifiers;
-
- if (!args->GetDictionary(0, &params) ||
- !params->GetString("type", &type) ||
- !params->GetInteger("charValue", &char_value) ||
- !params->GetInteger("keyCode", &key_code) ||
- !params->GetString("keyName", &key_name) ||
- !params->GetInteger("modifiers", &modifiers)) {
- LOG(ERROR) << "SendKeyEvent failed: bad argument";
- return;
- }
-
- aura::WindowTreeHost* host =
- web_ui()->GetWebContents()->GetView()->GetNativeView()->GetHost();
- if (!host) {
- LOG(ERROR) << "sendKeyEvent failed: no dispatcher";
- return;
- }
-
- if (!keyboard::SendKeyEvent(type,
- char_value,
- key_code,
- key_name,
- modifiers,
- host)) {
- LOG(ERROR) << "sendKeyEvent failed";
- }
-}
-
-void KeyboardUIHandler::HandleHideKeyboard(const base::ListValue* args) {
- // TODO(stevet): Call into the keyboard controller to hide the keyboard
- // directly.
- NOTIMPLEMENTED();
- return;
-}
-
-} // namespace keyboard
diff --git a/ui/keyboard/keyboard_ui_handler.h b/ui/keyboard/keyboard_ui_handler.h
deleted file mode 100644
index 3c14f74..0000000
--- a/ui/keyboard/keyboard_ui_handler.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-#ifndef UI_KEYBOARD_KEYBOARD_UI_HANDLER_H_
-#define UI_KEYBOARD_KEYBOARD_UI_HANDLER_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "content/public/browser/web_ui_message_handler.h"
-
-namespace keyboard {
-
-// The WebUI handler for chrome://keyboard. Inserts text into the currently
-// focused TextInputClient.
-class KeyboardUIHandler : public content::WebUIMessageHandler {
- public:
- KeyboardUIHandler();
- virtual ~KeyboardUIHandler();
-
- private:
- // |content::WebUIMessageHandler| implementation:
- virtual void RegisterMessages() OVERRIDE;
-
- // Callback for the "insertText" message.
- void HandleInsertTextMessage(const base::ListValue* args);
-
- // Callback for the "getInputContext" message. The first element in
- // |args| should be an integer representing request ID.
- void HandleGetInputContextMessage(const base::ListValue* args);
-
- // Callback for the "sendKeyEvent" message. The first element in |args| is a
- // dictionary containing an event type, the character being pressed or
- // released, a virtual key code, and the state of the shift key.
- void HandleSendKeyEventMessage(const base::ListValue* args);
-
- // Callback for the "hideKeyboard" message.
- void HandleHideKeyboard(const base::ListValue* args);
-
- DISALLOW_COPY_AND_ASSIGN(KeyboardUIHandler);
-};
-
-} // namespace keyboard
-
-#endif // UI_KEYBOARD_KEYBOARD_UI_HANDLER_H_
diff --git a/ui/keyboard/resources/layouts/webui_qwerty.html b/ui/keyboard/resources/layouts/webui_qwerty.html
deleted file mode 100644
index 2763307..0000000
--- a/ui/keyboard/resources/layouts/webui_qwerty.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!--
- -- Copyright 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.
- -->
-
-<template>
- <kb-keyset id="qwerty-upper">
- <kb-row class="top">
- <kb-key>Q</kb-key><kb-key>W</kb-key><kb-key>E</kb-key><kb-key>R</kb-key>
- <kb-key>T</kb-key><kb-key>Y</kb-key><kb-key>U</kb-key>
- <kb-key>I</kb-key><kb-key>O</kb-key><kb-key>P</kb-key>
- </kb-row>
- <kb-row>
- <div class="half-key-spacer"></div>
- <kb-key>A</kb-key><kb-key>S</kb-key><kb-key>D</kb-key><kb-key>F</kb-key>
- <kb-key>G</kb-key><kb-key>H</kb-key><kb-key>J</kb-key><kb-key>K</kb-key>
- <kb-key>L</kb-key>
- <div class="half-key-spacer"></div>
- </kb-row>
- <kb-row>
- <kb-shift-key class="padded-left-special" weight="1.4">shift</kb-shift-key>
- <kb-key>Z</kb-key><kb-key>X</kb-key><kb-key>C</kb-key><kb-key>V</kb-key>
- <kb-key>B</kb-key><kb-key>N</kb-key><kb-key>M</kb-key>
- <kb-key class="backspace padded-right-special dark" char="&#x0008;" repeat>delete</kb-key>
- </kb-row>
- <kb-row>
- <kb-key class="symbol dark" toKeyset="down:symbol" char="Invalid">?123</kb-key>
- <kb-key class="microphone dark" char="Microphone"></kb-key>
- <kb-key class="dark">,</kb-key>
- <kb-key class="space dark" char=" "></kb-key>
- <kb-key class="dark">.</kb-key>
- <kb-key class="return dark" char="&#000A;">enter</kb-key>
- </kb-row>
- <kb-altkey-container hidden>
- </kb-altkey-container>
- </kb-keyset>
-
- <kb-keyset id="qwerty-lower" isDefault=true>
- <kb-row class="top">
- <kb-key>q</kb-key><kb-key>w</kb-key><kb-key>e</kb-key><kb-key>r</kb-key>
- <kb-key>t</kb-key><kb-key>y</kb-key><kb-key>u</kb-key>
- <kb-key>i</kb-key><kb-key>o</kb-key><kb-key>p</kb-key>
- </kb-row>
- <kb-row>
- <div class="half-key-spacer"></div>
- <kb-key>a</kb-key><kb-key>s</kb-key><kb-key>d</kb-key><kb-key>f</kb-key>
- <kb-key>g</kb-key><kb-key>h</kb-key><kb-key>j</kb-key><kb-key>k</kb-key>
- <kb-key>l</kb-key>
- <div class="half-key-spacer"></div>
- </kb-row>
- <kb-row>
- <kb-shift-key class="padded-left-special" weight="1.4">shift</kb-shift-key>
- <kb-key>z</kb-key><kb-key>x</kb-key><kb-key>c</kb-key><kb-key>v</kb-key>
- <kb-key>b</kb-key><kb-key>n</kb-key><kb-key>m</kb-key>
- <kb-key class="backspace padded-right-special dark" char="&#x0008;" repeat>delete</kb-key>
- </kb-row>
- <kb-row>
- <kb-key class="symbol dark" toKeyset="down:symbol" char="Invalid">?123</kb-key>
- <kb-key class="microphone dark" char="Microphone"></kb-key>
- <kb-key class="dark">,</kb-key>
- <kb-key class="space dark" char=" "></kb-key>
- <kb-key class="dark">.</kb-key>
- <kb-key class='return dark' char="&#x000A;">enter</kb-key>
- </kb-row>
- <kb-altkey-container hidden>
- </kb-altkey-container>
- </kb-keyset>
-
- <kb-keyset id="qwerty-symbol">
- <kb-row class="top">
- <kb-key>1</kb-key><kb-key>2</kb-key><kb-key>3</kb-key><kb-key>4</kb-key>
- <kb-key>5</kb-key><kb-key>6</kb-key><kb-key>7</kb-key><kb-key>8</kb-key>
- <kb-key>9</kb-key><kb-key>0</kb-key>
- </kb-row>
- <kb-row>
- <kb-key>@</kb-key><kb-key>$</kb-key><kb-key>&</kb-key><kb-key>:</kb-key><kb-key>;</kb-key>
- <kb-key>/</kb-key><kb-key>(</kb-key><kb-key>)</kb-key>
- </kb-row>
- <kb-row>
- <kb-key class="left-more padded-left-special dark" toKeyset="down:more" char="Invalid">more</kb-key>
- <kb-key>"</kb-key><kb-key>'</kb-key><kb-key>-</kb-key>
- <kb-key>+</kb-key><kb-key>!</kb-key><kb-key>?</kb-key>
- <kb-key class="backspace padded-right-special dark" char="&#x0008;" repeat>delete</kb-key>
- </kb-row>
- <kb-row>
- <kb-abc-key>abc</kb-abc-key>
- <kb-key class="microphone dark" char="Microphone"></kb-key>
- <kb-key class="dark">,</kb-key>
- <kb-key class="space dark" char=" "></kb-key>
- <kb-key class="dark">.</kb-key>
- <kb-key class='return dark' char="&#x000A;">enter</kb-key>
- </kb-row>
- </kb-keyset>
-
- <kb-keyset id="qwerty-more">
- <kb-row class="top">
- <kb-key>&#x20AC;</kb-key><kb-key>&#x00A3;</kb-key><kb-key>&#x00A2;</kb-key>
- <kb-key>&#x2022;</kb-key><kb-key>&#x00B6;</kb-key><kb-key>|</kb-key>
- <kb-key>{</kb-key><kb-key>}</kb-key>
- </kb-row>
- <kb-row>
- <kb-key class="tab padded-left-special dark" char="&#x0009;">tab</kb-key>
- <kb-key>#</kb-key><kb-key>%</kb-key><kb-key>^</kb-key><kb-key>*</kb-key>
- <kb-key>\</kb-key><kb-key>&#x003C;</kb-key><kb-key>&#x003E;</kb-key>
- </kb-row>
- <kb-row>
- <kb-key class="left-more padded-left-special dark" toKeyset="down:symbol" char="Invalid">?123</kb-key>
- <kb-key>`</kb-key><kb-key>~</kb-key><kb-key>_</kb-key><kb-key>=</kb-key>
- <kb-key>[</kb-key><kb-key>]</kb-key>
- <kb-key class="backspace padded-right-special dark" char="&#x0008;" repeat>delete</kb-key>
- </kb-row>
- <kb-row>
- <kb-abc-key>abc</kb-abc-key>
- <kb-key class="microphone dark" char="Microphone"></kb-key>
- <kb-key class="dark">,</kb-key>
- <kb-key class="space dark" char=" "></kb-key>
- <kb-key class="dark">.</kb-key>
- <kb-key class='return dark' char="&#x000A;">enter</kb-key>
- </kb-row>
- </kb-keyset>
-</template>
diff --git a/ui/keyboard/resources/webui/api_adapter.js b/ui/keyboard/resources/webui/api_adapter.js
deleted file mode 100644
index 206f60d..0000000
--- a/ui/keyboard/resources/webui/api_adapter.js
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.
-
-function insertText(text) {
- chrome.send('insertText', [ text ]);
-}
-
-function sendKeyEvent(event) {
- chrome.send('sendKeyEvent', [ event ]);
-}
-
-function hideKeyboard() {
- chrome.send('hideKeyboard');
-}
-
-function keyboardLoaded() {
- chrome.send('keyboardLoaded');
-}
-
-(function(exports) {
- /**
- * An array to save callbacks of each request.
- * @type {Array.<function(Object)>}
- */
- var requestIdCallbackMap = [];
-
- /**
- * An incremental integer that represents a unique requestId.
- * @type {number}
- */
- var requestId = 0;
-
- /**
- * Called when a text input box gets focus.
- * @param {object} inputContext Describes an input context. It only contains
- * the type of text input box at present and only "password", "number" and
- * "text" are supported.
- */
- function OnTextInputBoxFocused(inputContext) {
- // Do not want to use the system keyboard for passwords in webui.
- if (inputContext.type == 'password')
- inputContext.type = 'text';
- keyboard.inputTypeValue = inputContext.type;
- }
-
- /**
- * Gets the context of the focused input field. The context is returned as a
- * paramter in the |callback|.
- * @param {function(Object)} callback The callback function after the webui
- * function finished.
- * @return {number} The ID of the new request.
- */
- function GetInputContext(callback) {
- var id = requestId;
- requestIdCallbackMap[id] = callback;
- chrome.send('getInputContext', [ id ]);
- requestId++;
- return id;
- }
-
- /**
- * Cancel the callback specified by requestId.
- * @param {number} requestId The requestId of the callback that about to
- * cancel.
- */
- function CancelRequest(requestId) {
- requestIdCallbackMap[requestId] = undefined;
- }
-
- /**
- * Webui function callback. Any call to chrome.send('getInputContext', [id])
- * should trigger this function being called with the parameter
- * inputContext.requestId == id.
- * @param {Object} inputContext The context of focused input field. Note we
- * only have type(input box type) and requestId fields now.
- */
- function GetInputContextCallback(inputContext) {
- var requestId = inputContext.requestId;
- if (!requestIdCallbackMap[requestId])
- return;
- requestIdCallbackMap[requestId](inputContext);
- }
-
- exports.OnTextInputBoxFocused = OnTextInputBoxFocused;
- exports.getInputContext = GetInputContext;
- exports.cancelRequest = CancelRequest;
- exports.GetInputContextCallback = GetInputContextCallback;
-})(this);
diff --git a/ui/keyboard/resources/webui/constants.js b/ui/keyboard/resources/webui/constants.js
deleted file mode 100644
index 94ccfb2..0000000
--- a/ui/keyboard/resources/webui/constants.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 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.
-
-
-/**
- * Aspect ratio of keyboard.
- * @type {number}
- */
-var ASPECT_RATIO = 2.0;
-
-/**
- * Ratio of key height and font size.
- * @type {number}
- */
-var FONT_SIZE_RATIO = 2;
-
-/**
- * The number of rows in each keyset.
- * @type {number}
- */
-// TODO(bshe): The number of rows should equal to the number of kb-row elements
-// in kb-keyset. Remove this variable once figure out how to calculate the
-// number from keysets.
-
-var ROW_LENGTH = 4;
diff --git a/ui/keyboard/resources/webui/main.css b/ui/keyboard/resources/webui/main.css
deleted file mode 100644
index e14611d3..0000000
--- a/ui/keyboard/resources/webui/main.css
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- 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.
-*/
-
-body {
- -webkit-box-pack: center;
- -webkit-user-select: none;
- background-color: #0b0b0b;
- display: -webkit-box;
- margin: 0;
- overflow: hidden;
- padding: 0;
-}
-
-kb-keyboard {
- -webkit-box-orient: vertical;
- display: -webkit-box;
-}
-
-kb-abc-key,
-kb-shift-key,
-kb-key {
- background-color: #3b3b3e;
- background-position: center center;
- background-repeat: no-repeat;
- background-size: contain;
- border-top: 2px solid #4b4b4e;
- border-radius: 1px;
- color: #ffffff;
- display: -webkit-box;
- font-family: 'Open Sans', sans-serif;
- font-weight: 600;
- margin-left: 0.2em;
- position: relative;
-}
-
-kb-abc-key::x-key,
-kb-shift-key::x-key,
-kb-key::x-key {
- bottom: 0;
- height: 1.2em;
- left: 0;
- margin: auto;
- padding-left: 0.5em;
- padding-right: 0.5em;
- position: absolute;
- right: 0;
- top: 0;
-}
-
-kb-key::x-hinttext {
- color: #7c7c7c;
- font-size: 70%;
- position: absolute;
- right: 7%;
- top: 5%;
-}
-
-kb-key::x-key[inverted] {
- color: #7c7c7c;
-}
-
-kb-key::x-hinttext[inverted] {
- color: #ffffff;
-}
-
-kb-abc-key.dark,
-kb-shift-key.dark,
-kb-key.dark {
- background-color: #2a2a2c;
- border-top: 2px solid #3a3a3c;
-}
-
-kb-altkey::x-key {
- bottom: 0;
- height: 1.2em;
- left: 0;
- margin: auto;
- position: absolute;
- right: 0;
- top: 0;
- text-align: center;
-}
-
-/* Left and right-side special keys with a character letter next to them need
- * additional padding.
- * */
-kb-abc-key.padded-left-special,
-kb-shift-key.padded-left-special,
-kb-key.padded-left-special {
- margin-right: 2px;
-}
-
-kb-abc-key.padded-right-special,
-kb-shift-key.padded-right-special,
-kb-key.padded-right-special {
- margin-left: 5px;
-}
-
-kb-row.top {
- margin-top: 5px !important;
-}
-
-.active {
- background-color: #848490 !important;
- border-top: 2px solid #A9A9AF !important;
- /* Do not use box shadow until performance improves
- * http://code.google.com/p/chromium/issues/detail?id=99045
- * box-shadow: 0px 0px 15px #fff;
- * */
-}
-
-.at,
-.com,
-.comma,
-.hide,
-.microphone,
-.period,
-.tab {
- -webkit-box-flex: 1.3 !important;
-}
-
-.symbol,
-.return {
- -webkit-box-flex: 1.5 !important;
-}
-
-.backspace {
- -webkit-box-flex: 1.7 !important;
-}
-
-.left-more {
- -webkit-box-flex: 1.4 !important;
-}
-
-.right-more {
- -webkit-box-flex: 1.6 !important;
-}
-
-.space {
- -webkit-box-flex: 4.8 !important;
-}
-
-.bar {
- -webkit-box-flex: 0.6 !important;
-}
-
-.backspace,
-.tab,
-.return,
-.shift,
-.left-more,
-.right-more,
-.symbol {
- font-size: 55%;
- font-weight: 200;
-}
-
-.microphone {
- background-image: url('images/microphone.svg');
-}
-
-.audio .microphone {
- background-image: url('images/microphone-green.svg');
-}
-
-.half-key-spacer {
- -webkit-box-flex: 0.5;
- margin-left: 4px;
-}
diff --git a/ui/keyboard/resources/webui_index.html b/ui/keyboard/resources/webui_index.html
deleted file mode 100644
index bdc8116..0000000
--- a/ui/keyboard/resources/webui_index.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE HTML>
-<!--
- -- Copyright 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.
- -->
-
-<!--
- -- To avoid unintentionally break webui keyboard when changing extension
- -- keyboard, creates this file and uses it as index.html for webui keyboard.
- -- TODO(bshe): remove this file when dynamic layout loading is fixed
- -- (http://www.crbug.com/260278).
- -->
-
-<html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
- <link rel="stylesheet" href="main.css">
- <script src="constants.js"></script>
- <script src="polymer_loader.js"></script>
- <script src="api_adapter.js"></script>
- <script src="voice_input.js"></script>
- <link rel="import" href="elements/kb-altkey.html">
- <link rel="import" href="elements/kb-altkey-container.html">
- <link rel="import" href="elements/kb-altkey-data.html">
- <link rel="import" href="elements/kb-altkey-set.html">
- <link rel="import" href="elements/kb-key-codes.html">
- <link rel="import" href="elements/kb-key-base.html">
- <link rel="import" href="elements/kb-key.html">
- <link rel="import" href="elements/kb-keyboard.html">
- <link rel="import" href="elements/kb-keyset.html">
- <link rel="import" href="elements/kb-row.html">
- <link rel="import" href="elements/kb-shift-key.html">
- <link id="numeric" rel="import" href="layouts/numeric.html">
- <link id="qwerty" rel="import" href="layouts/qwerty.html">
- <!--TODO(stevet): Import 'Open Sans' font. -->
- <script src="main.js"></script>
- <script src="layouts/latin-accents.js"></script>
- </head>
- <body>
- <kb-keyboard id="keyboard" touch-action="none" layout="qwerty">
- </kb-keyboard>
- </body>
-</html>