| 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 "chromeos/ime/ibus_daemon_controller.h" | 5 #include "chromeos/ime/ibus_daemon_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_path_watcher.h" | 9 #include "base/files/file_path_watcher.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 observers_.AddObserver(observer); | 67 observers_.AddObserver(observer); |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual void RemoveObserver(Observer* observer) OVERRIDE { | 70 virtual void RemoveObserver(Observer* observer) OVERRIDE { |
| 71 observers_.RemoveObserver(observer); | 71 observers_.RemoveObserver(observer); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual bool Start() OVERRIDE { | 74 virtual bool Start() OVERRIDE { |
| 75 if (is_started_) | 75 if (is_started_) |
| 76 return false; | 76 return false; |
| 77 // IBusBus should be initialized but it is okay to pass "dummy address" as | |
| 78 // the bus address because the actual dbus implementation is stub if the | |
| 79 // Chrome OS is working on Linux desktop. This path is not used in | |
| 80 // production at this moment, only for Chrome OS on Linux Desktop. | |
| 81 // TODO(nona): Remove InitIBusBus oncer all legacy ime is migrated to IME | |
| 82 // extension API. | |
| 83 DBusThreadManager::Get()->InitIBusBus("dummy address", | |
| 84 base::Bind(&base::DoNothing)); | |
| 85 is_started_ = true; | 77 is_started_ = true; |
| 86 FOR_EACH_OBSERVER(Observer, observers_, OnConnected()); | 78 FOR_EACH_OBSERVER(Observer, observers_, OnConnected()); |
| 87 return true; | 79 return true; |
| 88 } | 80 } |
| 89 virtual bool Stop() OVERRIDE { | 81 virtual bool Stop() OVERRIDE { |
| 90 if (!is_started_) | 82 if (!is_started_) |
| 91 return false; | 83 return false; |
| 92 is_started_ = false; | 84 is_started_ = false; |
| 93 FOR_EACH_OBSERVER(Observer, observers_, OnDisconnected()); | 85 FOR_EACH_OBSERVER(Observer, observers_, OnDisconnected()); |
| 94 return true; | 86 return true; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 delete g_ibus_daemon_controller; | 125 delete g_ibus_daemon_controller; |
| 134 g_ibus_daemon_controller = NULL; | 126 g_ibus_daemon_controller = NULL; |
| 135 } | 127 } |
| 136 | 128 |
| 137 // static | 129 // static |
| 138 IBusDaemonController* IBusDaemonController::GetInstance() { | 130 IBusDaemonController* IBusDaemonController::GetInstance() { |
| 139 return g_ibus_daemon_controller; | 131 return g_ibus_daemon_controller; |
| 140 } | 132 } |
| 141 | 133 |
| 142 } // namespace chromeos | 134 } // namespace chromeos |
| OLD | NEW |