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

Side by Side Diff: chrome/browser/chromeos/extensions/input_method_api.h

Issue 11442074: Lazy initialization for ExtensionInputMethodEventRouter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
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"
10 #include "chrome/browser/extensions/event_router.h"
9 #include "chrome/browser/extensions/extension_function.h" 11 #include "chrome/browser/extensions/extension_function.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h"
13
14 namespace chromeos {
15 class ExtensionInputMethodEventRouter;
16 }
10 17
11 namespace extensions { 18 namespace extensions {
12 19
13 // Implements the experimental.inputMethod.get method. 20 // Implements the experimental.inputMethod.get method.
14 class GetInputMethodFunction : public SyncExtensionFunction { 21 class GetInputMethodFunction : public SyncExtensionFunction {
15 public: 22 public:
16 GetInputMethodFunction(); 23 GetInputMethodFunction();
17 24
18 protected: 25 protected:
19 virtual ~GetInputMethodFunction(); 26 virtual ~GetInputMethodFunction();
20 27
21 virtual bool RunImpl() OVERRIDE; 28 virtual bool RunImpl() OVERRIDE;
22 29
23 private: 30 private:
24 DECLARE_EXTENSION_FUNCTION_NAME("inputMethodPrivate.get"); 31 DECLARE_EXTENSION_FUNCTION_NAME("inputMethodPrivate.get");
25 }; 32 };
26 33
34 class InputMethodAPI : public ProfileKeyedService,
35 public extensions::EventRouter::Observer {
36 public:
37 explicit InputMethodAPI(Profile* profile);
38 virtual ~InputMethodAPI();
39
40 // Convenience method to get the InputMethodAPI for a profile.
41 static InputMethodAPI* Get(Profile* profile);
42
43 chromeos::ExtensionInputMethodEventRouter* input_method_event_router();
44
45 // ProfileKeyedService implementation.
46 virtual void Shutdown() OVERRIDE;
47
48 // EventRouter::Observer implementation.
49 virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
50 OVERRIDE;
51
52 private:
53 Profile* profile_;
54
55 // Created lazily upon OnListenerAdded.
56 scoped_ptr<chromeos::ExtensionInputMethodEventRouter>
57 input_method_event_router_;
58 };
59
27 } // namespace extensions 60 } // namespace extensions
28 61
29 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ 62 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698