| 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/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 engine_ix != engine_list->second.end(); | 409 engine_ix != engine_list->second.end(); |
| 410 ++engine_ix) { | 410 ++engine_ix) { |
| 411 if (engine_ix->second->IsActive()) { | 411 if (engine_ix->second->IsActive()) { |
| 412 return engine_ix->second; | 412 return engine_ix->second; |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 return NULL; | 416 return NULL; |
| 417 } | 417 } |
| 418 | 418 |
| 419 void InputImeEventRouter::OnEventHandled( | 419 void InputImeEventRouter::OnKeyEventHandled( |
| 420 const std::string& extension_id, | 420 const std::string& extension_id, |
| 421 const std::string& request_id, | 421 const std::string& request_id, |
| 422 bool handled) { | 422 bool handled) { |
| 423 RequestMap::iterator request = request_map_.find(request_id); | 423 RequestMap::iterator request = request_map_.find(request_id); |
| 424 if (request == request_map_.end()) { | 424 if (request == request_map_.end()) { |
| 425 LOG(ERROR) << "Request ID not found: " << request_id; | 425 LOG(ERROR) << "Request ID not found: " << request_id; |
| 426 return; | 426 return; |
| 427 } | 427 } |
| 428 | 428 |
| 429 std::string engine_id = request->second.first; | 429 std::string engine_id = request->second.first; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 | 801 |
| 802 std::vector<chromeos::InputMethodEngine::MenuItem> menu_items; | 802 std::vector<chromeos::InputMethodEngine::MenuItem> menu_items; |
| 803 EXTENSION_FUNCTION_VALIDATE(ReadMenuItems(items, &menu_items)); | 803 EXTENSION_FUNCTION_VALIDATE(ReadMenuItems(items, &menu_items)); |
| 804 | 804 |
| 805 if (!engine->UpdateMenuItems(menu_items)) { | 805 if (!engine->UpdateMenuItems(menu_items)) { |
| 806 error_ = kErrorUpdateMenuItemsFail; | 806 error_ = kErrorUpdateMenuItemsFail; |
| 807 } | 807 } |
| 808 return true; | 808 return true; |
| 809 } | 809 } |
| 810 | 810 |
| 811 bool InputEventHandled::RunImpl() { | 811 bool KeyEventHandled::RunImpl() { |
| 812 std::string request_id_str; | 812 std::string request_id_str; |
| 813 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &request_id_str)); | 813 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &request_id_str)); |
| 814 | 814 |
| 815 bool handled = false; | 815 bool handled = false; |
| 816 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &handled)); | 816 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &handled)); |
| 817 | 817 |
| 818 InputImeEventRouter::GetInstance()->OnEventHandled( | 818 InputImeEventRouter::GetInstance()->OnKeyEventHandled( |
| 819 extension_id(), request_id_str, handled); | 819 extension_id(), request_id_str, handled); |
| 820 | 820 |
| 821 return true; | 821 return true; |
| 822 } | 822 } |
| 823 #endif | 823 #endif |
| 824 | 824 |
| 825 } // namespace extensions | 825 } // namespace extensions |
| OLD | NEW |