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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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/cros_language_options_handler .h" 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler .h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 web_ui()->RegisterMessageCallback("uiLanguageRestart", 130 web_ui()->RegisterMessageCallback("uiLanguageRestart",
131 base::Bind(&CrosLanguageOptionsHandler::RestartCallback, 131 base::Bind(&CrosLanguageOptionsHandler::RestartCallback,
132 base::Unretained(this))); 132 base::Unretained(this)));
133 } 133 }
134 134
135 // static 135 // static
136 base::ListValue* CrosLanguageOptionsHandler::GetInputMethodList() { 136 base::ListValue* CrosLanguageOptionsHandler::GetInputMethodList() {
137 input_method::InputMethodManager* manager = 137 input_method::InputMethodManager* manager =
138 input_method::InputMethodManager::Get(); 138 input_method::InputMethodManager::Get();
139 // GetSupportedInputMethods() never return NULL. 139 // GetSupportedInputMethods() never return NULL.
140 scoped_ptr<input_method::InputMethodDescriptors> descriptors( 140 std::unique_ptr<input_method::InputMethodDescriptors> descriptors(
141 manager->GetSupportedInputMethods()); 141 manager->GetSupportedInputMethods());
142 142
143 base::ListValue* input_method_list = new base::ListValue(); 143 base::ListValue* input_method_list = new base::ListValue();
144 144
145 for (size_t i = 0; i < descriptors->size(); ++i) { 145 for (size_t i = 0; i < descriptors->size(); ++i) {
146 const input_method::InputMethodDescriptor& descriptor = 146 const input_method::InputMethodDescriptor& descriptor =
147 (*descriptors)[i]; 147 (*descriptors)[i];
148 const std::string display_name = 148 const std::string display_name =
149 manager->GetInputMethodUtil()->GetInputMethodDisplayNameFromId( 149 manager->GetInputMethodUtil()->GetInputMethodDisplayNameFromId(
150 descriptor.id()); 150 descriptor.id());
(...skipping 13 matching lines...) Expand all
164 } 164 }
165 165
166 return input_method_list; 166 return input_method_list;
167 } 167 }
168 168
169 base::ListValue* 169 base::ListValue*
170 CrosLanguageOptionsHandler::ConvertInputMethodDescriptorsToIMEList( 170 CrosLanguageOptionsHandler::ConvertInputMethodDescriptorsToIMEList(
171 const input_method::InputMethodDescriptors& descriptors) { 171 const input_method::InputMethodDescriptors& descriptors) {
172 input_method::InputMethodUtil* util = 172 input_method::InputMethodUtil* util =
173 input_method::InputMethodManager::Get()->GetInputMethodUtil(); 173 input_method::InputMethodManager::Get()->GetInputMethodUtil();
174 scoped_ptr<base::ListValue> ime_ids_list(new base::ListValue()); 174 std::unique_ptr<base::ListValue> ime_ids_list(new base::ListValue());
175 for (size_t i = 0; i < descriptors.size(); ++i) { 175 for (size_t i = 0; i < descriptors.size(); ++i) {
176 const input_method::InputMethodDescriptor& descriptor = descriptors[i]; 176 const input_method::InputMethodDescriptor& descriptor = descriptors[i];
177 scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue()); 177 std::unique_ptr<base::DictionaryValue> dictionary(
178 new base::DictionaryValue());
178 dictionary->SetString("id", descriptor.id()); 179 dictionary->SetString("id", descriptor.id());
179 dictionary->SetString( 180 dictionary->SetString(
180 "displayName", util->GetLocalizedDisplayName(descriptor)); 181 "displayName", util->GetLocalizedDisplayName(descriptor));
181 dictionary->SetString("optionsPage", descriptor.options_page_url().spec()); 182 dictionary->SetString("optionsPage", descriptor.options_page_url().spec());
182 scoped_ptr<base::DictionaryValue> language_codes( 183 std::unique_ptr<base::DictionaryValue> language_codes(
183 new base::DictionaryValue()); 184 new base::DictionaryValue());
184 for (size_t i = 0; i < descriptor.language_codes().size(); ++i) 185 for (size_t i = 0; i < descriptor.language_codes().size(); ++i)
185 language_codes->SetBoolean(descriptor.language_codes().at(i), true); 186 language_codes->SetBoolean(descriptor.language_codes().at(i), true);
186 dictionary->Set("languageCodeSet", language_codes.release()); 187 dictionary->Set("languageCodeSet", language_codes.release());
187 ime_ids_list->Append(dictionary.release()); 188 ime_ids_list->Append(dictionary.release());
188 } 189 }
189 return ime_ids_list.release(); 190 return ime_ids_list.release();
190 } 191 }
191 192
192 void CrosLanguageOptionsHandler::SetApplicationLocale( 193 void CrosLanguageOptionsHandler::SetApplicationLocale(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id); 270 extension_ime_util::GetExtensionIDFromInputMethodID(input_method_id);
270 const extensions::Extension* extension = 271 const extensions::Extension* extension =
271 enabled_extensions.GetByID(extension_id); 272 enabled_extensions.GetByID(extension_id);
272 if (extension) 273 if (extension)
273 entry->SetString("extensionName", extension->name()); 274 entry->SetString("extensionName", extension->name());
274 } 275 }
275 } 276 }
276 277
277 } // namespace options 278 } // namespace options
278 } // namespace chromeos 279 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698