OLD | NEW |
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 #include <utility> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 std::unique_ptr<base::ListValue> added_words(new base::ListValue()); | 74 std::unique_ptr<base::ListValue> added_words(new base::ListValue()); |
75 for (const std::string& word : dictionary_change.to_add()) | 75 for (const std::string& word : dictionary_change.to_add()) |
76 added_words->AppendString(word); | 76 added_words->AppendString(word); |
77 | 77 |
78 std::unique_ptr<base::ListValue> removed_words(new base::ListValue()); | 78 std::unique_ptr<base::ListValue> removed_words(new base::ListValue()); |
79 for (const std::string& word : dictionary_change.to_remove()) | 79 for (const std::string& word : dictionary_change.to_remove()) |
80 removed_words->AppendString(word); | 80 removed_words->AppendString(word); |
81 | 81 |
82 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 82 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
83 args->Append(added_words.release()); | 83 args->Append(std::move(added_words)); |
84 args->Append(removed_words.release()); | 84 args->Append(std::move(removed_words)); |
85 | 85 |
86 // The router will only send the event to extensions that are listening. | 86 // The router will only send the event to extensions that are listening. |
87 std::unique_ptr<extensions::Event> event(new extensions::Event( | 87 std::unique_ptr<extensions::Event> event(new extensions::Event( |
88 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_CHANGED, | 88 extensions::events::INPUT_METHOD_PRIVATE_ON_DICTIONARY_CHANGED, |
89 OnDictionaryChanged::kEventName, std::move(args))); | 89 OnDictionaryChanged::kEventName, std::move(args))); |
90 event->restrict_to_browser_context = context_; | 90 event->restrict_to_browser_context = context_; |
91 router->BroadcastEvent(std::move(event)); | 91 router->BroadcastEvent(std::move(event)); |
92 } | 92 } |
93 | 93 |
94 } // namespace chromeos | 94 } // namespace chromeos |
OLD | NEW |