| 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 "ash/system/ime/tray_ime_chromeos.h" | 5 #include "ash/system/ime/tray_ime_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
| 13 #include "ash/strings/grit/ash_strings.h" | 13 #include "ash/strings/grit/ash_strings.h" |
| 14 #include "ash/system/ime/ime_util.h" |
| 14 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/system/tray/system_tray_controller.h" | 16 #include "ash/system/tray/system_tray_controller.h" |
| 16 #include "ash/system/tray/system_tray_delegate.h" | |
| 17 #include "ash/system/tray/system_tray_notifier.h" | 17 #include "ash/system/tray/system_tray_notifier.h" |
| 18 #include "ash/system/tray/tray_constants.h" | 18 #include "ash/system/tray/tray_constants.h" |
| 19 #include "ash/system/tray/tray_details_view.h" | 19 #include "ash/system/tray/tray_details_view.h" |
| 20 #include "ash/system/tray/tray_item_more.h" | 20 #include "ash/system/tray/tray_item_more.h" |
| 21 #include "ash/system/tray/tray_item_view.h" | 21 #include "ash/system/tray/tray_item_view.h" |
| 22 #include "ash/system/tray/tray_popup_item_style.h" | 22 #include "ash/system/tray/tray_popup_item_style.h" |
| 23 #include "ash/system/tray/tray_popup_utils.h" | 23 #include "ash/system/tray/tray_popup_utils.h" |
| 24 #include "ash/system/tray/tray_utils.h" | 24 #include "ash/system/tray/tray_utils.h" |
| 25 #include "ash/system/tray/tri_view.h" | 25 #include "ash/system/tray/tri_view.h" |
| 26 #include "ash/system/tray_accessibility.h" | 26 #include "ash/system/tray_accessibility.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool TrayIME::ShouldShowKeyboardToggle() { | 211 bool TrayIME::ShouldShowKeyboardToggle() { |
| 212 return keyboard_suppressed_ && | 212 return keyboard_suppressed_ && |
| 213 !Shell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); | 213 !Shell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 base::string16 TrayIME::GetDefaultViewLabel(bool show_ime_label) { | 216 base::string16 TrayIME::GetDefaultViewLabel(bool show_ime_label) { |
| 217 if (show_ime_label) { | 217 if (show_ime_label) { |
| 218 IMEInfo current; | 218 IMEInfo current = ime_util::GetCurrentIME(); |
| 219 Shell::Get()->system_tray_delegate()->GetCurrentIME(¤t); | |
| 220 return current.name; | 219 return current.name; |
| 221 } else { | 220 } else { |
| 222 // Display virtual keyboard status instead. | 221 // Display virtual keyboard status instead. |
| 223 int id = keyboard::IsKeyboardEnabled() | 222 int id = keyboard::IsKeyboardEnabled() |
| 224 ? IDS_ASH_STATUS_TRAY_KEYBOARD_ENABLED | 223 ? IDS_ASH_STATUS_TRAY_KEYBOARD_ENABLED |
| 225 : IDS_ASH_STATUS_TRAY_KEYBOARD_DISABLED; | 224 : IDS_ASH_STATUS_TRAY_KEYBOARD_DISABLED; |
| 226 return l10n_util::GetStringUTF16(id); | 225 return l10n_util::GetStringUTF16(id); |
| 227 } | 226 } |
| 228 } | 227 } |
| 229 | 228 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void TrayIME::DestroyDefaultView() { | 260 void TrayIME::DestroyDefaultView() { |
| 262 default_ = NULL; | 261 default_ = NULL; |
| 263 } | 262 } |
| 264 | 263 |
| 265 void TrayIME::DestroyDetailedView() { | 264 void TrayIME::DestroyDetailedView() { |
| 266 detailed_ = NULL; | 265 detailed_ = NULL; |
| 267 } | 266 } |
| 268 | 267 |
| 269 void TrayIME::OnIMERefresh() { | 268 void TrayIME::OnIMERefresh() { |
| 270 // Caches the current ime state. | 269 // Caches the current ime state. |
| 271 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); | 270 current_ime_ = ime_util::GetCurrentIME(); |
| 272 ime_list_.clear(); | 271 ime_list_ = ime_util::GetAvailableIMEList(); |
| 273 property_list_.clear(); | 272 property_list_ = ime_util::GetCurrentIMEProperties(); |
| 274 delegate->GetCurrentIME(¤t_ime_); | |
| 275 delegate->GetAvailableIMEList(&ime_list_); | |
| 276 delegate->GetCurrentIMEProperties(&property_list_); | |
| 277 auto ime_state = InputMethodManager::Get()->GetActiveIMEState(); | 273 auto ime_state = InputMethodManager::Get()->GetActiveIMEState(); |
| 278 ime_managed_message_ = | 274 ime_managed_message_ = |
| 279 ime_state->GetAllowedInputMethods().empty() | 275 ime_state->GetAllowedInputMethods().empty() |
| 280 ? base::string16() | 276 ? base::string16() |
| 281 : l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY); | 277 : l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY); |
| 282 | 278 |
| 283 Update(); | 279 Update(); |
| 284 } | 280 } |
| 285 | 281 |
| 286 void TrayIME::OnIMEMenuActivationChanged(bool is_active) { | 282 void TrayIME::OnIMEMenuActivationChanged(bool is_active) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 308 return ime_count >= threshold; | 304 return ime_count >= threshold; |
| 309 } | 305 } |
| 310 | 306 |
| 311 ImeListView::SingleImeBehavior TrayIME::GetSingleImeBehavior() { | 307 ImeListView::SingleImeBehavior TrayIME::GetSingleImeBehavior() { |
| 312 // If managed, we also want to show a single IME. | 308 // If managed, we also want to show a single IME. |
| 313 return IsIMEManaged() ? ImeListView::SHOW_SINGLE_IME | 309 return IsIMEManaged() ? ImeListView::SHOW_SINGLE_IME |
| 314 : ImeListView::HIDE_SINGLE_IME; | 310 : ImeListView::HIDE_SINGLE_IME; |
| 315 } | 311 } |
| 316 | 312 |
| 317 } // namespace ash | 313 } // namespace ash |
| OLD | NEW |