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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various builds. Created 4 years, 7 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/spellchecker/spellcheck_service.h" 5 #include "chrome/browser/spellchecker/spellcheck_service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 void SpellcheckService::LoadHunspellDictionaries() { 219 void SpellcheckService::LoadHunspellDictionaries() {
220 hunspell_dictionaries_.clear(); 220 hunspell_dictionaries_.clear();
221 221
222 PrefService* prefs = user_prefs::UserPrefs::Get(context_); 222 PrefService* prefs = user_prefs::UserPrefs::Get(context_);
223 DCHECK(prefs); 223 DCHECK(prefs);
224 224
225 const base::ListValue* dictionary_values = 225 const base::ListValue* dictionary_values =
226 prefs->GetList(prefs::kSpellCheckDictionaries); 226 prefs->GetList(prefs::kSpellCheckDictionaries);
227 227
228 for (const base::Value* dictionary_value : *dictionary_values) { 228 for (const auto& dictionary_value : *dictionary_values) {
229 std::string dictionary; 229 std::string dictionary;
230 dictionary_value->GetAsString(&dictionary); 230 dictionary_value->GetAsString(&dictionary);
231 hunspell_dictionaries_.push_back(new SpellcheckHunspellDictionary( 231 hunspell_dictionaries_.push_back(new SpellcheckHunspellDictionary(
232 dictionary, 232 dictionary,
233 content::BrowserContext::GetDefaultStoragePartition(context_)-> 233 content::BrowserContext::GetDefaultStoragePartition(context_)->
234 GetURLRequestContext(), 234 GetURLRequestContext(),
235 this)); 235 this));
236 hunspell_dictionaries_.back()->AddObserver(this); 236 hunspell_dictionaries_.back()->AddObserver(this);
237 hunspell_dictionaries_.back()->Load(); 237 hunspell_dictionaries_.back()->Load();
238 } 238 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale( 378 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale(
379 feedback_language, &language_code, &country_code); 379 feedback_language, &language_code, &country_code);
380 feedback_sender_->OnLanguageCountryChange(language_code, country_code); 380 feedback_sender_->OnLanguageCountryChange(language_code, country_code);
381 if (SpellingServiceClient::IsAvailable( 381 if (SpellingServiceClient::IsAvailable(
382 context_, SpellingServiceClient::SPELLCHECK)) { 382 context_, SpellingServiceClient::SPELLCHECK)) {
383 feedback_sender_->StartFeedbackCollection(); 383 feedback_sender_->StartFeedbackCollection();
384 } else { 384 } else {
385 feedback_sender_->StopFeedbackCollection(); 385 feedback_sender_->StopFeedbackCollection();
386 } 386 }
387 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698