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

Side by Side Diff: chrome/browser/ui/webui/options/language_options_handler_common.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/language_options_handler_common.h" 5 #include "chrome/browser/ui/webui/options/language_options_handler_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 std::vector<std::string> languages; 283 std::vector<std::string> languages;
284 for (base::ListValue::const_iterator it = language_list->begin(); 284 for (base::ListValue::const_iterator it = language_list->begin();
285 it != language_list->end(); ++it) { 285 it != language_list->end(); ++it) {
286 std::string lang; 286 std::string lang;
287 (*it)->GetAsString(&lang); 287 (*it)->GetAsString(&lang);
288 languages.push_back(lang); 288 languages.push_back(lang);
289 } 289 }
290 290
291 Profile* profile = Profile::FromWebUI(web_ui()); 291 Profile* profile = Profile::FromWebUI(web_ui());
292 scoped_ptr<translate::TranslatePrefs> translate_prefs = 292 std::unique_ptr<translate::TranslatePrefs> translate_prefs =
293 ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs()); 293 ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs());
294 translate_prefs->UpdateLanguageList(languages); 294 translate_prefs->UpdateLanguageList(languages);
295 } 295 }
296 296
297 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload( 297 void LanguageOptionsHandlerCommon::RetrySpellcheckDictionaryDownload(
298 const base::ListValue* args) { 298 const base::ListValue* args) {
299 std::string language = base::UTF16ToUTF8(ExtractStringValue(args)); 299 std::string language = base::UTF16ToUTF8(ExtractStringValue(args));
300 SpellcheckService* service = GetSpellcheckService(); 300 SpellcheckService* service = GetSpellcheckService();
301 if (!service) 301 if (!service)
302 return; 302 return;
303 303
304 for (auto dictionary : service->GetHunspellDictionaries()) { 304 for (auto dictionary : service->GetHunspellDictionaries()) {
305 if (dictionary->GetLanguage() == language) { 305 if (dictionary->GetLanguage() == language) {
306 dictionary->RetryDownloadDictionary( 306 dictionary->RetryDownloadDictionary(
307 Profile::FromWebUI(web_ui())->GetRequestContext()); 307 Profile::FromWebUI(web_ui())->GetRequestContext());
308 return; 308 return;
309 } 309 }
310 } 310 }
311 } 311 }
312 312
313 SpellcheckService* LanguageOptionsHandlerCommon::GetSpellcheckService() { 313 SpellcheckService* LanguageOptionsHandlerCommon::GetSpellcheckService() {
314 return SpellcheckServiceFactory::GetForContext(Profile::FromWebUI(web_ui())); 314 return SpellcheckServiceFactory::GetForContext(Profile::FromWebUI(web_ui()));
315 } 315 }
316 316
317 } // namespace options 317 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698