| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 #include <utility> |
| 11 |
| 9 #include "ash/common/new_window_delegate.h" | 12 #include "ash/common/new_window_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 11 #include "base/bind.h" | 14 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 14 #include "base/macros.h" | 17 #include "base/macros.h" |
| 15 #include "base/values.h" | 18 #include "base/values.h" |
| 16 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 17 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
| 18 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 localized_strings->SetString("showKeyboardShortcuts", | 136 localized_strings->SetString("showKeyboardShortcuts", |
| 134 l10n_util::GetStringUTF16( | 137 l10n_util::GetStringUTF16( |
| 135 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS)); | 138 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS)); |
| 136 | 139 |
| 137 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { | 140 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { |
| 138 base::ListValue* list_value = new base::ListValue(); | 141 base::ListValue* list_value = new base::ListValue(); |
| 139 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { | 142 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { |
| 140 const input_method::ModifierKey value = | 143 const input_method::ModifierKey value = |
| 141 kModifierKeysSelectItems[j].value; | 144 kModifierKeysSelectItems[j].value; |
| 142 const int message_id = kModifierKeysSelectItems[j].message_id; | 145 const int message_id = kModifierKeysSelectItems[j].message_id; |
| 143 base::ListValue* option = new base::ListValue(); | 146 std::unique_ptr<base::ListValue> option(new base::ListValue()); |
| 144 option->Append(new base::FundamentalValue(value)); | 147 option->AppendInteger(value); |
| 145 option->Append(new base::StringValue(l10n_util::GetStringUTF16( | 148 option->AppendString(l10n_util::GetStringUTF16(message_id)); |
| 146 message_id))); | 149 list_value->Append(std::move(option)); |
| 147 list_value->Append(option); | |
| 148 } | 150 } |
| 149 localized_strings->Set(kDataValuesNames[i], list_value); | 151 localized_strings->Set(kDataValuesNames[i], list_value); |
| 150 } | 152 } |
| 151 } | 153 } |
| 152 | 154 |
| 153 void KeyboardHandler::InitializePage() { | 155 void KeyboardHandler::InitializePage() { |
| 154 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( | 156 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 155 chromeos::switches::kHasChromeOSDiamondKey); | 157 chromeos::switches::kHasChromeOSDiamondKey); |
| 156 const base::FundamentalValue show_diamond_key_options(has_diamond_key); | 158 const base::FundamentalValue show_diamond_key_options(has_diamond_key); |
| 157 | 159 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 179 } | 181 } |
| 180 | 182 |
| 181 void KeyboardHandler::UpdateCapsLockOptions() const { | 183 void KeyboardHandler::UpdateCapsLockOptions() const { |
| 182 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard()); | 184 const base::FundamentalValue show_caps_lock_options(HasExternalKeyboard()); |
| 183 web_ui()->CallJavascriptFunctionUnsafe( | 185 web_ui()->CallJavascriptFunctionUnsafe( |
| 184 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); | 186 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); |
| 185 } | 187 } |
| 186 | 188 |
| 187 } // namespace options | 189 } // namespace options |
| 188 } // namespace chromeos | 190 } // namespace chromeos |
| OLD | NEW |