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

Side by Side Diff: chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/language_settings_private/language_setti ngs_private_delegate.h" 5 #include "chrome/browser/extensions/api/language_settings_private/language_setti ngs_private_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/memory/scoped_vector.h"
15 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/spellchecker/spellcheck_factory.h" 18 #include "chrome/browser/spellchecker/spellcheck_factory.h"
20 #include "chrome/browser/spellchecker/spellcheck_service.h" 19 #include "chrome/browser/spellchecker/spellcheck_service.h"
21 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
22 #include "components/spellcheck/browser/pref_names.h" 21 #include "components/spellcheck/browser/pref_names.h"
23 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
24 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!profile_added_) 171 if (!profile_added_)
173 return; 172 return;
174 if (was_listening) 173 if (was_listening)
175 RemoveDictionaryObservers(); 174 RemoveDictionaryObservers();
176 hunspell_dictionaries_.clear(); 175 hunspell_dictionaries_.clear();
177 SpellcheckService* service = SpellcheckServiceFactory::GetForContext( 176 SpellcheckService* service = SpellcheckServiceFactory::GetForContext(
178 context_); 177 context_);
179 if (!custom_dictionary_) 178 if (!custom_dictionary_)
180 custom_dictionary_ = service->GetCustomDictionary(); 179 custom_dictionary_ = service->GetCustomDictionary();
181 180
182 const ScopedVector<SpellcheckHunspellDictionary>& dictionaries( 181 const std::vector<std::unique_ptr<SpellcheckHunspellDictionary>>&
183 service->GetHunspellDictionaries()); 182 dictionaries(service->GetHunspellDictionaries());
184 for (auto* dictionary : dictionaries) { 183 for (const auto& dictionary : dictionaries) {
185 hunspell_dictionaries_.push_back(dictionary->AsWeakPtr()); 184 hunspell_dictionaries_.push_back(dictionary->AsWeakPtr());
186 if (should_listen) 185 if (should_listen)
187 dictionary->AddObserver(this); 186 dictionary->AddObserver(this);
188 } 187 }
189 } 188 }
190 189
191 const LanguageSettingsPrivateDelegate::WeakDictionaries& 190 const LanguageSettingsPrivateDelegate::WeakDictionaries&
192 LanguageSettingsPrivateDelegate::GetHunspellDictionaries() { 191 LanguageSettingsPrivateDelegate::GetHunspellDictionaries() {
193 // If there are no hunspell dictionaries, or the first is invalid, refresh. 192 // If there are no hunspell dictionaries, or the first is invalid, refresh.
194 if (hunspell_dictionaries_.empty() || !hunspell_dictionaries_.front()) 193 if (hunspell_dictionaries_.empty() || !hunspell_dictionaries_.front())
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 248 }
250 249
251 void LanguageSettingsPrivateDelegate::RemoveDictionaryObservers() { 250 void LanguageSettingsPrivateDelegate::RemoveDictionaryObservers() {
252 for (const auto& dictionary : hunspell_dictionaries_) { 251 for (const auto& dictionary : hunspell_dictionaries_) {
253 if (dictionary) 252 if (dictionary)
254 dictionary->RemoveObserver(this); 253 dictionary->RemoveObserver(this);
255 } 254 }
256 } 255 }
257 256
258 } // namespace extensions 257 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698