OLD | NEW |
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/chromeos/extensions/input_method_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 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/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.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 Loading... |
40 return; | 41 return; |
41 } | 42 } |
42 | 43 |
43 scoped_ptr<base::ListValue> args(new base::ListValue()); | 44 scoped_ptr<base::ListValue> args(new base::ListValue()); |
44 args->Append(new base::StringValue( | 45 args->Append(new base::StringValue( |
45 manager->GetActiveIMEState()->GetCurrentInputMethod().id())); | 46 manager->GetActiveIMEState()->GetCurrentInputMethod().id())); |
46 | 47 |
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_CHANGED, | 50 extensions::events::INPUT_METHOD_PRIVATE_ON_CHANGED, |
50 extensions::InputMethodAPI::kOnInputMethodChanged, args.Pass())); | 51 extensions::InputMethodAPI::kOnInputMethodChanged, 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 } // namespace chromeos | 56 } // namespace chromeos |
OLD | NEW |