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

Side by Side Diff: chrome/browser/chromeos/input_method/ibus_controller_impl.h

Issue 11594008: Revert 173477 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
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 | Annotate | Revision Log
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_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_
7 7
8 #include <gio/gio.h> // GAsyncResult and related types. 8 #include <gio/gio.h> // GAsyncResult and related types.
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ref_counted.h"
14 #include "base/process_util.h" 13 #include "base/process_util.h"
15 #include "chrome/browser/chromeos/input_method/ibus_controller_base.h" 14 #include "chrome/browser/chromeos/input_method/ibus_controller_base.h"
16 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" 15 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
17 #include "chromeos/dbus/ibus/ibus_panel_service.h" 16 #include "chromeos/dbus/ibus/ibus_panel_service.h"
18 17
19 namespace base {
20 class SequencedTaskRunner;
21 } // namespace base
22
23 namespace ui { 18 namespace ui {
24 class InputMethodIBus; 19 class InputMethodIBus;
25 } // namespace ui 20 } // namespace ui
26 21
27 namespace chromeos { 22 namespace chromeos {
28 namespace input_method { 23 namespace input_method {
29 24
30 struct InputMethodConfigValue; 25 struct InputMethodConfigValue;
31 struct InputMethodProperty; 26 struct InputMethodProperty;
32 typedef std::vector<InputMethodProperty> InputMethodPropertyList; 27 typedef std::vector<InputMethodProperty> InputMethodPropertyList;
33 28
34 // The IBusController implementation. 29 // The IBusController implementation.
35 class IBusControllerImpl : public IBusControllerBase, 30 class IBusControllerImpl : public IBusControllerBase,
36 public ibus::IBusPanelPropertyHandlerInterface { 31 public ibus::IBusPanelPropertyHandlerInterface {
37 public: 32 public:
38 // Creates an IBusController. All public methods must be invoked in the 33 IBusControllerImpl();
39 // context of |default_task_runner|. |worker_task_runner| will be used to
40 // execute potentially blocking file tasks.
41 IBusControllerImpl(
42 const scoped_refptr<base::SequencedTaskRunner>& default_task_runner,
43 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner);
44 virtual ~IBusControllerImpl(); 34 virtual ~IBusControllerImpl();
45 35
46 // IBusController overrides: 36 // IBusController overrides:
47 virtual bool Start() OVERRIDE; 37 virtual bool Start() OVERRIDE;
48 virtual void Reset() OVERRIDE; 38 virtual void Reset() OVERRIDE;
49 virtual bool Stop() OVERRIDE; 39 virtual bool Stop() OVERRIDE;
50 virtual bool ChangeInputMethod(const std::string& id) OVERRIDE; 40 virtual bool ChangeInputMethod(const std::string& id) OVERRIDE;
51 virtual bool ActivateInputMethodProperty(const std::string& key) OVERRIDE; 41 virtual bool ActivateInputMethodProperty(const std::string& key) OVERRIDE;
52 42
53 // Calls <anonymous_namespace>::FindAndUpdateProperty. This method is just for 43 // Calls <anonymous_namespace>::FindAndUpdateProperty. This method is just for
54 // unit testing. 44 // unit testing.
55 static bool FindAndUpdatePropertyForTesting( 45 static bool FindAndUpdatePropertyForTesting(
56 const InputMethodProperty& new_prop, 46 const InputMethodProperty& new_prop,
57 InputMethodPropertyList* prop_list); 47 InputMethodPropertyList* prop_list);
58 48
49 static void IBusDaemonInitializationDone(IBusControllerImpl* controller,
50 const std::string& ibus_address);
51
59 private: 52 private:
60 enum IBusDaemonStatus{ 53 enum IBusDaemonStatus{
61 IBUS_DAEMON_INITIALIZING, 54 IBUS_DAEMON_INITIALIZING,
62 IBUS_DAEMON_RUNNING, 55 IBUS_DAEMON_RUNNING,
63 IBUS_DAEMON_SHUTTING_DOWN, 56 IBUS_DAEMON_SHUTTING_DOWN,
64 IBUS_DAEMON_STOP, 57 IBUS_DAEMON_STOP,
65 }; 58 };
66 59
67 // IBusControllerBase overrides: 60 // IBusControllerBase overrides:
68 virtual bool SetInputMethodConfigInternal( 61 virtual bool SetInputMethodConfigInternal(
(...skipping 26 matching lines...) Expand all
95 base::ProcessHandle* process_handle, 88 base::ProcessHandle* process_handle,
96 GChildWatchFunc watch_func); 89 GChildWatchFunc watch_func);
97 90
98 // Returns pointer to InputMethod object. 91 // Returns pointer to InputMethod object.
99 ui::InputMethodIBus* GetInputMethod(); 92 ui::InputMethodIBus* GetInputMethod();
100 93
101 // Injects an alternative ui::InputMethod for testing. 94 // Injects an alternative ui::InputMethod for testing.
102 // The injected object must be released by caller. 95 // The injected object must be released by caller.
103 void set_input_method_for_testing(ui::InputMethodIBus* input_method); 96 void set_input_method_for_testing(ui::InputMethodIBus* input_method);
104 97
105 // Receives a notification on a worker thread and posts a call to
106 // IBusDaemonInitializationDone on the default task runner.
107 void IBusDaemonInitializationDoneWorkerCallback(
108 const std::string& ibus_address);
109
110 void IBusDaemonInitializationDone(const std::string& ibus_address);
111
112 // Called when the IBusConfigClient is initialized. 98 // Called when the IBusConfigClient is initialized.
113 void OnIBusConfigClientInitialized(); 99 void OnIBusConfigClientInitialized();
114 100
115 // Called when the input method process is shut down. 101 // Called when the input method process is shut down.
116 static void OnIBusDaemonExit(GPid pid, 102 static void OnIBusDaemonExit(GPid pid,
117 gint status, 103 gint status,
118 IBusControllerImpl* controller); 104 IBusControllerImpl* controller);
119 105
120 // The current ibus_daemon address. This value is assigned at the launching 106 // The current ibus_daemon address. This value is assigned at the launching
121 // ibus-daemon and used in bus connection initialization. 107 // ibus-daemon and used in bus connection initialization.
(...skipping 12 matching lines...) Expand all
134 120
135 // An object which knows all valid input methods and layout IDs. 121 // An object which knows all valid input methods and layout IDs.
136 InputMethodWhitelist whitelist_; 122 InputMethodWhitelist whitelist_;
137 123
138 // Represents ibus-daemon's status. 124 // Represents ibus-daemon's status.
139 IBusDaemonStatus ibus_daemon_status_; 125 IBusDaemonStatus ibus_daemon_status_;
140 126
141 // The pointer to global input method. We can inject this value for testing. 127 // The pointer to global input method. We can inject this value for testing.
142 ui::InputMethodIBus* input_method_; 128 ui::InputMethodIBus* input_method_;
143 129
144 scoped_refptr<base::SequencedTaskRunner> default_task_runner_;
145 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_;
146
147 // Used for making callbacks for PostTask. 130 // Used for making callbacks for PostTask.
148 base::WeakPtrFactory<IBusControllerImpl> weak_ptr_factory_; 131 base::WeakPtrFactory<IBusControllerImpl> weak_ptr_factory_;
149 132
150 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl); 133 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl);
151 }; 134 };
152 135
153 } // namespace input_method 136 } // namespace input_method
154 } // namespace chromeos 137 } // namespace chromeos
155 138
156 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ 139 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/ibus_controller.cc ('k') | chrome/browser/chromeos/input_method/ibus_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698