OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
11 #include "extensions/browser/event_router.h" | 11 #include "extensions/browser/event_router.h" |
12 #include "extensions/browser/extension_function.h" | 12 #include "extensions/browser/extension_function.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 class ExtensionInputMethodEventRouter; | 15 class ExtensionInputMethodEventRouter; |
16 } | 16 } |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
| 20 // Implements the inputMethodPrivate.getInputMethodConfig method. |
| 21 class GetInputMethodConfigFunction : public UIThreadExtensionFunction { |
| 22 public: |
| 23 GetInputMethodConfigFunction() {} |
| 24 |
| 25 protected: |
| 26 virtual ~GetInputMethodConfigFunction() {} |
| 27 |
| 28 virtual ResponseAction Run() override; |
| 29 |
| 30 private: |
| 31 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getInputMethodConfig", |
| 32 INPUTMETHODPRIVATE_GETINPUTMETHODCONFIG) |
| 33 DISALLOW_COPY_AND_ASSIGN(GetInputMethodConfigFunction); |
| 34 }; |
| 35 |
20 // Implements the inputMethodPrivate.getCurrentInputMethod method. | 36 // Implements the inputMethodPrivate.getCurrentInputMethod method. |
21 class GetCurrentInputMethodFunction : public UIThreadExtensionFunction { | 37 class GetCurrentInputMethodFunction : public UIThreadExtensionFunction { |
22 public: | 38 public: |
23 GetCurrentInputMethodFunction() {} | 39 GetCurrentInputMethodFunction() {} |
24 | 40 |
25 protected: | 41 protected: |
26 virtual ~GetCurrentInputMethodFunction() {} | 42 virtual ~GetCurrentInputMethodFunction() {} |
27 | 43 |
28 virtual ResponseAction Run() override; | 44 virtual ResponseAction Run() override; |
29 | 45 |
30 private: | 46 private: |
31 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getCurrentInputMethod", | 47 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getCurrentInputMethod", |
32 INPUTMETHODPRIVATE_GETCURRENTINPUTMETHOD) | 48 INPUTMETHODPRIVATE_GETCURRENTINPUTMETHOD) |
| 49 DISALLOW_COPY_AND_ASSIGN(GetCurrentInputMethodFunction); |
33 }; | 50 }; |
34 | 51 |
35 // Implements the inputMethodPrivate.setCurrentInputMethod method. | 52 // Implements the inputMethodPrivate.setCurrentInputMethod method. |
36 class SetCurrentInputMethodFunction : public UIThreadExtensionFunction { | 53 class SetCurrentInputMethodFunction : public UIThreadExtensionFunction { |
37 public: | 54 public: |
38 SetCurrentInputMethodFunction() {} | 55 SetCurrentInputMethodFunction() {} |
39 | 56 |
40 protected: | 57 protected: |
41 virtual ~SetCurrentInputMethodFunction() {} | 58 virtual ~SetCurrentInputMethodFunction() {} |
42 | 59 |
43 virtual ResponseAction Run() override; | 60 virtual ResponseAction Run() override; |
44 | 61 |
45 private: | 62 private: |
46 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.setCurrentInputMethod", | 63 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.setCurrentInputMethod", |
47 INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD) | 64 INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD) |
| 65 DISALLOW_COPY_AND_ASSIGN(SetCurrentInputMethodFunction); |
48 }; | 66 }; |
49 | 67 |
50 // Implements the inputMethodPrivate.getInputMethods method. | 68 // Implements the inputMethodPrivate.getInputMethods method. |
51 class GetInputMethodsFunction : public UIThreadExtensionFunction { | 69 class GetInputMethodsFunction : public UIThreadExtensionFunction { |
52 public: | 70 public: |
53 GetInputMethodsFunction() {} | 71 GetInputMethodsFunction() {} |
54 | 72 |
55 protected: | 73 protected: |
56 virtual ~GetInputMethodsFunction() {} | 74 virtual ~GetInputMethodsFunction() {} |
57 | 75 |
58 virtual ResponseAction Run() override; | 76 virtual ResponseAction Run() override; |
59 | 77 |
60 private: | 78 private: |
61 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getInputMethods", | 79 DECLARE_EXTENSION_FUNCTION("inputMethodPrivate.getInputMethods", |
62 INPUTMETHODPRIVATE_GETINPUTMETHODS) | 80 INPUTMETHODPRIVATE_GETINPUTMETHODS) |
| 81 DISALLOW_COPY_AND_ASSIGN(GetInputMethodsFunction); |
63 }; | 82 }; |
64 | 83 |
65 class InputMethodAPI : public BrowserContextKeyedAPI, | 84 class InputMethodAPI : public BrowserContextKeyedAPI, |
66 public extensions::EventRouter::Observer { | 85 public extensions::EventRouter::Observer { |
67 public: | 86 public: |
68 static const char kOnInputMethodChanged[]; | 87 static const char kOnInputMethodChanged[]; |
69 | 88 |
70 explicit InputMethodAPI(content::BrowserContext* context); | 89 explicit InputMethodAPI(content::BrowserContext* context); |
71 virtual ~InputMethodAPI(); | 90 virtual ~InputMethodAPI(); |
72 | 91 |
(...skipping 25 matching lines...) Expand all Loading... |
98 // Created lazily upon OnListenerAdded. | 117 // Created lazily upon OnListenerAdded. |
99 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> | 118 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> |
100 input_method_event_router_; | 119 input_method_event_router_; |
101 | 120 |
102 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); | 121 DISALLOW_COPY_AND_ASSIGN(InputMethodAPI); |
103 }; | 122 }; |
104 | 123 |
105 } // namespace extensions | 124 } // namespace extensions |
106 | 125 |
107 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ | 126 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ |
OLD | NEW |