| 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/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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/string_split.h" | 16 #include "base/string_split.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h" |
| 20 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 21 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 21 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" |
| 22 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" | 23 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" |
| 23 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 24 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 24 #include "chrome/browser/chromeos/language_preferences.h" | 25 #include "chrome/browser/chromeos/language_preferences.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
| 28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 InputMethodManagerImpl() | 77 InputMethodManagerImpl() |
| 77 : ibus_controller_(IBusController::Create()), | 78 : ibus_controller_(IBusController::Create()), |
| 78 should_hide_properties_(true), | 79 should_hide_properties_(true), |
| 79 should_launch_ime_(false), | 80 should_launch_ime_(false), |
| 80 ime_connected_(false), | 81 ime_connected_(false), |
| 81 enable_auto_ime_shutdown_(false), // workaround for crosbug.com/27051. | 82 enable_auto_ime_shutdown_(false), // workaround for crosbug.com/27051. |
| 82 shutting_down_(false), | 83 shutting_down_(false), |
| 83 ibus_daemon_process_handle_(base::kNullProcessHandle), | 84 ibus_daemon_process_handle_(base::kNullProcessHandle), |
| 84 util_(whitelist_.GetSupportedInputMethods()), | 85 util_(whitelist_.GetSupportedInputMethods()), |
| 85 xkeyboard_(XKeyboard::Create(util_)), | 86 xkeyboard_(XKeyboard::Create(util_)), |
| 87 ALLOW_THIS_IN_INITIALIZER_LIST(browser_state_monitor_(this)), |
| 86 ignore_hotkeys_(false) { | 88 ignore_hotkeys_(false) { |
| 87 // Observe APP_TERMINATING to stop input method daemon gracefully. | 89 // Observe APP_TERMINATING to stop input method daemon gracefully. |
| 88 // We should not use APP_EXITING here since logout might be canceled by | 90 // We should not use APP_EXITING here since logout might be canceled by |
| 89 // JavaScript after APP_EXITING is sent (crosbug.com/11055). | 91 // JavaScript after APP_EXITING is sent (crosbug.com/11055). |
| 90 // Note that even if we fail to stop input method daemon from | 92 // Note that even if we fail to stop input method daemon from |
| 91 // Chrome in case of a sudden crash, we have a way to do it from an | 93 // Chrome in case of a sudden crash, we have a way to do it from an |
| 92 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for | 94 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for |
| 93 // details. | 95 // details. |
| 94 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 96 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, |
| 95 content::NotificationService::AllSources()); | 97 content::NotificationService::AllSources()); |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 InputMethodWhitelist whitelist_; | 1284 InputMethodWhitelist whitelist_; |
| 1283 | 1285 |
| 1284 // An object which provides miscellaneous input method utility functions. Note | 1286 // An object which provides miscellaneous input method utility functions. Note |
| 1285 // that |util_| is required to initialize |xkeyboard_|. | 1287 // that |util_| is required to initialize |xkeyboard_|. |
| 1286 InputMethodUtil util_; | 1288 InputMethodUtil util_; |
| 1287 | 1289 |
| 1288 // An object for switching XKB layouts and keyboard status like caps lock and | 1290 // An object for switching XKB layouts and keyboard status like caps lock and |
| 1289 // auto-repeat interval. | 1291 // auto-repeat interval. |
| 1290 scoped_ptr<XKeyboard> xkeyboard_; | 1292 scoped_ptr<XKeyboard> xkeyboard_; |
| 1291 | 1293 |
| 1294 // An object which monitors a notification from the browser to keep track of |
| 1295 // the browser state (not logged in, logged in, etc.). |
| 1296 BrowserStateMonitor browser_state_monitor_; |
| 1297 |
| 1292 // true when DisableHotkeys() is called to temporarily disable IME hotkeys. | 1298 // true when DisableHotkeys() is called to temporarily disable IME hotkeys. |
| 1293 // EnableHotkeys() resets the flag to the default value, false. | 1299 // EnableHotkeys() resets the flag to the default value, false. |
| 1294 bool ignore_hotkeys_; | 1300 bool ignore_hotkeys_; |
| 1295 | 1301 |
| 1296 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); | 1302 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
| 1297 }; | 1303 }; |
| 1298 | 1304 |
| 1299 // static | 1305 // static |
| 1300 InputMethodManager* InputMethodManager::GetInstance() { | 1306 InputMethodManager* InputMethodManager::GetInstance() { |
| 1301 return InputMethodManagerImpl::GetInstance(); | 1307 return InputMethodManagerImpl::GetInstance(); |
| 1302 } | 1308 } |
| 1303 | 1309 |
| 1304 } // namespace input_method | 1310 } // namespace input_method |
| 1305 } // namespace chromeos | 1311 } // namespace chromeos |
| OLD | NEW |