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

Side by Side Diff: chrome/browser/extensions/api/language_settings_private/language_settings_private_delegate.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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 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 <string> 8 #include <string>
8 #include <utility> 9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/spellchecker/spellcheck_factory.h" 20 #include "chrome/browser/spellchecker/spellcheck_factory.h"
21 #include "chrome/browser/spellchecker/spellcheck_service.h" 21 #include "chrome/browser/spellchecker/spellcheck_service.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "components/prefs/pref_service.h" 23 #include "components/prefs/pref_service.h"
24 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 void LanguageSettingsPrivateDelegate::OnCustomDictionaryLoaded() { 152 void LanguageSettingsPrivateDelegate::OnCustomDictionaryLoaded() {
153 } 153 }
154 154
155 void LanguageSettingsPrivateDelegate::OnCustomDictionaryChanged( 155 void LanguageSettingsPrivateDelegate::OnCustomDictionaryChanged(
156 const SpellcheckCustomDictionary::Change& change) { 156 const SpellcheckCustomDictionary::Change& change) {
157 std::vector<std::string> to_add(change.to_add().begin(), 157 std::vector<std::string> to_add(change.to_add().begin(),
158 change.to_add().end()); 158 change.to_add().end());
159 std::vector<std::string> to_remove(change.to_remove().begin(), 159 std::vector<std::string> to_remove(change.to_remove().begin(),
160 change.to_remove().end()); 160 change.to_remove().end());
161 scoped_ptr<base::ListValue> args( 161 std::unique_ptr<base::ListValue> args(
162 language_settings_private::OnCustomDictionaryChanged::Create( 162 language_settings_private::OnCustomDictionaryChanged::Create(to_add,
163 to_add, to_remove)); 163 to_remove));
164 scoped_ptr<Event> extension_event(new Event( 164 std::unique_ptr<Event> extension_event(new Event(
165 events::LANGUAGE_SETTINGS_PRIVATE_ON_CUSTOM_DICTIONARY_CHANGED, 165 events::LANGUAGE_SETTINGS_PRIVATE_ON_CUSTOM_DICTIONARY_CHANGED,
166 language_settings_private::OnCustomDictionaryChanged::kEventName, 166 language_settings_private::OnCustomDictionaryChanged::kEventName,
167 std::move(args))); 167 std::move(args)));
168 EventRouter::Get(context_)->BroadcastEvent(std::move(extension_event)); 168 EventRouter::Get(context_)->BroadcastEvent(std::move(extension_event));
169 } 169 }
170 170
171 void LanguageSettingsPrivateDelegate::RefreshDictionaries( 171 void LanguageSettingsPrivateDelegate::RefreshDictionaries(
172 bool was_listening, bool should_listen) { 172 bool was_listening, bool should_listen) {
173 if (!profile_added_) 173 if (!profile_added_)
174 return; 174 return;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 void LanguageSettingsPrivateDelegate::OnSpellcheckDictionariesChanged() { 231 void LanguageSettingsPrivateDelegate::OnSpellcheckDictionariesChanged() {
232 RefreshDictionaries(listening_spellcheck_, listening_spellcheck_); 232 RefreshDictionaries(listening_spellcheck_, listening_spellcheck_);
233 BroadcastDictionariesChangedEvent(); 233 BroadcastDictionariesChangedEvent();
234 } 234 }
235 235
236 void LanguageSettingsPrivateDelegate::BroadcastDictionariesChangedEvent() { 236 void LanguageSettingsPrivateDelegate::BroadcastDictionariesChangedEvent() {
237 std::vector<language_settings_private::SpellcheckDictionaryStatus> statuses = 237 std::vector<language_settings_private::SpellcheckDictionaryStatus> statuses =
238 GetHunspellDictionaryStatuses(); 238 GetHunspellDictionaryStatuses();
239 239
240 scoped_ptr<base::ListValue> args( 240 std::unique_ptr<base::ListValue> args(
241 language_settings_private::OnSpellcheckDictionariesChanged::Create( 241 language_settings_private::OnSpellcheckDictionariesChanged::Create(
242 statuses)); 242 statuses));
243 scoped_ptr<extensions::Event> extension_event(new extensions::Event( 243 std::unique_ptr<extensions::Event> extension_event(new extensions::Event(
244 events::LANGUAGE_SETTINGS_PRIVATE_ON_SPELLCHECK_DICTIONARIES_CHANGED, 244 events::LANGUAGE_SETTINGS_PRIVATE_ON_SPELLCHECK_DICTIONARIES_CHANGED,
245 language_settings_private::OnSpellcheckDictionariesChanged::kEventName, 245 language_settings_private::OnSpellcheckDictionariesChanged::kEventName,
246 std::move(args))); 246 std::move(args)));
247 EventRouter::Get(context_)->BroadcastEvent(std::move(extension_event)); 247 EventRouter::Get(context_)->BroadcastEvent(std::move(extension_event));
248 } 248 }
249 249
250 void LanguageSettingsPrivateDelegate::RemoveDictionaryObservers() { 250 void LanguageSettingsPrivateDelegate::RemoveDictionaryObservers() {
251 for (const auto& dictionary : hunspell_dictionaries_) { 251 for (const auto& dictionary : hunspell_dictionaries_) {
252 if (dictionary) 252 if (dictionary)
253 dictionary->RemoveObserver(this); 253 dictionary->RemoveObserver(this);
254 } 254 }
255 } 255 }
256 256
257 } // namespace extensions 257 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698