| 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 21 matching lines...) Expand all Loading... |
| 32 observers_.AddObserver(observer); | 32 observers_.AddObserver(observer); |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual void RemoveObserver(Observer* observer) OVERRIDE { | 35 virtual void RemoveObserver(Observer* observer) OVERRIDE { |
| 36 observers_.RemoveObserver(observer); | 36 observers_.RemoveObserver(observer); |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual bool Start() OVERRIDE { | 39 virtual bool Start() OVERRIDE { |
| 40 if (is_started_) | 40 if (is_started_) |
| 41 return false; | 41 return false; |
| 42 // IBusBus should be initialized but it is okay to pass "dummy address" as | |
| 43 // the bus address because the actual dbus implementation is stub if the | |
| 44 // Chrome OS is working on Linux desktop. This path is not used in | |
| 45 // production at this moment, only for Chrome OS on Linux Desktop. | |
| 46 // TODO(nona): Remove InitIBusBus oncer all legacy ime is migrated to IME | |
| 47 // extension API. | |
| 48 DBusThreadManager::Get()->InitIBusBus("dummy address", | |
| 49 base::Bind(&base::DoNothing)); | |
| 50 is_started_ = true; | 42 is_started_ = true; |
| 51 FOR_EACH_OBSERVER(Observer, observers_, OnConnected()); | 43 FOR_EACH_OBSERVER(Observer, observers_, OnConnected()); |
| 52 return true; | 44 return true; |
| 53 } | 45 } |
| 54 virtual bool Stop() OVERRIDE { | 46 virtual bool Stop() OVERRIDE { |
| 55 if (!is_started_) | 47 if (!is_started_) |
| 56 return false; | 48 return false; |
| 57 is_started_ = false; | 49 is_started_ = false; |
| 58 FOR_EACH_OBSERVER(Observer, observers_, OnDisconnected()); | 50 FOR_EACH_OBSERVER(Observer, observers_, OnDisconnected()); |
| 59 return true; | 51 return true; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 delete g_ibus_daemon_controller; | 90 delete g_ibus_daemon_controller; |
| 99 g_ibus_daemon_controller = NULL; | 91 g_ibus_daemon_controller = NULL; |
| 100 } | 92 } |
| 101 | 93 |
| 102 // static | 94 // static |
| 103 IBusDaemonController* IBusDaemonController::GetInstance() { | 95 IBusDaemonController* IBusDaemonController::GetInstance() { |
| 104 return g_ibus_daemon_controller; | 96 return g_ibus_daemon_controller; |
| 105 } | 97 } |
| 106 | 98 |
| 107 } // namespace chromeos | 99 } // namespace chromeos |
| OLD | NEW |