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

Side by Side Diff: chrome/browser/chromeos/extensions/dictionary_event_router.cc

Issue 1556783002: Convert Pass()→std::move() for CrOS extension code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chromeos/extensions/dictionary_event_router.h" 5 #include "chrome/browser/chromeos/extensions/dictionary_event_router.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility>
8 9
9 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/browser/chromeos/extensions/input_method_api.h" 12 #include "chrome/browser/chromeos/extensions/input_method_api.h"
12 #include "chrome/browser/spellchecker/spellcheck_factory.h" 13 #include "chrome/browser/spellchecker/spellcheck_factory.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "extensions/browser/event_router.h" 15 #include "extensions/browser/event_router.h"
15 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
16 17
17 namespace chromeos { 18 namespace chromeos {
(...skipping 22 matching lines...) Expand all
40 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 41 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
41 if (!router->HasEventListener( 42 if (!router->HasEventListener(
42 extensions::InputMethodAPI::kOnDictionaryLoaded)) { 43 extensions::InputMethodAPI::kOnDictionaryLoaded)) {
43 return; 44 return;
44 } 45 }
45 46
46 scoped_ptr<base::ListValue> args(new base::ListValue()); 47 scoped_ptr<base::ListValue> args(new base::ListValue());
47 // The router will only send the event to extensions that are listening. 48 // The router will only send the event to extensions that are listening.
48 scoped_ptr<extensions::Event> event(new extensions::Event( 49 scoped_ptr<extensions::Event> event(new extensions::Event(
49 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_LOADED, 50 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_LOADED,
50 extensions::InputMethodAPI::kOnDictionaryLoaded, args.Pass())); 51 extensions::InputMethodAPI::kOnDictionaryLoaded, std::move(args)));
51 event->restrict_to_browser_context = context_; 52 event->restrict_to_browser_context = context_;
52 router->BroadcastEvent(event.Pass()); 53 router->BroadcastEvent(std::move(event));
53 } 54 }
54 55
55 void ExtensionDictionaryEventRouter::OnCustomDictionaryLoaded() { 56 void ExtensionDictionaryEventRouter::OnCustomDictionaryLoaded() {
56 loaded_ = true; 57 loaded_ = true;
57 DispatchLoadedEventIfLoaded(); 58 DispatchLoadedEventIfLoaded();
58 } 59 }
59 60
60 void ExtensionDictionaryEventRouter::OnCustomDictionaryChanged( 61 void ExtensionDictionaryEventRouter::OnCustomDictionaryChanged(
61 const SpellcheckCustomDictionary::Change& dictionary_change) { 62 const SpellcheckCustomDictionary::Change& dictionary_change) {
62 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 63 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
(...skipping 11 matching lines...) Expand all
74 for (const std::string& word : dictionary_change.to_remove()) 75 for (const std::string& word : dictionary_change.to_remove())
75 removed_words->AppendString(word); 76 removed_words->AppendString(word);
76 77
77 scoped_ptr<base::ListValue> args(new base::ListValue()); 78 scoped_ptr<base::ListValue> args(new base::ListValue());
78 args->Append(added_words.release()); 79 args->Append(added_words.release());
79 args->Append(removed_words.release()); 80 args->Append(removed_words.release());
80 81
81 // The router will only send the event to extensions that are listening. 82 // The router will only send the event to extensions that are listening.
82 scoped_ptr<extensions::Event> event(new extensions::Event( 83 scoped_ptr<extensions::Event> event(new extensions::Event(
83 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_CHANGED, 84 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_CHANGED,
84 extensions::InputMethodAPI::kOnDictionaryChanged, args.Pass())); 85 extensions::InputMethodAPI::kOnDictionaryChanged, std::move(args)));
85 event->restrict_to_browser_context = context_; 86 event->restrict_to_browser_context = context_;
86 router->BroadcastEvent(event.Pass()); 87 router->BroadcastEvent(std::move(event));
87 } 88 }
88 89
89 } // namespace chromeos 90 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698