| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/input_method/input_method_engine_base.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" | 19 #include "components/keyed_service/core/keyed_service.h" |
| 19 #include "extensions/browser/browser_context_keyed_api_factory.h" | 20 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 20 #include "extensions/browser/event_router.h" | 21 #include "extensions/browser/event_router.h" |
| 21 #include "extensions/browser/extension_function.h" | 22 #include "extensions/browser/extension_function.h" |
| 22 #include "extensions/browser/extension_registry_observer.h" | 23 #include "extensions/browser/extension_registry_observer.h" |
| 23 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 24 #include "ui/base/ime/ime_engine_handler_interface.h" | 25 #include "ui/base/ime/ime_engine_handler_interface.h" |
| 25 #include "ui/base/ime/ime_engine_observer.h" | |
| 26 #include "ui/base/ime/text_input_flags.h" | 26 #include "ui/base/ime/text_input_flags.h" |
| 27 | 27 |
| 28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 29 #include "chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h" | 29 #include "chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.h" |
| 30 #elif defined(OS_LINUX) || defined(OS_WIN) | 30 #elif defined(OS_LINUX) || defined(OS_WIN) |
| 31 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" | 31 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" |
| 32 #endif // defined(OS_CHROMEOS) | 32 #endif // defined(OS_CHROMEOS) |
| 33 | 33 |
| 34 class Profile; | 34 class Profile; |
| 35 | 35 |
| 36 namespace ui { | 36 namespace ui { |
| 37 class IMEEngineHandlerInterface; | 37 class IMEEngineHandlerInterface; |
| 38 class IMEEngineObserver; | |
| 39 | 38 |
| 40 class ImeObserver : public IMEEngineObserver { | 39 class ImeObserver : public input_method::InputMethodEngineBase::Observer { |
| 41 public: | 40 public: |
| 42 ImeObserver(const std::string& extension_id, Profile* profile); | 41 ImeObserver(const std::string& extension_id, Profile* profile); |
| 43 | 42 |
| 44 ~ImeObserver() override {} | 43 ~ImeObserver() override {} |
| 45 | 44 |
| 46 // IMEEngineObserver overrides. | 45 // input_method::InputMethodEngineBase::Observer overrides. |
| 47 void OnActivate(const std::string& component_id) override; | 46 void OnActivate(const std::string& component_id) override; |
| 48 void OnFocus(const IMEEngineHandlerInterface::InputContext& context) override; | 47 void OnFocus(const IMEEngineHandlerInterface::InputContext& context) override; |
| 49 void OnBlur(int context_id) override; | 48 void OnBlur(int context_id) override; |
| 50 void OnKeyEvent( | 49 void OnKeyEvent( |
| 51 const std::string& component_id, | 50 const std::string& component_id, |
| 52 const IMEEngineHandlerInterface::KeyboardEvent& event, | 51 const input_method::InputMethodEngineBase::KeyboardEvent& event, |
| 53 IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) override; | 52 IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) override; |
| 54 void OnReset(const std::string& component_id) override; | 53 void OnReset(const std::string& component_id) override; |
| 55 void OnDeactivated(const std::string& component_id) override; | 54 void OnDeactivated(const std::string& component_id) override; |
| 56 void OnCompositionBoundsChanged( | 55 void OnCompositionBoundsChanged( |
| 57 const std::vector<gfx::Rect>& bounds) override; | 56 const std::vector<gfx::Rect>& bounds) override; |
| 58 bool IsInterestedInKeyEvent() const override; | 57 bool IsInterestedInKeyEvent() const override; |
| 59 void OnSurroundingTextChanged(const std::string& component_id, | 58 void OnSurroundingTextChanged(const std::string& component_id, |
| 60 const std::string& text, | 59 const std::string& text, |
| 61 int cursor_pos, | 60 int cursor_pos, |
| 62 int anchor_pos, | 61 int anchor_pos, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Listen to extension load, unloaded notifications. | 163 // Listen to extension load, unloaded notifications. |
| 165 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 164 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 166 extension_registry_observer_; | 165 extension_registry_observer_; |
| 167 }; | 166 }; |
| 168 | 167 |
| 169 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); | 168 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); |
| 170 | 169 |
| 171 } // namespace extensions | 170 } // namespace extensions |
| 172 | 171 |
| 173 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 172 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |