Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / chromeos / keyboard_handler.cc
index 6aa795c..57667af 100644 (file)
@@ -4,10 +4,14 @@
 
 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h"
 
+#include "ash/new_window_delegate.h"
+#include "ash/shell.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
 #include "base/command_line.h"
 #include "base/values.h"
 #include "chromeos/chromeos_switches.h"
-#include "chromeos/ime/xkeyboard.h"
+#include "chromeos/ime/ime_keyboard.h"
 #include "content/public/browser/web_ui.h"
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -49,11 +53,12 @@ KeyboardHandler::KeyboardHandler() {
 KeyboardHandler::~KeyboardHandler() {
 }
 
-void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
+void KeyboardHandler::GetLocalizedValues(
+    base::DictionaryValue* localized_strings) {
   DCHECK(localized_strings);
+  RegisterTitle(localized_strings, "keyboardOverlay",
+                IDS_OPTIONS_KEYBOARD_OVERLAY_TITLE);
 
-  localized_strings->SetString("keyboardOverlayTitle",
-      l10n_util::GetStringUTF16(IDS_OPTIONS_KEYBOARD_OVERLAY_TITLE));
   localized_strings->SetString("remapSearchKeyToContent",
       l10n_util::GetStringUTF16(
           IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_LABEL));
@@ -75,12 +80,36 @@ void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
   localized_strings->SetString("sendFunctionKeysDescription",
       l10n_util::GetStringUTF16(
           IDS_OPTIONS_SETTINGS_LANGUAGES_SEND_FUNCTION_KEYS_DESCRIPTION));
+  localized_strings->SetString("enableAutoRepeat",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_ENABLE));
+  localized_strings->SetString("autoRepeatDelay",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_DELAY));
+  localized_strings->SetString("autoRepeatDelayLong",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_DELAY_LONG));
+  localized_strings->SetString("autoRepeatDelayShort",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_DELAY_SHORT));
+  localized_strings->SetString("autoRepeatRate",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE));
+  localized_strings->SetString("autoRepeatRateSlow",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_SLOW));
+  localized_strings->SetString("autoRepeatRateFast",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_FAST));
   localized_strings->SetString("changeLanguageAndInputSettings",
       l10n_util::GetStringUTF16(
           IDS_OPTIONS_SETTINGS_CHANGE_LANGUAGE_AND_INPUT_SETTINGS));
+  localized_strings->SetString("showKeyboardShortcuts",
+      l10n_util::GetStringUTF16(
+          IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS));
 
   for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) {
-    ListValue* list_value = new ListValue();
+    base::ListValue* list_value = new base::ListValue();
     for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) {
       const input_method::ModifierKey value =
           kModifierKeysSelectItems[j].value;
@@ -91,7 +120,7 @@ void KeyboardHandler::GetLocalizedValues(DictionaryValue* localized_strings) {
           value == input_method::kCapsLockKey) {
         continue;
       }
-      ListValue* option = new ListValue();
+      base::ListValue* option = new base::ListValue();
       option->Append(new base::FundamentalValue(value));
       option->Append(new base::StringValue(l10n_util::GetStringUTF16(
           message_id)));
@@ -118,5 +147,17 @@ void KeyboardHandler::InitializePage() {
       show_diamond_key_options);
 }
 
+void KeyboardHandler::RegisterMessages() {
+  // Callback to show keyboard overlay.
+  web_ui()->RegisterMessageCallback(
+      "showKeyboardShortcuts",
+      base::Bind(&KeyboardHandler::HandleShowKeyboardShortcuts,
+                 base::Unretained(this)));
+}
+
+void KeyboardHandler::HandleShowKeyboardShortcuts(const base::ListValue* args) {
+  ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay();
+}
+
 }  // namespace options
 }  // namespace chromeos