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 "chrome/browser/chromeos/system/runtime_environment.h" | |
27 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
28 #include "content/common/notification_observer.h" | 27 #include "content/common/notification_observer.h" |
29 #include "content/common/notification_registrar.h" | 28 #include "content/common/notification_registrar.h" |
30 #include "content/common/notification_service.h" | 29 #include "content/common/notification_service.h" |
31 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
32 | 31 |
33 #if !defined(TOUCH_UI) | 32 #if !defined(TOUCH_UI) |
34 #include "chrome/browser/chromeos/input_method/candidate_window.h" | 33 #include "chrome/browser/chromeos/input_method/candidate_window.h" |
35 #endif | 34 #endif |
36 | 35 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if (ix != extra_input_method_ids_.end()) { | 236 if (ix != extra_input_method_ids_.end()) { |
238 result->push_back(ix->second); | 237 result->push_back(ix->second); |
239 } else { | 238 } else { |
240 LOG(ERROR) << "Descriptor is not found for: " << input_method_id; | 239 LOG(ERROR) << "Descriptor is not found for: " << input_method_id; |
241 } | 240 } |
242 } | 241 } |
243 } | 242 } |
244 // Initially active_input_method_ids_ is empty. In this case, just | 243 // Initially active_input_method_ids_ is empty. In this case, just |
245 // returns the fallback input method descriptor. | 244 // returns the fallback input method descriptor. |
246 if (result->empty()) { | 245 if (result->empty()) { |
247 if (system::runtime_environment::IsRunningOnChromeOS()) { | 246 // Since browser_tests call neither SetImeConfig("preload_engines") nor |
248 LOG(WARNING) << "No active input methods found."; | 247 // EnableInputMethod(), this path might be taken. |
249 } | |
250 result->push_back( | 248 result->push_back( |
251 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); | 249 InputMethodDescriptor::GetFallbackInputMethodDescriptor()); |
252 } | 250 } |
253 return result; | 251 return result; |
254 } | 252 } |
255 | 253 |
256 virtual size_t GetNumActiveInputMethods() { | 254 virtual size_t GetNumActiveInputMethods() { |
257 scoped_ptr<InputMethodDescriptors> input_methods(GetActiveInputMethods()); | 255 scoped_ptr<InputMethodDescriptors> input_methods(GetActiveInputMethods()); |
258 return input_methods->size(); | 256 return input_methods->size(); |
259 } | 257 } |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 return InputMethodManagerImpl::GetInstance(); | 1382 return InputMethodManagerImpl::GetInstance(); |
1385 } | 1383 } |
1386 | 1384 |
1387 } // namespace input_method | 1385 } // namespace input_method |
1388 } // namespace chromeos | 1386 } // namespace chromeos |
1389 | 1387 |
1390 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1388 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
1391 // won't be deleted until it's last InvokeLater is run. | 1389 // won't be deleted until it's last InvokeLater is run. |
1392 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 1390 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
1393 chromeos::input_method::InputMethodManagerImpl); | 1391 chromeos::input_method::InputMethodManagerImpl); |
OLD | NEW |