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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 args->Append(Value::CreateStringValue(engine_id)); | 298 args->Append(Value::CreateStringValue(engine_id)); |
299 args->Append(Value::CreateStringValue(menu_id)); | 299 args->Append(Value::CreateStringValue(menu_id)); |
300 | 300 |
301 DispatchEventToExtension(profile_, extension_id_, | 301 DispatchEventToExtension(profile_, extension_id_, |
302 events::kOnMenuItemActivated, args.Pass()); | 302 events::kOnMenuItemActivated, args.Pass()); |
303 } | 303 } |
304 | 304 |
305 virtual void OnSurroundingTextChanged(const std::string& engine_id, | 305 virtual void OnSurroundingTextChanged(const std::string& engine_id, |
306 const std::string& text, | 306 const std::string& text, |
307 int cursor_pos, | 307 int cursor_pos, |
308 int anchor_pos) { | 308 int anchor_pos) OVERRIDE { |
309 if (profile_ == NULL || extension_id_.empty()) | 309 if (profile_ == NULL || extension_id_.empty()) |
310 return; | 310 return; |
311 DictionaryValue* dict = new DictionaryValue(); | 311 DictionaryValue* dict = new DictionaryValue(); |
312 dict->SetString("text", text); | 312 dict->SetString("text", text); |
313 dict->SetInteger("focus", cursor_pos); | 313 dict->SetInteger("focus", cursor_pos); |
314 dict->SetInteger("anchor", anchor_pos); | 314 dict->SetInteger("anchor", anchor_pos); |
315 | 315 |
316 scoped_ptr<ListValue> args(new ListValue); | 316 scoped_ptr<ListValue> args(new ListValue); |
317 args->Append(Value::CreateStringValue(engine_id)); | 317 args->Append(Value::CreateStringValue(engine_id)); |
318 args->Append(dict); | 318 args->Append(dict); |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); | 947 input_ime_event_router()->UnregisterAllImes(profile_, extension->id()); |
948 } | 948 } |
949 } | 949 } |
950 } | 950 } |
951 | 951 |
952 InputImeEventRouter* InputImeAPI::input_ime_event_router() { | 952 InputImeEventRouter* InputImeAPI::input_ime_event_router() { |
953 return InputImeEventRouter::GetInstance(); | 953 return InputImeEventRouter::GetInstance(); |
954 } | 954 } |
955 | 955 |
956 } // namespace extensions | 956 } // namespace extensions |
OLD | NEW |