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 #include "chrome/browser/chromeos/input_method/ibus_controller_impl.h" | 5 #include "chrome/browser/chromeos/input_method/ibus_controller_impl.h" |
6 | 6 |
7 #include <algorithm> // for std::reverse. | 7 #include <algorithm> // for std::reverse. |
8 #include <cstdio> | 8 #include <cstdio> |
9 #include <cstring> // for std::strcmp. | 9 #include <cstring> // for std::strcmp. |
10 #include <set> | 10 #include <set> |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 if (controller->ibus_daemon_status_ != IBUS_DAEMON_INITIALIZING) { | 1067 if (controller->ibus_daemon_status_ != IBUS_DAEMON_INITIALIZING) { |
1068 // Stop() or OnIBusDaemonExit() has already been called. | 1068 // Stop() or OnIBusDaemonExit() has already been called. |
1069 return; | 1069 return; |
1070 } | 1070 } |
1071 chromeos::DBusThreadManager::Get()->InitIBusBus(ibus_address); | 1071 chromeos::DBusThreadManager::Get()->InitIBusBus(ibus_address); |
1072 controller->ibus_daemon_status_ = IBUS_DAEMON_RUNNING; | 1072 controller->ibus_daemon_status_ = IBUS_DAEMON_RUNNING; |
1073 | 1073 |
1074 ui::InputMethodIBus* input_method_ibus = controller->GetInputMethod(); | 1074 ui::InputMethodIBus* input_method_ibus = controller->GetInputMethod(); |
1075 DCHECK(input_method_ibus); | 1075 DCHECK(input_method_ibus); |
1076 input_method_ibus->OnConnected(); | 1076 input_method_ibus->OnConnected(); |
| 1077 |
| 1078 FOR_EACH_OBSERVER(Observer, controller->observers_, OnConnected()); |
| 1079 |
1077 VLOG(1) << "The ibus-daemon initialization is done."; | 1080 VLOG(1) << "The ibus-daemon initialization is done."; |
1078 } | 1081 } |
1079 | 1082 |
1080 // static | 1083 // static |
1081 void IBusControllerImpl::SetInputMethodConfigCallback(GObject* source_object, | 1084 void IBusControllerImpl::SetInputMethodConfigCallback(GObject* source_object, |
1082 GAsyncResult* res, | 1085 GAsyncResult* res, |
1083 gpointer user_data) { | 1086 gpointer user_data) { |
1084 IBusConfig* config = IBUS_CONFIG(user_data); | 1087 IBusConfig* config = IBUS_CONFIG(user_data); |
1085 g_return_if_fail(config); | 1088 g_return_if_fail(config); |
1086 | 1089 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 // re-launch ibus-daemon. | 1122 // re-launch ibus-daemon. |
1120 return; | 1123 return; |
1121 } | 1124 } |
1122 } | 1125 } |
1123 | 1126 |
1124 const IBusDaemonStatus on_exit_state = controller->ibus_daemon_status_; | 1127 const IBusDaemonStatus on_exit_state = controller->ibus_daemon_status_; |
1125 controller->ibus_daemon_status_ = IBUS_DAEMON_STOP; | 1128 controller->ibus_daemon_status_ = IBUS_DAEMON_STOP; |
1126 ui::InputMethodIBus* input_method_ibus = controller->GetInputMethod(); | 1129 ui::InputMethodIBus* input_method_ibus = controller->GetInputMethod(); |
1127 DCHECK(input_method_ibus); | 1130 DCHECK(input_method_ibus); |
1128 input_method_ibus->OnDisconnected(); | 1131 input_method_ibus->OnDisconnected(); |
| 1132 |
| 1133 FOR_EACH_OBSERVER(Observer, controller->observers_, OnDisconnected()); |
| 1134 |
1129 if (on_exit_state == IBUS_DAEMON_SHUTTING_DOWN) { | 1135 if (on_exit_state == IBUS_DAEMON_SHUTTING_DOWN) { |
1130 // Normal exitting, so do nothing. | 1136 // Normal exitting, so do nothing. |
1131 return; | 1137 return; |
1132 } | 1138 } |
1133 | 1139 |
1134 LOG(ERROR) << "The ibus-daemon crashed. Re-launching..."; | 1140 LOG(ERROR) << "The ibus-daemon crashed. Re-launching..."; |
1135 controller->StartIBusDaemon(); | 1141 controller->StartIBusDaemon(); |
1136 } | 1142 } |
1137 #endif // defined(HAVE_IBUS) | 1143 #endif // defined(HAVE_IBUS) |
1138 | 1144 |
1139 // static | 1145 // static |
1140 bool IBusControllerImpl::FindAndUpdatePropertyForTesting( | 1146 bool IBusControllerImpl::FindAndUpdatePropertyForTesting( |
1141 const chromeos::input_method::InputMethodProperty& new_prop, | 1147 const chromeos::input_method::InputMethodProperty& new_prop, |
1142 chromeos::input_method::InputMethodPropertyList* prop_list) { | 1148 chromeos::input_method::InputMethodPropertyList* prop_list) { |
1143 return FindAndUpdateProperty(new_prop, prop_list); | 1149 return FindAndUpdateProperty(new_prop, prop_list); |
1144 } | 1150 } |
1145 | 1151 |
1146 } // namespace input_method | 1152 } // namespace input_method |
1147 } // namespace chromeos | 1153 } // namespace chromeos |
OLD | NEW |