| 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_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> // std::find | 7 #include <algorithm> // std::find |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| 11 #include "ash/ime/input_method_menu_item.h" | |
| 12 #include "ash/ime/input_method_menu_manager.h" | |
| 13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 14 #include "base/bind.h" | 12 #include "base/bind.h" |
| 15 #include "base/location.h" | 13 #include "base/location.h" |
| 16 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 18 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 19 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 20 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 21 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 23 #include "base/sys_info.h" | 21 #include "base/sys_info.h" |
| 24 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" | 23 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
| 26 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" | 24 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i
mpl.h" |
| 27 #include "chrome/browser/chromeos/input_method/input_method_engine.h" | 25 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 28 #include "chrome/browser/chromeos/language_preferences.h" | 26 #include "chrome/browser/chromeos/language_preferences.h" |
| 29 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 27 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 28 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 32 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 33 #include "chromeos/ime/component_extension_ime_manager.h" | 31 #include "chromeos/ime/component_extension_ime_manager.h" |
| 34 #include "chromeos/ime/extension_ime_util.h" | 32 #include "chromeos/ime/extension_ime_util.h" |
| 35 #include "chromeos/ime/fake_ime_keyboard.h" | 33 #include "chromeos/ime/fake_ime_keyboard.h" |
| 36 #include "chromeos/ime/ime_keyboard.h" | 34 #include "chromeos/ime/ime_keyboard.h" |
| 37 #include "chromeos/ime/input_method_delegate.h" | 35 #include "chromeos/ime/input_method_delegate.h" |
| 38 #include "components/user_manager/user_manager.h" | 36 #include "components/user_manager/user_manager.h" |
| 39 #include "third_party/icu/source/common/unicode/uloc.h" | 37 #include "third_party/icu/source/common/unicode/uloc.h" |
| 40 #include "ui/base/accelerators/accelerator.h" | 38 #include "ui/base/accelerators/accelerator.h" |
| 39 #include "ui/chromeos/ime/input_method_menu_item.h" |
| 40 #include "ui/chromeos/ime/input_method_menu_manager.h" |
| 41 #include "ui/keyboard/keyboard_controller.h" | 41 #include "ui/keyboard/keyboard_controller.h" |
| 42 #include "ui/keyboard/keyboard_util.h" | 42 #include "ui/keyboard/keyboard_util.h" |
| 43 | 43 |
| 44 namespace chromeos { | 44 namespace chromeos { |
| 45 namespace input_method { | 45 namespace input_method { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 bool Contains(const std::vector<std::string>& container, | 49 bool Contains(const std::vector<std::string>& container, |
| 50 const std::string& value) { | 50 const std::string& value) { |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 return; | 975 return; |
| 976 | 976 |
| 977 if (candidate_window_controller_.get()) | 977 if (candidate_window_controller_.get()) |
| 978 candidate_window_controller_->Hide(); | 978 candidate_window_controller_->Hide(); |
| 979 | 979 |
| 980 if (notify_menu) { | 980 if (notify_menu) { |
| 981 // Clear property list. Property list would be updated by | 981 // Clear property list. Property list would be updated by |
| 982 // extension IMEs via InputMethodEngine::(Set|Update)MenuItems. | 982 // extension IMEs via InputMethodEngine::(Set|Update)MenuItems. |
| 983 // If the current input method is a keyboard layout, empty | 983 // If the current input method is a keyboard layout, empty |
| 984 // properties are sufficient. | 984 // properties are sufficient. |
| 985 const ash::ime::InputMethodMenuItemList empty_menu_item_list; | 985 const ui::ime::InputMethodMenuItemList empty_menu_item_list; |
| 986 ash::ime::InputMethodMenuManager* input_method_menu_manager = | 986 ui::ime::InputMethodMenuManager* input_method_menu_manager = |
| 987 ash::ime::InputMethodMenuManager::GetInstance(); | 987 ui::ime::InputMethodMenuManager::GetInstance(); |
| 988 input_method_menu_manager->SetCurrentInputMethodMenuItemList( | 988 input_method_menu_manager->SetCurrentInputMethodMenuItemList( |
| 989 empty_menu_item_list); | 989 empty_menu_item_list); |
| 990 } | 990 } |
| 991 | 991 |
| 992 // Disable the current engine handler. | 992 // Disable the current engine handler. |
| 993 IMEEngineHandlerInterface* engine = | 993 IMEEngineHandlerInterface* engine = |
| 994 IMEBridge::Get()->GetCurrentEngineHandler(); | 994 IMEBridge::Get()->GetCurrentEngineHandler(); |
| 995 if (engine) | 995 if (engine) |
| 996 engine->Disable(); | 996 engine->Disable(); |
| 997 | 997 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 | 1054 |
| 1055 state->active_input_method_ids.push_back(unfiltered_input_method_ids[i]); | 1055 state->active_input_method_ids.push_back(unfiltered_input_method_ids[i]); |
| 1056 } | 1056 } |
| 1057 } | 1057 } |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 void InputMethodManagerImpl::ActivateInputMethodMenuItem( | 1060 void InputMethodManagerImpl::ActivateInputMethodMenuItem( |
| 1061 const std::string& key) { | 1061 const std::string& key) { |
| 1062 DCHECK(!key.empty()); | 1062 DCHECK(!key.empty()); |
| 1063 | 1063 |
| 1064 if (ash::ime::InputMethodMenuManager::GetInstance()-> | 1064 if (ui::ime::InputMethodMenuManager::GetInstance()-> |
| 1065 HasInputMethodMenuItemForKey(key)) { | 1065 HasInputMethodMenuItemForKey(key)) { |
| 1066 IMEEngineHandlerInterface* engine = | 1066 IMEEngineHandlerInterface* engine = |
| 1067 IMEBridge::Get()->GetCurrentEngineHandler(); | 1067 IMEBridge::Get()->GetCurrentEngineHandler(); |
| 1068 if (engine) | 1068 if (engine) |
| 1069 engine->PropertyActivate(key); | 1069 engine->PropertyActivate(key); |
| 1070 return; | 1070 return; |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 DVLOG(1) << "ActivateInputMethodMenuItem: unknown key: " << key; | 1073 DVLOG(1) << "ActivateInputMethodMenuItem: unknown key: " << key; |
| 1074 } | 1074 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 if (candidate_window_controller_.get()) | 1153 if (candidate_window_controller_.get()) |
| 1154 return; | 1154 return; |
| 1155 | 1155 |
| 1156 candidate_window_controller_.reset( | 1156 candidate_window_controller_.reset( |
| 1157 CandidateWindowController::CreateCandidateWindowController()); | 1157 CandidateWindowController::CreateCandidateWindowController()); |
| 1158 candidate_window_controller_->AddObserver(this); | 1158 candidate_window_controller_->AddObserver(this); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 } // namespace input_method | 1161 } // namespace input_method |
| 1162 } // namespace chromeos | 1162 } // namespace chromeos |
| OLD | NEW |