| 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/profiler/scoped_profile.h" | |
| 8 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/values.h" | 8 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 9 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 11 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 10 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 11 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 13 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 12 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/common/extensions/api/input_ime.h" | 16 #include "chrome/common/extensions/api/input_ime.h" |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 UnloadedExtensionInfo::Reason reason) { | 844 UnloadedExtensionInfo::Reason reason) { |
| 846 const std::vector<InputComponentInfo>* input_components = | 845 const std::vector<InputComponentInfo>* input_components = |
| 847 extensions::InputComponents::GetInputComponents(extension); | 846 extensions::InputComponents::GetInputComponents(extension); |
| 848 if (!input_components) | 847 if (!input_components) |
| 849 return; | 848 return; |
| 850 if (input_components->size() > 0) | 849 if (input_components->size() > 0) |
| 851 input_ime_event_router()->UnregisterAllImes(extension->id()); | 850 input_ime_event_router()->UnregisterAllImes(extension->id()); |
| 852 } | 851 } |
| 853 | 852 |
| 854 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { | 853 void InputImeAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 855 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | |
| 856 tracked_objects::ScopedProfile tracking_profile( | |
| 857 FROM_HERE_WITH_EXPLICIT_FUNCTION("InputImeAPI::OnListenerAdded")); | |
| 858 | |
| 859 InputMethodEngineInterface* engine = | 854 InputMethodEngineInterface* engine = |
| 860 input_ime_event_router()->GetActiveEngine(details.extension_id); | 855 input_ime_event_router()->GetActiveEngine(details.extension_id); |
| 861 // Notifies the IME extension for IME ready with onActivate/onFocus events. | 856 // Notifies the IME extension for IME ready with onActivate/onFocus events. |
| 862 if (engine) | 857 if (engine) |
| 863 engine->Enable(engine->GetActiveComponentId()); | 858 engine->Enable(engine->GetActiveComponentId()); |
| 864 } | 859 } |
| 865 | 860 |
| 866 InputImeEventRouter* InputImeAPI::input_ime_event_router() { | 861 InputImeEventRouter* InputImeAPI::input_ime_event_router() { |
| 867 return InputImeEventRouter::GetInstance(); | 862 return InputImeEventRouter::GetInstance(); |
| 868 } | 863 } |
| 869 | 864 |
| 870 } // namespace extensions | 865 } // namespace extensions |
| OLD | NEW |