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_INPUT_UI_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INPUT_UI_API_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/singleton.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/extensions/extension_function.h" |
| 14 |
| 15 class InputUiController; |
| 16 class ListValue; |
| 17 class Profile; |
| 18 |
| 19 namespace chromeos { |
| 20 class InputMethodLookupTable; |
| 21 } |
| 22 |
| 23 class ExtensionInputUiEventRouter { |
| 24 public: |
| 25 static ExtensionInputUiEventRouter* GetInstance(); |
| 26 void Init(); |
| 27 |
| 28 private: |
| 29 friend class InputUiController; |
| 30 friend class CandidateClickedInputUiFunction; |
| 31 friend class CursorUpInputUiFunction; |
| 32 friend class CursorDownInputUiFunction; |
| 33 friend class PageUpInputUiFunction; |
| 34 friend class PageDownInputUiFunction; |
| 35 friend class RegisterInputUiFunction; |
| 36 friend struct DefaultSingletonTraits<ExtensionInputUiEventRouter>; |
| 37 |
| 38 ExtensionInputUiEventRouter(); |
| 39 ~ExtensionInputUiEventRouter(); |
| 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 scoped_ptr<InputUiController> ui_controller_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ExtensionInputUiEventRouter); |
| 65 }; |
| 66 |
| 67 class RegisterInputUiFunction : public SyncExtensionFunction { |
| 68 public: |
| 69 virtual bool RunImpl(); |
| 70 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.register"); |
| 71 }; |
| 72 |
| 73 class CandidateClickedInputUiFunction : public SyncExtensionFunction { |
| 74 public: |
| 75 virtual bool RunImpl(); |
| 76 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.candidateClicked"); |
| 77 }; |
| 78 |
| 79 class CursorUpInputUiFunction : public SyncExtensionFunction { |
| 80 public: |
| 81 virtual bool RunImpl(); |
| 82 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.cursorUp"); |
| 83 }; |
| 84 |
| 85 class CursorDownInputUiFunction : public SyncExtensionFunction { |
| 86 public: |
| 87 virtual bool RunImpl(); |
| 88 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.cursorDown"); |
| 89 }; |
| 90 |
| 91 class PageUpInputUiFunction : public SyncExtensionFunction { |
| 92 public: |
| 93 virtual bool RunImpl(); |
| 94 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.pageUp"); |
| 95 }; |
| 96 |
| 97 class PageDownInputUiFunction : public SyncExtensionFunction { |
| 98 public: |
| 99 virtual bool RunImpl(); |
| 100 DECLARE_EXTENSION_FUNCTION_NAME("experimental.inputUI.pageDown"); |
| 101 }; |
| 102 |
| 103 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INPUT_UI_API_H_ |
OLD | NEW |