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 |
11 #include "unicode/uloc.h" | 11 #include "unicode/uloc.h" |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chromeos/input_method/hotkey_manager.h" | 21 #include "chrome/browser/chromeos/input_method/hotkey_manager.h" |
22 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
23 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" | 23 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" |
24 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 24 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
25 #include "chrome/browser/chromeos/language_preferences.h" | 25 #include "chrome/browser/chromeos/language_preferences.h" |
26 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
27 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
28 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
29 #include "content/common/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
32 | 32 |
33 #if !defined(TOUCH_UI) | 33 #if !defined(TOUCH_UI) |
34 #include "chrome/browser/chromeos/input_method/candidate_window.h" | 34 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #include <X11/X.h> // ShiftMask, ControlMask, etc. | 37 #include <X11/X.h> // ShiftMask, ControlMask, etc. |
38 #include <X11/Xutil.h> // for XK_* macros. | 38 #include <X11/Xutil.h> // for XK_* macros. |
39 | 39 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 util_(ibus_controller_->GetSupportedInputMethods()), | 143 util_(ibus_controller_->GetSupportedInputMethods()), |
144 xkeyboard_(util_) { | 144 xkeyboard_(util_) { |
145 // Observe APP_TERMINATING to stop input method daemon gracefully. | 145 // Observe APP_TERMINATING to stop input method daemon gracefully. |
146 // We should not use APP_EXITING here since logout might be canceled by | 146 // We should not use APP_EXITING here since logout might be canceled by |
147 // JavaScript after APP_EXITING is sent (crosbug.com/11055). | 147 // JavaScript after APP_EXITING is sent (crosbug.com/11055). |
148 // Note that even if we fail to stop input method daemon from | 148 // Note that even if we fail to stop input method daemon from |
149 // Chrome in case of a sudden crash, we have a way to do it from an | 149 // Chrome in case of a sudden crash, we have a way to do it from an |
150 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for | 150 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for |
151 // details. | 151 // details. |
152 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 152 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, |
153 NotificationService::AllSources()); | 153 content::NotificationService::AllSources()); |
154 | 154 |
155 // The observer should be added before Connect() so we can capture the | 155 // The observer should be added before Connect() so we can capture the |
156 // initial connection change. | 156 // initial connection change. |
157 ibus_controller_->AddObserver(this); | 157 ibus_controller_->AddObserver(this); |
158 ibus_controller_->Connect(); | 158 ibus_controller_->Connect(); |
159 | 159 |
160 // Initialize extra_hotkeys_. | 160 // Initialize extra_hotkeys_. |
161 for (size_t i = 0; i < kInputMethodSpecificHotkeySettingsLen; ++i) { | 161 for (size_t i = 0; i < kInputMethodSpecificHotkeySettingsLen; ++i) { |
162 const char* const* input_method_ids = | 162 const char* const* input_method_ids = |
163 kInputMethodSpecificHotkeySettings[i].input_method_ids; | 163 kInputMethodSpecificHotkeySettings[i].input_method_ids; |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 return InputMethodManagerImpl::GetInstance(); | 1383 return InputMethodManagerImpl::GetInstance(); |
1384 } | 1384 } |
1385 | 1385 |
1386 } // namespace input_method | 1386 } // namespace input_method |
1387 } // namespace chromeos | 1387 } // namespace chromeos |
1388 | 1388 |
1389 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1389 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
1390 // won't be deleted until it's last InvokeLater is run. | 1390 // won't be deleted until it's last InvokeLater is run. |
1391 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 1391 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
1392 chromeos::input_method::InputMethodManagerImpl); | 1392 chromeos::input_method::InputMethodManagerImpl); |
OLD | NEW |