Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/extensions/extension_input_ime_api.h

Issue 10735074: Moving input_ime to api/ . (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Typo fixed Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INPUT_IME_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INPUT_IME_API_H_
7
8 #include "chrome/browser/extensions/extension_function.h"
9
10 #include "base/memory/singleton.h"
11 #include "base/values.h"
12 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
13 #include "chrome/common/extensions/extension.h"
14
15 #include <map>
16 #include <string>
17 #include <vector>
18
19 class Profile;
20
21 namespace chromeos {
22 class InputMethodEngine;
23 class ImeObserver;
24 }
25
26 class ExtensionInputImeEventRouter {
27 public:
28 static ExtensionInputImeEventRouter* GetInstance();
29 void Init();
30
31 bool RegisterIme(Profile* profile,
32 const std::string& extension_id,
33 const extensions::Extension::InputComponentInfo& component);
34 void UnregisterAllImes(Profile* profile, const std::string& extension_id);
35 chromeos::InputMethodEngine* GetEngine(const std::string& extension_id,
36 const std::string& engine_id);
37 chromeos::InputMethodEngine* GetActiveEngine(const std::string& extension_id);
38
39
40 // Called when a key event was handled.
41 void OnEventHandled(const std::string& extension_id,
42 const std::string& request_id,
43 bool handled);
44
45 std::string AddRequest(const std::string& engine_id,
46 chromeos::input_method::KeyEventHandle* key_data);
47
48 private:
49 friend struct DefaultSingletonTraits<ExtensionInputImeEventRouter>;
50 typedef std::map<std::string, std::pair<std::string,
51 chromeos::input_method::KeyEventHandle*> > RequestMap;
52
53 ExtensionInputImeEventRouter();
54 ~ExtensionInputImeEventRouter();
55
56 std::map<std::string, std::map<std::string, chromeos::InputMethodEngine*> >
57 engines_;
58 std::map<std::string, std::map<std::string, chromeos::ImeObserver*> >
59 observers_;
60
61 unsigned int next_request_id_;
62 RequestMap request_map_;
63
64 DISALLOW_COPY_AND_ASSIGN(ExtensionInputImeEventRouter);
65 };
66
67 class SetCompositionFunction : public SyncExtensionFunction {
68 public:
69 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.setComposition");
70
71 protected:
72 virtual ~SetCompositionFunction() {}
73
74 // ExtensionFunction:
75 virtual bool RunImpl() OVERRIDE;
76 };
77
78 class ClearCompositionFunction : public SyncExtensionFunction {
79 public:
80 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.clearComposition");
81
82 protected:
83 virtual ~ClearCompositionFunction() {}
84
85 // ExtensionFunction:
86 virtual bool RunImpl() OVERRIDE;
87 };
88
89 class CommitTextFunction : public SyncExtensionFunction {
90 public:
91 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.commitText");
92
93 protected:
94 virtual ~CommitTextFunction() {}
95
96 // ExtensionFunction:
97 virtual bool RunImpl() OVERRIDE;
98 };
99
100 class SetCandidateWindowPropertiesFunction : public SyncExtensionFunction {
101 public:
102 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.setCandidateWindowProperties");
103
104 protected:
105 virtual ~SetCandidateWindowPropertiesFunction() {}
106
107 // ExtensionFunction:
108 virtual bool RunImpl() OVERRIDE;
109 };
110
111 class SetCandidatesFunction : public SyncExtensionFunction {
112 public:
113 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.setCandidates");
114
115 protected:
116 virtual ~SetCandidatesFunction() {}
117
118 // ExtensionFunction:
119 virtual bool RunImpl() OVERRIDE;
120
121 private:
122 bool ReadCandidates(
123 ListValue* candidates,
124 std::vector<chromeos::InputMethodEngine::Candidate>* output);
125 };
126
127 class SetCursorPositionFunction : public SyncExtensionFunction {
128 public:
129 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.setCursorPosition");
130
131 protected:
132 virtual ~SetCursorPositionFunction() {}
133
134 // ExtensionFunction:
135 virtual bool RunImpl() OVERRIDE;
136 };
137
138 class SetMenuItemsFunction : public SyncExtensionFunction {
139 public:
140 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.setMenuItems");
141
142 protected:
143 virtual ~SetMenuItemsFunction() {}
144
145 // ExtensionFunction:
146 virtual bool RunImpl() OVERRIDE;
147 };
148
149 class UpdateMenuItemsFunction : public SyncExtensionFunction {
150 public:
151 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.updateMenuItems");
152
153 protected:
154 virtual ~UpdateMenuItemsFunction() {}
155
156 // ExtensionFunction:
157 virtual bool RunImpl() OVERRIDE;
158 };
159
160 class InputEventHandled : public AsyncExtensionFunction {
161 public:
162 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.eventHandled");
163
164 protected:
165 virtual ~InputEventHandled() {}
166
167 // ExtensionFunction:
168 virtual bool RunImpl() OVERRIDE;
169 };
170
171 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INPUT_IME_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698