| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_menu/ime_menu_tray.h" | 5 #include "ash/system/ime_menu/ime_menu_tray.h" |
| 6 | 6 |
| 7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/ash_constants.h" | 8 #include "ash/ash_constants.h" |
| 9 #include "ash/resources/grit/ash_resources.h" | 9 #include "ash/resources/grit/ash_resources.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
| 12 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/shell_port.h" | 14 #include "ash/shell_port.h" |
| 15 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
| 16 #include "ash/system/ime/ime_util.h" |
| 16 #include "ash/system/ime_menu/ime_list_view.h" | 17 #include "ash/system/ime_menu/ime_list_view.h" |
| 17 #include "ash/system/tray/system_menu_button.h" | 18 #include "ash/system/tray/system_menu_button.h" |
| 18 #include "ash/system/tray/system_tray_controller.h" | 19 #include "ash/system/tray/system_tray_controller.h" |
| 19 #include "ash/system/tray/system_tray_delegate.h" | |
| 20 #include "ash/system/tray/system_tray_notifier.h" | 20 #include "ash/system/tray/system_tray_notifier.h" |
| 21 #include "ash/system/tray/tray_constants.h" | 21 #include "ash/system/tray/tray_constants.h" |
| 22 #include "ash/system/tray/tray_container.h" | 22 #include "ash/system/tray/tray_container.h" |
| 23 #include "ash/system/tray/tray_popup_item_style.h" | 23 #include "ash/system/tray/tray_popup_item_style.h" |
| 24 #include "ash/system/tray/tray_popup_utils.h" | 24 #include "ash/system/tray/tray_popup_utils.h" |
| 25 #include "ash/system/tray/tray_utils.h" | 25 #include "ash/system/tray/tray_utils.h" |
| 26 #include "base/metrics/histogram_macros.h" | 26 #include "base/metrics/histogram_macros.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
| 28 #include "components/session_manager/session_manager_types.h" | 28 #include "components/session_manager/session_manager_types.h" |
| 29 #include "ui/base/ime/chromeos/input_method_manager.h" | 29 #include "ui/base/ime/chromeos/input_method_manager.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (bubble_) | 438 if (bubble_) |
| 439 HideImeMenuBubble(); | 439 HideImeMenuBubble(); |
| 440 else | 440 else |
| 441 ShowImeMenuBubble(); | 441 ShowImeMenuBubble(); |
| 442 return true; | 442 return true; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void ImeMenuTray::OnIMERefresh() { | 445 void ImeMenuTray::OnIMERefresh() { |
| 446 UpdateTrayLabel(); | 446 UpdateTrayLabel(); |
| 447 if (bubble_ && ime_list_view_) { | 447 if (bubble_ && ime_list_view_) { |
| 448 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); | 448 IMEInfoList list = ime_util::GetAvailableIMEList(); |
| 449 IMEInfoList list; | 449 IMEPropertyInfoList property_list = ime_util::GetCurrentIMEProperties(); |
| 450 delegate->GetAvailableIMEList(&list); | |
| 451 IMEPropertyInfoList property_list; | |
| 452 delegate->GetCurrentIMEProperties(&property_list); | |
| 453 ime_list_view_->Update(list, property_list, false, | 450 ime_list_view_->Update(list, property_list, false, |
| 454 ImeListView::SHOW_SINGLE_IME); | 451 ImeListView::SHOW_SINGLE_IME); |
| 455 } | 452 } |
| 456 } | 453 } |
| 457 | 454 |
| 458 void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) { | 455 void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) { |
| 459 SetVisible(is_activated); | 456 SetVisible(is_activated); |
| 460 if (is_activated) | 457 if (is_activated) |
| 461 UpdateTrayLabel(); | 458 UpdateTrayLabel(); |
| 462 else | 459 else |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 weak_ptr_factory_.GetWeakPtr())); | 526 weak_ptr_factory_.GetWeakPtr())); |
| 530 } | 527 } |
| 531 | 528 |
| 532 void ImeMenuTray::OnKeyboardSuppressionChanged(bool suppressed) { | 529 void ImeMenuTray::OnKeyboardSuppressionChanged(bool suppressed) { |
| 533 if (suppressed != keyboard_suppressed_ && bubble_) | 530 if (suppressed != keyboard_suppressed_ && bubble_) |
| 534 HideImeMenuBubble(); | 531 HideImeMenuBubble(); |
| 535 keyboard_suppressed_ = suppressed; | 532 keyboard_suppressed_ = suppressed; |
| 536 } | 533 } |
| 537 | 534 |
| 538 void ImeMenuTray::UpdateTrayLabel() { | 535 void ImeMenuTray::UpdateTrayLabel() { |
| 539 Shell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 536 current_ime_ = ime_util::GetCurrentIME(); |
| 540 | 537 |
| 541 // Updates the tray label based on the current input method. | 538 // Updates the tray label based on the current input method. |
| 542 if (current_ime_.third_party) | 539 if (current_ime_.third_party) |
| 543 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 540 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
| 544 else | 541 else |
| 545 label_->SetText(current_ime_.short_name); | 542 label_->SetText(current_ime_.short_name); |
| 546 } | 543 } |
| 547 | 544 |
| 548 void ImeMenuTray::DisableVirtualKeyboard() { | 545 void ImeMenuTray::DisableVirtualKeyboard() { |
| 549 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); | 546 Shell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); |
| 550 force_show_keyboard_ = false; | 547 force_show_keyboard_ = false; |
| 551 } | 548 } |
| 552 | 549 |
| 553 } // namespace ash | 550 } // namespace ash |
| OLD | NEW |