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

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

Issue 2695663003: Remove last usages of ScopedVector in extensions/ (Closed)
Patch Set: remove rest of the (unused) includes Created 3 years, 10 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void SpellcheckService::InitForRenderer(content::RenderProcessHost* process) { 181 void SpellcheckService::InitForRenderer(content::RenderProcessHost* process) {
182 DCHECK_CURRENTLY_ON(BrowserThread::UI); 182 DCHECK_CURRENTLY_ON(BrowserThread::UI);
183 183
184 content::BrowserContext* context = process->GetBrowserContext(); 184 content::BrowserContext* context = process->GetBrowserContext();
185 if (SpellcheckServiceFactory::GetForContext(context) != this) 185 if (SpellcheckServiceFactory::GetForContext(context) != this)
186 return; 186 return;
187 187
188 PrefService* prefs = user_prefs::UserPrefs::Get(context); 188 PrefService* prefs = user_prefs::UserPrefs::Get(context);
189 std::vector<SpellCheckBDictLanguage> bdict_languages; 189 std::vector<SpellCheckBDictLanguage> bdict_languages;
190 190
191 for (const auto* hunspell_dictionary : hunspell_dictionaries_) { 191 for (const auto& hunspell_dictionary : hunspell_dictionaries_) {
192 bdict_languages.push_back(SpellCheckBDictLanguage()); 192 bdict_languages.push_back(SpellCheckBDictLanguage());
193 bdict_languages.back().language = hunspell_dictionary->GetLanguage(); 193 bdict_languages.back().language = hunspell_dictionary->GetLanguage();
194 bdict_languages.back().file = 194 bdict_languages.back().file =
195 hunspell_dictionary->GetDictionaryFile().IsValid() 195 hunspell_dictionary->GetDictionaryFile().IsValid()
196 ? IPC::GetPlatformFileForTransit( 196 ? IPC::GetPlatformFileForTransit(
197 hunspell_dictionary->GetDictionaryFile().GetPlatformFile(), 197 hunspell_dictionary->GetDictionaryFile().GetPlatformFile(),
198 false) 198 false)
199 : IPC::InvalidPlatformFileForTransit(); 199 : IPC::InvalidPlatformFileForTransit();
200 } 200 }
201 201
(...skipping 19 matching lines...) Expand all
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(spellcheck::prefs::kSpellCheckDictionaries); 226 prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries);
227 227
228 for (const auto& 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(
232 dictionary, 232 base::MakeUnique<SpellcheckHunspellDictionary>(
233 content::BrowserContext::GetDefaultStoragePartition(context_)-> 233 dictionary,
234 GetURLRequestContext(), 234 content::BrowserContext::GetDefaultStoragePartition(context_)
235 this)); 235 ->GetURLRequestContext(),
236 this));
236 hunspell_dictionaries_.back()->AddObserver(this); 237 hunspell_dictionaries_.back()->AddObserver(this);
237 hunspell_dictionaries_.back()->Load(); 238 hunspell_dictionaries_.back()->Load();
238 } 239 }
239 } 240 }
240 241
241 const ScopedVector<SpellcheckHunspellDictionary>& 242 const std::vector<std::unique_ptr<SpellcheckHunspellDictionary>>&
242 SpellcheckService::GetHunspellDictionaries() { 243 SpellcheckService::GetHunspellDictionaries() {
243 return hunspell_dictionaries_; 244 return hunspell_dictionaries_;
244 } 245 }
245 246
246 spellcheck::FeedbackSender* SpellcheckService::GetFeedbackSender() { 247 spellcheck::FeedbackSender* SpellcheckService::GetFeedbackSender() {
247 return feedback_sender_.get(); 248 return feedback_sender_.get();
248 } 249 }
249 250
250 bool SpellcheckService::LoadExternalDictionary(std::string language, 251 bool SpellcheckService::LoadExternalDictionary(std::string language,
251 std::string locale, 252 std::string locale,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 spellcheck::GetISOLanguageCountryCodeFromLocale( 376 spellcheck::GetISOLanguageCountryCodeFromLocale(
376 feedback_language, &language_code, &country_code); 377 feedback_language, &language_code, &country_code);
377 feedback_sender_->OnLanguageCountryChange(language_code, country_code); 378 feedback_sender_->OnLanguageCountryChange(language_code, country_code);
378 if (SpellingServiceClient::IsAvailable( 379 if (SpellingServiceClient::IsAvailable(
379 context_, SpellingServiceClient::SPELLCHECK)) { 380 context_, SpellingServiceClient::SPELLCHECK)) {
380 feedback_sender_->StartFeedbackCollection(); 381 feedback_sender_->StartFeedbackCollection();
381 } else { 382 } else {
382 feedback_sender_->StopFeedbackCollection(); 383 feedback_sender_->StopFeedbackCollection();
383 } 384 }
384 } 385 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_service.h ('k') | chrome/browser/ui/webui/options/language_options_handler_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698