| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 std::vector<chromeos::InputMethodEngine::MenuItem> menu_items; | 814 std::vector<chromeos::InputMethodEngine::MenuItem> menu_items; |
| 815 EXTENSION_FUNCTION_VALIDATE(ReadMenuItems(items, &menu_items)); | 815 EXTENSION_FUNCTION_VALIDATE(ReadMenuItems(items, &menu_items)); |
| 816 | 816 |
| 817 if (!engine->UpdateMenuItems(menu_items)) { | 817 if (!engine->UpdateMenuItems(menu_items)) { |
| 818 error_ = kErrorUpdateMenuItemsFail; | 818 error_ = kErrorUpdateMenuItemsFail; |
| 819 } | 819 } |
| 820 return true; | 820 return true; |
| 821 } | 821 } |
| 822 | 822 |
| 823 bool InputEventHandled::RunImpl() { | 823 bool KeyEventHandled::RunImpl() { |
| 824 std::string request_id_str; | 824 std::string request_id_str; |
| 825 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &request_id_str)); | 825 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &request_id_str)); |
| 826 | 826 |
| 827 bool handled = false; | 827 bool handled = false; |
| 828 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &handled)); | 828 EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &handled)); |
| 829 | 829 |
| 830 InputImeEventRouter::GetInstance()->OnEventHandled( | 830 InputImeEventRouter::GetInstance()->OnKeyEventHandled( |
| 831 extension_id(), request_id_str, handled); | 831 extension_id(), request_id_str, handled); |
| 832 | 832 |
| 833 return true; | 833 return true; |
| 834 } | 834 } |
| 835 #endif | 835 #endif |
| 836 | 836 |
| 837 } // namespace extensions | 837 } // namespace extensions |
| OLD | NEW |