| 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/chromeos/extensions/input_method_api.h" | 5 #include "chrome/browser/chromeos/extensions/input_method_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/profiler/scoped_profile.h" | |
| 9 #include "base/values.h" | 8 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
| 11 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 12 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" | 11 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
| 13 #include "chromeos/ime/extension_ime_util.h" | 12 #include "chromeos/ime/extension_ime_util.h" |
| 14 #include "chromeos/ime/input_method_descriptor.h" | 13 #include "chromeos/ime/input_method_descriptor.h" |
| 15 #include "chromeos/ime/input_method_manager.h" | 14 #include "chromeos/ime/input_method_manager.h" |
| 16 #include "extensions/browser/extension_function_registry.h" | 15 #include "extensions/browser/extension_function_registry.h" |
| 17 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 18 #include "extensions/common/value_builder.h" | 17 #include "extensions/common/value_builder.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 109 } |
| 111 | 110 |
| 112 void InputMethodAPI::Shutdown() { | 111 void InputMethodAPI::Shutdown() { |
| 113 // UnregisterObserver may have already been called in OnListenerAdded, | 112 // UnregisterObserver may have already been called in OnListenerAdded, |
| 114 // but it is safe to call it more than once. | 113 // but it is safe to call it more than once. |
| 115 EventRouter::Get(context_)->UnregisterObserver(this); | 114 EventRouter::Get(context_)->UnregisterObserver(this); |
| 116 } | 115 } |
| 117 | 116 |
| 118 void InputMethodAPI::OnListenerAdded( | 117 void InputMethodAPI::OnListenerAdded( |
| 119 const extensions::EventListenerInfo& details) { | 118 const extensions::EventListenerInfo& details) { |
| 120 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | |
| 121 tracked_objects::ScopedProfile tracking_profile( | |
| 122 FROM_HERE_WITH_EXPLICIT_FUNCTION("InputMethodAPI::OnListenerAdded")); | |
| 123 | |
| 124 DCHECK(!input_method_event_router_.get()); | 119 DCHECK(!input_method_event_router_.get()); |
| 125 input_method_event_router_.reset( | 120 input_method_event_router_.reset( |
| 126 new chromeos::ExtensionInputMethodEventRouter(context_)); | 121 new chromeos::ExtensionInputMethodEventRouter(context_)); |
| 127 EventRouter::Get(context_)->UnregisterObserver(this); | 122 EventRouter::Get(context_)->UnregisterObserver(this); |
| 128 } | 123 } |
| 129 | 124 |
| 130 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > | 125 static base::LazyInstance<BrowserContextKeyedAPIFactory<InputMethodAPI> > |
| 131 g_factory = LAZY_INSTANCE_INITIALIZER; | 126 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 132 | 127 |
| 133 // static | 128 // static |
| 134 BrowserContextKeyedAPIFactory<InputMethodAPI>* | 129 BrowserContextKeyedAPIFactory<InputMethodAPI>* |
| 135 InputMethodAPI::GetFactoryInstance() { | 130 InputMethodAPI::GetFactoryInstance() { |
| 136 return g_factory.Pointer(); | 131 return g_factory.Pointer(); |
| 137 } | 132 } |
| 138 | 133 |
| 139 } // namespace extensions | 134 } // namespace extensions |
| OLD | NEW |