Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/memory/singleton.h" | |
| 12 #include "base/scoped_ptr.h" | |
| 13 #include "chrome/browser/extensions/extension_function.h" | |
| 14 | |
| 15 class ImeUiController; | |
| 16 class ListValue; | |
| 17 class Profile; | |
| 18 | |
| 19 namespace chromeos { | |
| 20 class InputMethodLookupTable; | |
| 21 } | |
| 22 | |
| 23 class ExtensionImeUiEventRouter { | |
| 24 public: | |
| 25 static ExtensionImeUiEventRouter* GetInstance(); | |
| 26 void Init(); | |
| 27 | |
| 28 private: | |
| 29 friend class ImeUiController; | |
| 30 friend class CandidateClickedImeUiFunction; | |
| 31 friend class CursorUpImeUiFunction; | |
| 32 friend class CursorDownImeUiFunction; | |
| 33 friend class PageUpImeUiFunction; | |
| 34 friend class PageDownImeUiFunction; | |
| 35 friend class RegisterImeUiFunction; | |
| 36 friend struct DefaultSingletonTraits<ExtensionImeUiEventRouter>; | |
| 37 | |
| 38 ExtensionImeUiEventRouter(); | |
| 39 virtual ~ExtensionImeUiEventRouter(); | |
| 40 | |
| 41 void Register(Profile* profile, const std::string& extension_id); | |
| 42 void CandidateClicked(Profile* profile, | |
| 43 const std::string& extension_id, int index, int button); | |
| 44 void CursorUp(Profile* profile, const std::string& extension_id); | |
| 45 void CursorDown(Profile* profile, const std::string& extension_id); | |
| 46 void PageUp(Profile* profile, const std::string& extension_id); | |
| 47 void PageDown(Profile* profile, const std::string& extension_id); | |
| 48 | |
| 49 void OnHideAuxiliaryText(); | |
| 50 void OnHideLookupTable(); | |
| 51 void OnSetCursorLocation(int x, int y, int width, int height); | |
| 52 void OnUpdateAuxiliaryText(const std::string& utf8_text); | |
| 53 void OnUpdateLookupTable( | |
| 54 const chromeos::InputMethodLookupTable& lookup_table); | |
| 55 | |
| 56 void DispatchEvent(Profile* profile, | |
| 57 const char* event_name, | |
| 58 const std::string& json_args); | |
| 59 | |
| 60 Profile* profile_; | |
| 61 std::string extension_id_; | |
| 62 ImeUiController* ime_ui_controller_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(ExtensionImeUiEventRouter); | |
| 65 }; | |
| 66 | |
| 67 // Base class for input APIs. | |
| 68 class ImeUiFunction : public AsyncExtensionFunction { | |
|
Yusuke Sato
2011/04/18 08:21:29
The ImeUiFunction class looks exactly the same as
Peng
2011/04/18 14:35:38
Done.
| |
| 69 public: | |
| 70 virtual void Run(); | |
| 71 virtual bool RunImpl() = 0; | |
| 72 }; | |
| 73 | |
| 74 // Note that this experimental API is currently only available for | |
| 75 // TOOLKIT_VIEWS (see chrome/chrome_browser.gypi). | |
| 76 // | |
| 77 // We may eventually support other platforms by adding the necessary | |
| 78 // synthetic event distribution code to this Function. | |
| 79 class RegisterImeUiFunction : public ImeUiFunction { | |
| 80 public: | |
| 81 virtual bool RunImpl(); | |
| 82 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.register"); | |
| 83 }; | |
| 84 | |
| 85 class CandidateClickedImeUiFunction : public ImeUiFunction { | |
| 86 public: | |
| 87 virtual bool RunImpl(); | |
| 88 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.candidateClicked"); | |
| 89 }; | |
| 90 | |
| 91 class CursorUpImeUiFunction : public ImeUiFunction { | |
| 92 public: | |
| 93 virtual bool RunImpl(); | |
| 94 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.cursorUp"); | |
| 95 }; | |
| 96 | |
| 97 class CursorDownImeUiFunction : public ImeUiFunction { | |
| 98 public: | |
| 99 virtual bool RunImpl(); | |
| 100 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.cursorDown"); | |
| 101 }; | |
| 102 | |
| 103 class PageUpImeUiFunction : public ImeUiFunction { | |
| 104 public: | |
| 105 virtual bool RunImpl(); | |
| 106 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.pageUp"); | |
| 107 }; | |
| 108 | |
| 109 class PageDownImeUiFunction : public ImeUiFunction { | |
| 110 public: | |
| 111 virtual bool RunImpl(); | |
| 112 DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.pageDown"); | |
| 113 }; | |
| 114 | |
| 115 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_ | |
| OLD | NEW |