OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 const input_method::InputMethodDescriptor ¤t_input_method, | 67 const input_method::InputMethodDescriptor ¤t_input_method, |
68 size_t num_active_input_methods) { | 68 size_t num_active_input_methods) { |
69 Profile *profile = ProfileManager::GetDefaultProfile(); | 69 Profile *profile = ProfileManager::GetDefaultProfile(); |
70 ExtensionEventRouter *router = profile->GetExtensionEventRouter(); | 70 ExtensionEventRouter *router = profile->GetExtensionEventRouter(); |
71 | 71 |
72 if (!router->HasEventListener(extension_event_names::kOnInputMethodChanged)) | 72 if (!router->HasEventListener(extension_event_names::kOnInputMethodChanged)) |
73 return; | 73 return; |
74 | 74 |
75 ListValue args; | 75 ListValue args; |
76 StringValue *input_method_name = | 76 StringValue *input_method_name = |
77 new StringValue(GetInputMethodForXkb(current_input_method.id())); | 77 base::StringValue::New(GetInputMethodForXkb(current_input_method.id())); |
78 args.Append(input_method_name); | 78 args.Append(input_method_name); |
79 std::string args_json; | 79 std::string args_json; |
80 base::JSONWriter::Write(&args, false, &args_json); | 80 base::JSONWriter::Write(&args, false, &args_json); |
81 | 81 |
82 const std::vector<std::string>& ids = | 82 const std::vector<std::string>& ids = |
83 g_input_method_private_extensions_whitelist.Get().ids(); | 83 g_input_method_private_extensions_whitelist.Get().ids(); |
84 | 84 |
85 for (size_t i = 0; i < ids.size(); ++i) { | 85 for (size_t i = 0; i < ids.size(); ++i) { |
86 // ExtensionEventRoutner will check that the extension is listening for the | 86 // ExtensionEventRoutner will check that the extension is listening for the |
87 // event. | 87 // event. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return xkb_id.substr(prefix_length); | 120 return xkb_id.substr(prefix_length); |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
124 bool ExtensionInputMethodEventRouter::IsExtensionWhitelisted( | 124 bool ExtensionInputMethodEventRouter::IsExtensionWhitelisted( |
125 const std::string& extension_id) { | 125 const std::string& extension_id) { |
126 return g_input_method_private_extensions_whitelist.Get().HasId(extension_id); | 126 return g_input_method_private_extensions_whitelist.Get().HasId(extension_id); |
127 } | 127 } |
128 | 128 |
129 } // namespace chromeos | 129 } // namespace chromeos |
OLD | NEW |