OLD | NEW |
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_interface.h" | 14 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" |
15 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | |
16 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 15 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "extensions/browser/browser_context_keyed_api_factory.h" |
19 #include "extensions/browser/extension_function.h" | 19 #include "extensions/browser/extension_function.h" |
20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
21 | 21 |
22 class Profile; | 22 class Profile; |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 class InputMethodEngineInterface; | 25 class InputMethodEngineInterface; |
26 class ImeObserver; | 26 class ImeObserver; |
27 } // namespace chromeos | 27 } // namespace chromeos |
28 | 28 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", | 206 DECLARE_EXTENSION_FUNCTION("input.ime.hideInputView", |
207 INPUT_IME_HIDEINPUTVIEW) | 207 INPUT_IME_HIDEINPUTVIEW) |
208 | 208 |
209 protected: | 209 protected: |
210 virtual ~InputImeHideInputViewFunction() {} | 210 virtual ~InputImeHideInputViewFunction() {} |
211 | 211 |
212 // ExtensionFunction: | 212 // ExtensionFunction: |
213 virtual bool RunImpl() OVERRIDE; | 213 virtual bool RunImpl() OVERRIDE; |
214 }; | 214 }; |
215 | 215 |
216 class InputImeAPI : public ProfileKeyedAPI, | 216 class InputImeAPI : public BrowserContextKeyedAPI, |
217 public content::NotificationObserver { | 217 public content::NotificationObserver { |
218 public: | 218 public: |
219 explicit InputImeAPI(content::BrowserContext* context); | 219 explicit InputImeAPI(content::BrowserContext* context); |
220 virtual ~InputImeAPI(); | 220 virtual ~InputImeAPI(); |
221 | 221 |
222 // ProfileKeyedAPI implementation. | 222 // BrowserContextKeyedAPI implementation. |
223 static ProfileKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); | 223 static BrowserContextKeyedAPIFactory<InputImeAPI>* GetFactoryInstance(); |
224 | 224 |
225 // content::NotificationObserver implementation. | 225 // content::NotificationObserver implementation. |
226 virtual void Observe(int type, | 226 virtual void Observe(int type, |
227 const content::NotificationSource& source, | 227 const content::NotificationSource& source, |
228 const content::NotificationDetails& details) OVERRIDE; | 228 const content::NotificationDetails& details) OVERRIDE; |
229 | 229 |
230 private: | 230 private: |
231 friend class ProfileKeyedAPIFactory<InputImeAPI>; | 231 friend class BrowserContextKeyedAPIFactory<InputImeAPI>; |
232 InputImeEventRouter* input_ime_event_router(); | 232 InputImeEventRouter* input_ime_event_router(); |
233 | 233 |
234 // ProfileKeyedAPI implementation. | 234 // BrowserContextKeyedAPI implementation. |
235 static const char* service_name() { | 235 static const char* service_name() { |
236 return "InputImeAPI"; | 236 return "InputImeAPI"; |
237 } | 237 } |
238 static const bool kServiceIsNULLWhileTesting = true; | 238 static const bool kServiceIsNULLWhileTesting = true; |
239 | 239 |
240 Profile* const profile_; | 240 Profile* const profile_; |
241 content::NotificationRegistrar registrar_; | 241 content::NotificationRegistrar registrar_; |
242 }; | 242 }; |
243 | 243 |
244 } // namespace extensions | 244 } // namespace extensions |
245 | 245 |
246 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ | 246 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_H_ |
OLD | NEW |