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