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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/keyboard_handler.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 l10n_util::GetStringUTF16( 132 l10n_util::GetStringUTF16(
133 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_FAST)); 133 IDS_OPTIONS_SETTINGS_LANGUAGES_AUTO_REPEAT_RATE_FAST));
134 localized_strings->SetString("changeLanguageAndInputSettings", 134 localized_strings->SetString("changeLanguageAndInputSettings",
135 l10n_util::GetStringUTF16( 135 l10n_util::GetStringUTF16(
136 IDS_OPTIONS_SETTINGS_CHANGE_LANGUAGE_AND_INPUT_SETTINGS)); 136 IDS_OPTIONS_SETTINGS_CHANGE_LANGUAGE_AND_INPUT_SETTINGS));
137 localized_strings->SetString("showKeyboardShortcuts", 137 localized_strings->SetString("showKeyboardShortcuts",
138 l10n_util::GetStringUTF16( 138 l10n_util::GetStringUTF16(
139 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS)); 139 IDS_OPTIONS_SETTINGS_SHOW_KEYBOARD_SHORTCUTS));
140 140
141 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) { 141 for (size_t i = 0; i < arraysize(kDataValuesNames); ++i) {
142 base::ListValue* list_value = new base::ListValue(); 142 auto list_value = base::MakeUnique<base::ListValue>();
143 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) { 143 for (size_t j = 0; j < arraysize(kModifierKeysSelectItems); ++j) {
144 const input_method::ModifierKey value = 144 const input_method::ModifierKey value =
145 kModifierKeysSelectItems[j].value; 145 kModifierKeysSelectItems[j].value;
146 const int message_id = kModifierKeysSelectItems[j].message_id; 146 const int message_id = kModifierKeysSelectItems[j].message_id;
147 auto option = base::MakeUnique<base::ListValue>(); 147 auto option = base::MakeUnique<base::ListValue>();
148 option->AppendInteger(value); 148 option->AppendInteger(value);
149 option->AppendString(l10n_util::GetStringUTF16(message_id)); 149 option->AppendString(l10n_util::GetStringUTF16(message_id));
150 list_value->Append(std::move(option)); 150 list_value->Append(std::move(option));
151 } 151 }
152 localized_strings->Set(kDataValuesNames[i], list_value); 152 localized_strings->Set(kDataValuesNames[i], std::move(list_value));
153 } 153 }
154 } 154 }
155 155
156 void KeyboardHandler::InitializePage() { 156 void KeyboardHandler::InitializePage() {
157 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch( 157 bool has_diamond_key = base::CommandLine::ForCurrentProcess()->HasSwitch(
158 chromeos::switches::kHasChromeOSDiamondKey); 158 chromeos::switches::kHasChromeOSDiamondKey);
159 const base::Value show_diamond_key_options(has_diamond_key); 159 const base::Value show_diamond_key_options(has_diamond_key);
160 160
161 web_ui()->CallJavascriptFunctionUnsafe( 161 web_ui()->CallJavascriptFunctionUnsafe(
162 "options.KeyboardOverlay.showDiamondKeyOptions", 162 "options.KeyboardOverlay.showDiamondKeyOptions",
(...skipping 19 matching lines...) Expand all
182 } 182 }
183 183
184 void KeyboardHandler::UpdateCapsLockOptions() const { 184 void KeyboardHandler::UpdateCapsLockOptions() const {
185 const base::Value show_caps_lock_options(HasExternalKeyboard()); 185 const base::Value show_caps_lock_options(HasExternalKeyboard());
186 web_ui()->CallJavascriptFunctionUnsafe( 186 web_ui()->CallJavascriptFunctionUnsafe(
187 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options); 187 "options.KeyboardOverlay.showCapsLockOptions", show_caps_lock_options);
188 } 188 }
189 189
190 } // namespace options 190 } // namespace options
191 } // namespace chromeos 191 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698