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

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

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years 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 | Annotate | Revision Log
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 30 matching lines...) Expand all
41 41
42 if (!router->HasEventListener(extensions::event_names::kOnInputMethodChanged)) 42 if (!router->HasEventListener(extensions::event_names::kOnInputMethodChanged))
43 return; 43 return;
44 44
45 scoped_ptr<ListValue> args(new ListValue()); 45 scoped_ptr<ListValue> args(new ListValue());
46 StringValue *input_method_name = new StringValue( 46 StringValue *input_method_name = new StringValue(
47 GetInputMethodForXkb(manager->GetCurrentInputMethod().id())); 47 GetInputMethodForXkb(manager->GetCurrentInputMethod().id()));
48 args->Append(input_method_name); 48 args->Append(input_method_name);
49 49
50 // The router will only send the event to extensions that are listening. 50 // The router will only send the event to extensions that are listening.
51 router->DispatchEventToRenderers( 51 scoped_ptr<extensions::Event> event(new extensions::Event(
52 extensions::event_names::kOnInputMethodChanged, args.Pass(), profile, 52 extensions::event_names::kOnInputMethodChanged, args.Pass()));
53 GURL()); 53 event->restrict_to_profile = profile;
54 extensions::ExtensionSystem::Get(profile)->event_router()->
55 BroadcastEvent(event.Pass());
54 } 56 }
55 57
56 std::string ExtensionInputMethodEventRouter::GetInputMethodForXkb( 58 std::string ExtensionInputMethodEventRouter::GetInputMethodForXkb(
57 const std::string& xkb_id) { 59 const std::string& xkb_id) {
58 size_t prefix_length = std::string(kXkbPrefix).length(); 60 size_t prefix_length = std::string(kXkbPrefix).length();
59 DCHECK(xkb_id.substr(0, prefix_length) == kXkbPrefix); 61 DCHECK(xkb_id.substr(0, prefix_length) == kXkbPrefix);
60 return xkb_id.substr(prefix_length); 62 return xkb_id.substr(prefix_length);
61 } 63 }
62 64
63 } // namespace chromeos 65 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698