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

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

Issue 10159004: Extends DBusThreadManager to connect ibus-bus. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Avoid double initializing Created 8 years, 7 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
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 #pragma once 7 #pragma once
8 8
9 #include <gio/gio.h> // GAsyncResult and related types. 9 #include <gio/gio.h> // GAsyncResult and related types.
10 #include <glib-object.h> 10 #include <glib-object.h>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void ConnectBusSignals(); 108 void ConnectBusSignals();
109 109
110 // Starts listening to the "focus-in", "register-properties", and 110 // Starts listening to the "focus-in", "register-properties", and
111 // "update-property" D-Bus signals from ibus-daemon. 111 // "update-property" D-Bus signals from ibus-daemon.
112 void ConnectPanelServiceSignals(); 112 void ConnectPanelServiceSignals();
113 113
114 // Starts ibus-daemon if it's not yet started and |should_launch_daemon_| is 114 // Starts ibus-daemon if it's not yet started and |should_launch_daemon_| is
115 // true. 115 // true.
116 bool MaybeLaunchIBusDaemon(); 116 bool MaybeLaunchIBusDaemon();
117 117
118 // Starts ibus-daemon.
119 void LaunchIBusDaemon(const std::string& ibus_address);
120
118 // Launches an input method procsess specified by the given command 121 // Launches an input method procsess specified by the given command
119 // line. On success, returns true and stores the process handle in 122 // line. On success, returns true and stores the process handle in
120 // |process_handle|. Otherwise, returns false, and the contents of 123 // |process_handle|. Otherwise, returns false, and the contents of
121 // |process_handle| is untouched. |watch_func| will be called when the 124 // |process_handle| is untouched. |watch_func| will be called when the
122 // process terminates. 125 // process terminates.
123 bool LaunchProcess(const std::string& command_line, 126 bool LaunchProcess(const std::string& command_line,
124 base::ProcessHandle* process_handle, 127 base::ProcessHandle* process_handle,
125 GChildWatchFunc watch_func); 128 GChildWatchFunc watch_func);
126 129
130 // Called after the connection to ibus-daemon is established.
131 void IBusDaemonInitializationDone();
132
127 // A callback function that will be called when ibus_config_set_value_async() 133 // A callback function that will be called when ibus_config_set_value_async()
128 // request is finished. 134 // request is finished.
129 static void SetInputMethodConfigCallback(GObject* source_object, 135 static void SetInputMethodConfigCallback(GObject* source_object,
130 GAsyncResult* res, 136 GAsyncResult* res,
131 gpointer user_data); 137 gpointer user_data);
132 138
133 // Called when the input method process is shut down. 139 // Called when the input method process is shut down.
134 static void OnIBusDaemonExit(GPid pid, 140 static void OnIBusDaemonExit(GPid pid,
135 gint status, 141 gint status,
136 IBusControllerImpl* controller); 142 IBusControllerImpl* controller);
(...skipping 13 matching lines...) Expand all
150 // Current input context path. 156 // Current input context path.
151 std::string current_input_context_path_; 157 std::string current_input_context_path_;
152 158
153 // The input method ID which is currently selected. The ID is sent to the 159 // The input method ID which is currently selected. The ID is sent to the
154 // daemon when |ibus_| and |ibus_config_| connections are both established. 160 // daemon when |ibus_| and |ibus_config_| connections are both established.
155 std::string current_input_method_id_; 161 std::string current_input_method_id_;
156 162
157 // An object which knows all valid input methods and layout IDs. 163 // An object which knows all valid input methods and layout IDs.
158 InputMethodWhitelist whitelist_; 164 InputMethodWhitelist whitelist_;
159 165
166 base::WeakPtrFactory<IBusControllerImpl> weak_ptr_factory_;
Yusuke Sato 2012/04/27 02:12:13 add comment. please explain why this is necessary.
Seigo Nonaka 2012/05/01 00:19:54 Done.
167
168 // true if ibus-daemon is initializing. The initializing steps are as follows.
169 // 1. Starts watching ibus address file.
170 // 2. Launches ibus-daemon and ibus-daemon write ibus address file if ready.
171 // 3. Gets notification of changing address file, then creates connection.
172 // 4. Deletes watcher.
173 bool is_initializing_ibus_daemon_;
Yusuke Sato 2012/04/27 02:12:13 I don't want to have two similar boolean flags her
Seigo Nonaka 2012/05/01 00:19:54 Done.
174
160 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl); 175 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl);
161 }; 176 };
162 177
163 } // namespace input_method 178 } // namespace input_method
164 } // namespace chromeos 179 } // namespace chromeos
165 180
166 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ 181 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698