OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/keyboard_handler.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 9 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_LABEL)); | 56 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_LABEL)); |
57 localized_strings->SetString("remapControlKeyToContent", | 57 localized_strings->SetString("remapControlKeyToContent", |
58 l10n_util::GetStringUTF16( | 58 l10n_util::GetStringUTF16( |
59 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL)); | 59 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_CTRL_LABEL)); |
60 localized_strings->SetString("remapAltKeyToContent", | 60 localized_strings->SetString("remapAltKeyToContent", |
61 l10n_util::GetStringUTF16( | 61 l10n_util::GetStringUTF16( |
62 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL)); | 62 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_LEFT_ALT_LABEL)); |
63 localized_strings->SetString("remapCapsLockKeyToContent", | 63 localized_strings->SetString("remapCapsLockKeyToContent", |
64 l10n_util::GetStringUTF16( | 64 l10n_util::GetStringUTF16( |
65 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK_LABEL)); | 65 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_CAPS_LOCK_LABEL)); |
| 66 localized_strings->SetString("searchKeyActsAsFunctionKey", |
| 67 l10n_util::GetStringUTF16( |
| 68 IDS_OPTIONS_SETTINGS_LANGUAGES_KEY_SEARCH_AS_FUNCTION)); |
66 | 69 |
67 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { | 70 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { |
68 ListValue* list_value = new ListValue(); | 71 ListValue* list_value = new ListValue(); |
69 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { | 72 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { |
70 const input_method::ModifierKey value = | 73 const input_method::ModifierKey value = |
71 kModifierKeysSelectItems[j].value; | 74 kModifierKeysSelectItems[j].value; |
72 const int message_id = kModifierKeysSelectItems[j].message_id; | 75 const int message_id = kModifierKeysSelectItems[j].message_id; |
73 // Only the seach key can be remapped to the caps lock key. | 76 // Only the seach key can be remapped to the caps lock key. |
74 if (kDataValuesNames[i] != std::string("remapSearchKeyToValue") && | 77 if (kDataValuesNames[i] != std::string("remapSearchKeyToValue") && |
75 kDataValuesNames[i] != std::string("remapCapsLockKeyToValue") && | 78 kDataValuesNames[i] != std::string("remapCapsLockKeyToValue") && |
76 value == input_method::kCapsLockKey) { | 79 value == input_method::kCapsLockKey) { |
77 continue; | 80 continue; |
78 } | 81 } |
79 ListValue* option = new ListValue(); | 82 ListValue* option = new ListValue(); |
80 option->Append(Value::CreateIntegerValue(value)); | 83 option->Append(Value::CreateIntegerValue(value)); |
81 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( | 84 option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16( |
82 message_id))); | 85 message_id))); |
83 list_value->Append(option); | 86 list_value->Append(option); |
84 } | 87 } |
85 localized_strings->Set(kDataValuesNames[i], list_value); | 88 localized_strings->Set(kDataValuesNames[i], list_value); |
86 } | 89 } |
87 } | 90 } |
88 | 91 |
89 void KeyboardHandler::InitializePage() { | 92 void KeyboardHandler::InitializePage() { |
90 if (CommandLine::ForCurrentProcess()->HasSwitch( | 93 bool chromeos_keyboard = CommandLine::ForCurrentProcess()->HasSwitch( |
91 switches::kHasChromeOSKeyboard)) | 94 switches::kHasChromeOSKeyboard); |
92 return; | 95 bool chromebook_function_key = CommandLine::ForCurrentProcess()->HasSwitch( |
| 96 switches::kEnableChromebookFunctionKey); |
| 97 |
93 const base::FundamentalValue show_options(true); | 98 const base::FundamentalValue show_options(true); |
94 web_ui()->CallJavascriptFunction( | 99 |
95 "options.KeyboardOverlay.showCapsLockOptions", show_options); | 100 if (!chromeos_keyboard) { |
| 101 web_ui()->CallJavascriptFunction( |
| 102 "options.KeyboardOverlay.showCapsLockOptions", show_options); |
| 103 } |
| 104 |
| 105 if (chromebook_function_key) { |
| 106 web_ui()->CallJavascriptFunction( |
| 107 "options.KeyboardOverlay.showFunctionKeyOptions", show_options); |
| 108 } |
96 } | 109 } |
97 | 110 |
98 } // namespace options | 111 } // namespace options |
99 } // namespace chromeos | 112 } // namespace chromeos |
OLD | NEW |