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

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_api.h

Issue 11611004: Move the InputComponents out of extensions entirely. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/input_ime/input_ime_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 14 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
15 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
15 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
16 #include "chrome/browser/profiles/profile_keyed_service.h" 17 #include "chrome/browser/profiles/profile_keyed_service.h"
18 #include "chrome/common/extensions/api/input_ime/input_components_handler.h"
17 #include "chrome/common/extensions/extension.h" 19 #include "chrome/common/extensions/extension.h"
18 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
20 22
21 class Profile; 23 class Profile;
22 24
23 namespace chromeos { 25 namespace chromeos {
24 class InputMethodEngine; 26 class InputMethodEngine;
25 class ImeObserver; 27 class ImeObserver;
26 } 28 }
27 29
28 namespace extensions { 30 namespace extensions {
29 31
30 class InputImeEventRouter { 32 class InputImeEventRouter {
31 public: 33 public:
32 static InputImeEventRouter* GetInstance(); 34 static InputImeEventRouter* GetInstance();
33 35
34 bool RegisterIme(Profile* profile, 36 bool RegisterIme(Profile* profile,
35 const std::string& extension_id, 37 const std::string& extension_id,
36 const extensions::Extension::InputComponentInfo& component); 38 const extensions::InputComponentInfo& component);
37 void UnregisterAllImes(Profile* profile, const std::string& extension_id); 39 void UnregisterAllImes(Profile* profile, const std::string& extension_id);
38 chromeos::InputMethodEngine* GetEngine(const std::string& extension_id, 40 chromeos::InputMethodEngine* GetEngine(const std::string& extension_id,
39 const std::string& engine_id); 41 const std::string& engine_id);
40 chromeos::InputMethodEngine* GetActiveEngine(const std::string& extension_id); 42 chromeos::InputMethodEngine* GetActiveEngine(const std::string& extension_id);
41 43
42 44
43 // Called when a key event was handled. 45 // Called when a key event was handled.
44 void OnKeyEventHandled(const std::string& extension_id, 46 void OnKeyEventHandled(const std::string& extension_id,
45 const std::string& request_id, 47 const std::string& request_id,
46 bool handled); 48 bool handled);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 public: 166 public:
165 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.keyEventHandled"); 167 DECLARE_EXTENSION_FUNCTION_NAME("input.ime.keyEventHandled");
166 168
167 protected: 169 protected:
168 virtual ~KeyEventHandled() {} 170 virtual ~KeyEventHandled() {}
169 171
170 // ExtensionFunction: 172 // ExtensionFunction:
171 virtual bool RunImpl() OVERRIDE; 173 virtual bool RunImpl() OVERRIDE;
172 }; 174 };
173 175
174 class InputImeAPI : public ProfileKeyedService, 176 class InputImeAPI : public ProfileKeyedAPI,
175 public content::NotificationObserver { 177 public content::NotificationObserver {
176 public: 178 public:
177 explicit InputImeAPI(Profile* profile); 179 explicit InputImeAPI(Profile* profile);
178 virtual ~InputImeAPI(); 180 virtual ~InputImeAPI();
179 181
180 // content::NotificationObserver implementation. 182 // content::NotificationObserver implementation.
181 virtual void Observe(int type, 183 virtual void Observe(int type,
182 const content::NotificationSource& source, 184 const content::NotificationSource& source,
183 const content::NotificationDetails& details) OVERRIDE; 185 const content::NotificationDetails& details) OVERRIDE;
184 186
185 private: 187 private:
188 friend class ProfileKeyedAPIFactory<InputImeAPI>;
186 InputImeEventRouter* input_ime_event_router(); 189 InputImeEventRouter* input_ime_event_router();
187 190
191 // ProfileKeyedAPI implementation.
192 static const char* service_name() {
193 return "InputImeAPI";
194 }
195 static const bool kServiceIsNULLWhileTesting = true;
196
188 Profile* const profile_; 197 Profile* const profile_;
189 content::NotificationRegistrar registrar_; 198 content::NotificationRegistrar registrar_;
190 }; 199 };
191 200
201 template <>
202 ProfileKeyedAPIFactory<InputImeAPI>*
203 ProfileKeyedAPIFactory<InputImeAPI>::GetInstance();
204
192 } // namespace extensions 205 } // namespace extensions
193 206
194 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ 207 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/input_ime/input_ime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698