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/extensions/api/input_ime/input_ime_api.h" | 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return; | 239 return; |
240 | 240 |
241 std::string request_id = | 241 std::string request_id = |
242 extensions::InputImeEventRouter::GetInstance()->AddRequest(engine_id, | 242 extensions::InputImeEventRouter::GetInstance()->AddRequest(engine_id, |
243 key_data); | 243 key_data); |
244 | 244 |
245 DictionaryValue* dict = new DictionaryValue(); | 245 DictionaryValue* dict = new DictionaryValue(); |
246 dict->SetString("type", event.type); | 246 dict->SetString("type", event.type); |
247 dict->SetString("requestId", request_id); | 247 dict->SetString("requestId", request_id); |
248 dict->SetString("key", event.key); | 248 dict->SetString("key", event.key); |
| 249 dict->SetString("code", event.code); |
249 dict->SetBoolean("altKey", event.alt_key); | 250 dict->SetBoolean("altKey", event.alt_key); |
250 dict->SetBoolean("ctrlKey", event.ctrl_key); | 251 dict->SetBoolean("ctrlKey", event.ctrl_key); |
251 dict->SetBoolean("shiftKey", event.shift_key); | 252 dict->SetBoolean("shiftKey", event.shift_key); |
252 | 253 |
253 scoped_ptr<base::ListValue> args(new ListValue()); | 254 scoped_ptr<base::ListValue> args(new ListValue()); |
254 args->Append(Value::CreateStringValue(engine_id)); | 255 args->Append(Value::CreateStringValue(engine_id)); |
255 args->Append(dict); | 256 args->Append(dict); |
256 | 257 |
257 DispatchEventToExtension(profile_, extension_id_, | 258 DispatchEventToExtension(profile_, extension_id_, |
258 events::kOnKeyEvent, args.Pass()); | 259 events::kOnKeyEvent, args.Pass()); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); | 902 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); |
902 } | 903 } |
903 } | 904 } |
904 } | 905 } |
905 | 906 |
906 InputImeEventRouter* InputImeAPI::input_ime_event_router() { | 907 InputImeEventRouter* InputImeAPI::input_ime_event_router() { |
907 return InputImeEventRouter::GetInstance(); | 908 return InputImeEventRouter::GetInstance(); |
908 } | 909 } |
909 | 910 |
910 } // namespace extensions | 911 } // namespace extensions |
OLD | NEW |