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

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

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 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) 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 "input_method_event_router.h" 5 #include "input_method_event_router.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 18 matching lines...) Expand all
29 input_method::InputMethodManager *manager, 29 input_method::InputMethodManager *manager,
30 bool show_message) { 30 bool show_message) {
31 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 31 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
32 32
33 if (!router->HasEventListener( 33 if (!router->HasEventListener(
34 extensions::InputMethodAPI::kOnInputMethodChanged)) { 34 extensions::InputMethodAPI::kOnInputMethodChanged)) {
35 return; 35 return;
36 } 36 }
37 37
38 scoped_ptr<base::ListValue> args(new base::ListValue()); 38 scoped_ptr<base::ListValue> args(new base::ListValue());
39 base::StringValue *input_method_name = new base::StringValue( 39 base::StringValue* input_method_name =
40 extensions::InputMethodAPI::GetInputMethodForXkb( 40 new base::StringValue(extensions::InputMethodAPI::GetInputMethodForXkb(
41 manager->GetCurrentInputMethod().id())); 41 manager->GetActiveIMEState()->GetCurrentInputMethod().id()));
42 args->Append(input_method_name); 42 args->Append(input_method_name);
43 43
44 // The router will only send the event to extensions that are listening. 44 // The router will only send the event to extensions that are listening.
45 scoped_ptr<extensions::Event> event(new extensions::Event( 45 scoped_ptr<extensions::Event> event(new extensions::Event(
46 extensions::InputMethodAPI::kOnInputMethodChanged, args.Pass())); 46 extensions::InputMethodAPI::kOnInputMethodChanged, args.Pass()));
47 event->restrict_to_browser_context = context_; 47 event->restrict_to_browser_context = context_;
48 router->BroadcastEvent(event.Pass()); 48 router->BroadcastEvent(event.Pass());
49 } 49 }
50 50
51 } // namespace chromeos 51 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698