| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class IMEEngineHandlerInterface; | 35 class IMEEngineHandlerInterface; |
| 36 class IMEEngineObserver; | 36 class IMEEngineObserver; |
| 37 | 37 |
| 38 class ImeObserver : public IMEEngineObserver { | 38 class ImeObserver : public IMEEngineObserver { |
| 39 public: | 39 public: |
| 40 ImeObserver(const std::string& extension_id, Profile* profile); | 40 ImeObserver(const std::string& extension_id, Profile* profile); |
| 41 | 41 |
| 42 ~ImeObserver() override {} | 42 ~ImeObserver() override {} |
| 43 | 43 |
| 44 // IMEEngineObserver overrides. | 44 // IMEEngineObserver overrides. |
| 45 void OnActivate(const std::string& component_id) override; |
| 45 void OnFocus(const IMEEngineHandlerInterface::InputContext& context) override; | 46 void OnFocus(const IMEEngineHandlerInterface::InputContext& context) override; |
| 46 void OnBlur(int context_id) override; | 47 void OnBlur(int context_id) override; |
| 47 void OnKeyEvent( | 48 void OnKeyEvent( |
| 48 const std::string& component_id, | 49 const std::string& component_id, |
| 49 const IMEEngineHandlerInterface::KeyboardEvent& event, | 50 const IMEEngineHandlerInterface::KeyboardEvent& event, |
| 50 IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) override; | 51 IMEEngineHandlerInterface::KeyEventDoneCallback& key_data) override; |
| 51 void OnReset(const std::string& component_id) override; | 52 void OnReset(const std::string& component_id) override; |
| 52 void OnDeactivated(const std::string& component_id) override; | 53 void OnDeactivated(const std::string& component_id) override; |
| 53 void OnCompositionBoundsChanged( | 54 void OnCompositionBoundsChanged( |
| 54 const std::vector<gfx::Rect>& bounds) override; | 55 const std::vector<gfx::Rect>& bounds) override; |
| 56 bool IsInterestedInKeyEvent() const override; |
| 57 void OnSurroundingTextChanged(const std::string& component_id, |
| 58 const std::string& text, |
| 59 int cursor_pos, |
| 60 int anchor_pos, |
| 61 int offset_pos) override; |
| 55 | 62 |
| 56 protected: | 63 protected: |
| 57 // Helper function used to forward the given event to the |profile_|'s event | 64 // Helper function used to forward the given event to the |profile_|'s event |
| 58 // router, which dipatches the event the extension with |extension_id_|. | 65 // router, which dipatches the event the extension with |extension_id_|. |
| 59 virtual void DispatchEventToExtension( | 66 virtual void DispatchEventToExtension( |
| 60 extensions::events::HistogramValue histogram_value, | 67 extensions::events::HistogramValue histogram_value, |
| 61 const std::string& event_name, | 68 const std::string& event_name, |
| 62 scoped_ptr<base::ListValue> args) = 0; | 69 scoped_ptr<base::ListValue> args) = 0; |
| 63 | 70 |
| 71 // Returns the type of the current screen. |
| 72 virtual std::string GetCurrentScreenType() = 0; |
| 73 |
| 64 // Returns true if the extension is ready to accept key event, otherwise | 74 // Returns true if the extension is ready to accept key event, otherwise |
| 65 // returns false. | 75 // returns false. |
| 66 bool ShouldForwardKeyEvent() const; | 76 bool ShouldForwardKeyEvent() const; |
| 67 | 77 |
| 68 // Returns true if there are any listeners on the given event. | 78 // Returns true if there are any listeners on the given event. |
| 69 bool HasListener(const std::string& event_name) const; | 79 bool HasListener(const std::string& event_name) const; |
| 70 | 80 |
| 71 // Functions used to convert InputContext struct to string | 81 // Functions used to convert InputContext struct to string |
| 72 std::string ConvertInputContextType( | 82 std::string ConvertInputContextType( |
| 73 IMEEngineHandlerInterface::InputContext input_context); | 83 IMEEngineHandlerInterface::InputContext input_context); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Listen to extension load, unloaded notifications. | 203 // Listen to extension load, unloaded notifications. |
| 194 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 204 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 195 extension_registry_observer_; | 205 extension_registry_observer_; |
| 196 }; | 206 }; |
| 197 | 207 |
| 198 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); | 208 InputImeEventRouter* GetInputImeEventRouter(Profile* profile); |
| 199 | 209 |
| 200 } // namespace extensions | 210 } // namespace extensions |
| 201 | 211 |
| 202 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 212 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
| OLD | NEW |