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

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: Rebased 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/input_method_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) 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 // Returns input method name for the given XKB (X keyboard extensions in X
41 // Window System) id.
42 static std::string GetInputMethodForXkb(const std::string& xkb_id);
43
44 // ProfileKeyedService implementation.
45 virtual void Shutdown() OVERRIDE;
46
47 // EventRouter::Observer implementation.
48 virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
49 OVERRIDE;
50
51 private:
52 Profile* const profile_;
53
54 // Created lazily upon OnListenerAdded.
55 scoped_ptr<chromeos::ExtensionInputMethodEventRouter>
56 input_method_event_router_;
57 };
58
27 } // namespace extensions 59 } // namespace extensions
28 60
29 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_ 61 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INPUT_METHOD_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/input_method_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698