| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/input_method_manager.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include <glib.h> | 9 #include <glib.h> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 candidate_window_controller_(NULL), | 75 candidate_window_controller_(NULL), |
| 76 #endif | 76 #endif |
| 77 ibus_daemon_process_handle_(base::kNullProcessHandle) { | 77 ibus_daemon_process_handle_(base::kNullProcessHandle) { |
| 78 // Observe APP_TERMINATING to stop input method daemon gracefully. | 78 // Observe APP_TERMINATING to stop input method daemon gracefully. |
| 79 // We should not use APP_EXITING here since logout might be canceled by | 79 // We should not use APP_EXITING here since logout might be canceled by |
| 80 // JavaScript after APP_EXITING is sent (crosbug.com/11055). | 80 // JavaScript after APP_EXITING is sent (crosbug.com/11055). |
| 81 // Note that even if we fail to stop input method daemon from | 81 // Note that even if we fail to stop input method daemon from |
| 82 // Chrome in case of a sudden crash, we have a way to do it from an | 82 // Chrome in case of a sudden crash, we have a way to do it from an |
| 83 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for | 83 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for |
| 84 // details. | 84 // details. |
| 85 notification_registrar_.Add(this, NotificationType::APP_TERMINATING, | 85 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, |
| 86 NotificationService::AllSources()); | 86 NotificationService::AllSources()); |
| 87 | 87 |
| 88 ibus_controller_ = input_method::IBusController::Create(); | 88 ibus_controller_ = input_method::IBusController::Create(); |
| 89 // The observer should be added before Connect() so we can capture the | 89 // The observer should be added before Connect() so we can capture the |
| 90 // initial connection change. | 90 // initial connection change. |
| 91 ibus_controller_->AddObserver(this); | 91 ibus_controller_->AddObserver(this); |
| 92 ibus_controller_->Connect(); | 92 ibus_controller_->Connect(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual ~InputMethodManagerImpl() { | 95 virtual ~InputMethodManagerImpl() { |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 void SetDeferImeStartup(bool defer) { | 853 void SetDeferImeStartup(bool defer) { |
| 854 VLOG(1) << "Setting DeferImeStartup to " << defer; | 854 VLOG(1) << "Setting DeferImeStartup to " << defer; |
| 855 defer_ime_startup_ = defer; | 855 defer_ime_startup_ = defer; |
| 856 } | 856 } |
| 857 | 857 |
| 858 void SetEnableAutoImeShutdown(bool enable) { | 858 void SetEnableAutoImeShutdown(bool enable) { |
| 859 enable_auto_ime_shutdown_ = enable; | 859 enable_auto_ime_shutdown_ = enable; |
| 860 } | 860 } |
| 861 | 861 |
| 862 // NotificationObserver implementation: | 862 // NotificationObserver implementation: |
| 863 void Observe(NotificationType type, | 863 void Observe(int type, |
| 864 const NotificationSource& source, | 864 const NotificationSource& source, |
| 865 const NotificationDetails& details) { | 865 const NotificationDetails& details) { |
| 866 // Stop the input method daemon on browser shutdown. | 866 // Stop the input method daemon on browser shutdown. |
| 867 if (type.value == NotificationType::APP_TERMINATING) { | 867 if (type == content::NOTIFICATION_APP_TERMINATING) { |
| 868 notification_registrar_.RemoveAll(); | 868 notification_registrar_.RemoveAll(); |
| 869 StopInputMethodDaemon(); | 869 StopInputMethodDaemon(); |
| 870 #if !defined(TOUCH_UI) | 870 #if !defined(TOUCH_UI) |
| 871 candidate_window_controller_.reset(NULL); | 871 candidate_window_controller_.reset(NULL); |
| 872 #endif | 872 #endif |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 | 875 |
| 876 // A reference to the language api, to allow callbacks when the input method | 876 // A reference to the language api, to allow callbacks when the input method |
| 877 // status changes. | 877 // status changes. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 return InputMethodManagerImpl::GetInstance(); | 950 return InputMethodManagerImpl::GetInstance(); |
| 951 } | 951 } |
| 952 | 952 |
| 953 } // namespace input_method | 953 } // namespace input_method |
| 954 } // namespace chromeos | 954 } // namespace chromeos |
| 955 | 955 |
| 956 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 956 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 957 // won't be deleted until it's last InvokeLater is run. | 957 // won't be deleted until it's last InvokeLater is run. |
| 958 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 958 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
| 959 chromeos::input_method::InputMethodManagerImpl); | 959 chromeos::input_method::InputMethodManagerImpl); |
| OLD | NEW |