Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc

Issue 2738133003: Promotes a handful of members from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/system/chromeos/ime_menu/ime_menu_tray.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h"
6 6
7 #include "ash/common/accessibility_delegate.h" 7 #include "ash/common/accessibility_delegate.h"
8 #include "ash/common/ash_constants.h" 8 #include "ash/common/ash_constants.h"
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
11 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/shelf/wm_shelf_util.h" 12 #include "ash/common/shelf/wm_shelf_util.h"
13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
14 #include "ash/common/system/tray/hover_highlight_view.h" 14 #include "ash/common/system/tray/hover_highlight_view.h"
15 #include "ash/common/system/tray/system_menu_button.h" 15 #include "ash/common/system/tray/system_menu_button.h"
16 #include "ash/common/system/tray/system_tray_controller.h" 16 #include "ash/common/system/tray/system_tray_controller.h"
17 #include "ash/common/system/tray/system_tray_delegate.h" 17 #include "ash/common/system/tray/system_tray_delegate.h"
18 #include "ash/common/system/tray/system_tray_notifier.h" 18 #include "ash/common/system/tray/system_tray_notifier.h"
19 #include "ash/common/system/tray/tray_constants.h" 19 #include "ash/common/system/tray/tray_constants.h"
20 #include "ash/common/system/tray/tray_popup_item_style.h" 20 #include "ash/common/system/tray/tray_popup_item_style.h"
21 #include "ash/common/system/tray/tray_popup_utils.h" 21 #include "ash/common/system/tray/tray_popup_utils.h"
22 #include "ash/common/system/tray/tray_utils.h" 22 #include "ash/common/system/tray/tray_utils.h"
23 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
25 #include "ash/public/cpp/shell_window_ids.h" 25 #include "ash/public/cpp/shell_window_ids.h"
26 #include "ash/resources/grit/ash_resources.h" 26 #include "ash/resources/grit/ash_resources.h"
27 #include "ash/root_window_controller.h" 27 #include "ash/root_window_controller.h"
28 #include "ash/shell.h"
28 #include "ash/strings/grit/ash_strings.h" 29 #include "ash/strings/grit/ash_strings.h"
29 #include "base/metrics/histogram_macros.h" 30 #include "base/metrics/histogram_macros.h"
30 #include "base/strings/utf_string_conversions.h" 31 #include "base/strings/utf_string_conversions.h"
31 #include "ui/base/ime/chromeos/input_method_manager.h" 32 #include "ui/base/ime/chromeos/input_method_manager.h"
32 #include "ui/base/ime/ime_bridge.h" 33 #include "ui/base/ime/ime_bridge.h"
33 #include "ui/base/ime/text_input_client.h" 34 #include "ui/base/ime/text_input_client.h"
34 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/paint_vector_icon.h" 37 #include "ui/gfx/paint_vector_icon.h"
37 #include "ui/gfx/range/range.h" 38 #include "ui/gfx/range/range.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // relying the extension to show the keyboard, forcibly show the keyboard 464 // relying the extension to show the keyboard, forcibly show the keyboard
464 // window here (which will cause the keyboard window to be created). 465 // window here (which will cause the keyboard window to be created).
465 // Otherwise, the extension will show keyboard by calling private api. The 466 // Otherwise, the extension will show keyboard by calling private api. The
466 // native side could just skip showing the keyboard. 467 // native side could just skip showing the keyboard.
467 if (!keyboard_controller->IsKeyboardWindowCreated()) 468 if (!keyboard_controller->IsKeyboardWindowCreated())
468 keyboard_controller->ShowKeyboard(false); 469 keyboard_controller->ShowKeyboard(false);
469 return; 470 return;
470 } 471 }
471 472
472 AccessibilityDelegate* accessibility_delegate = 473 AccessibilityDelegate* accessibility_delegate =
473 WmShell::Get()->accessibility_delegate(); 474 Shell::GetInstance()->accessibility_delegate();
474 // Fails to show the keyboard. 475 // Fails to show the keyboard.
475 if (accessibility_delegate->IsVirtualKeyboardEnabled()) 476 if (accessibility_delegate->IsVirtualKeyboardEnabled())
476 return; 477 return;
477 478
478 // Onscreen keyboard has not been enabled yet, forces to bring out the 479 // Onscreen keyboard has not been enabled yet, forces to bring out the
479 // keyboard for one time. 480 // keyboard for one time.
480 force_show_keyboard_ = true; 481 force_show_keyboard_ = true;
481 accessibility_delegate->SetVirtualKeyboardEnabled(true); 482 accessibility_delegate->SetVirtualKeyboardEnabled(true);
482 keyboard_controller = keyboard::KeyboardController::GetInstance(); 483 keyboard_controller = keyboard::KeyboardController::GetInstance();
483 if (keyboard_controller) { 484 if (keyboard_controller) {
(...skipping 12 matching lines...) Expand all
496 // 2) third party IME extensions. 497 // 2) third party IME extensions.
497 // 3) login/lock screen. 498 // 3) login/lock screen.
498 // 4) password input client. 499 // 4) password input client.
499 return InputMethodManager::Get() && 500 return InputMethodManager::Get() &&
500 InputMethodManager::Get()->IsEmojiHandwritingVoiceOnImeMenuEnabled() && 501 InputMethodManager::Get()->IsEmojiHandwritingVoiceOnImeMenuEnabled() &&
501 !current_ime_.third_party && !IsInLoginOrLockScreen() && 502 !current_ime_.third_party && !IsInLoginOrLockScreen() &&
502 !IsInPasswordInputContext(); 503 !IsInPasswordInputContext();
503 } 504 }
504 505
505 bool ImeMenuTray::ShouldShowKeyboardToggle() const { 506 bool ImeMenuTray::ShouldShowKeyboardToggle() const {
506 return keyboard_suppressed_ && 507 return keyboard_suppressed_ && !Shell::GetInstance()
507 !WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled(); 508 ->accessibility_delegate()
509 ->IsVirtualKeyboardEnabled();
508 } 510 }
509 511
510 void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) { 512 void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) {
511 TrayBackgroundView::SetShelfAlignment(alignment); 513 TrayBackgroundView::SetShelfAlignment(alignment);
512 if (!MaterialDesignController::IsShelfMaterial()) 514 if (!MaterialDesignController::IsShelfMaterial())
513 tray_container()->SetBorder(views::NullBorder()); 515 tray_container()->SetBorder(views::NullBorder());
514 } 516 }
515 517
516 base::string16 ImeMenuTray::GetAccessibleNameForTray() { 518 base::string16 ImeMenuTray::GetAccessibleNameForTray() {
517 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); 519 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // If the keyboard is forced to be shown by IME menu for once, we need to 621 // If the keyboard is forced to be shown by IME menu for once, we need to
620 // disable the keyboard when it's hidden. 622 // disable the keyboard when it's hidden.
621 keyboard::KeyboardController* keyboard_controller = 623 keyboard::KeyboardController* keyboard_controller =
622 keyboard::KeyboardController::GetInstance(); 624 keyboard::KeyboardController::GetInstance();
623 if (keyboard_controller) 625 if (keyboard_controller)
624 keyboard_controller->RemoveObserver(this); 626 keyboard_controller->RemoveObserver(this);
625 627
626 if (!force_show_keyboard_) 628 if (!force_show_keyboard_)
627 return; 629 return;
628 630
629 WmShell::Get()->accessibility_delegate()->SetVirtualKeyboardEnabled(false); 631 Shell::GetInstance()->accessibility_delegate()->SetVirtualKeyboardEnabled(
632 false);
630 force_show_keyboard_ = false; 633 force_show_keyboard_ = false;
631 } 634 }
632 635
633 void ImeMenuTray::OnKeyboardSuppressionChanged(bool suppressed) { 636 void ImeMenuTray::OnKeyboardSuppressionChanged(bool suppressed) {
634 if (suppressed != keyboard_suppressed_ && bubble_) 637 if (suppressed != keyboard_suppressed_ && bubble_)
635 HideImeMenuBubble(); 638 HideImeMenuBubble();
636 keyboard_suppressed_ = suppressed; 639 keyboard_suppressed_ = suppressed;
637 } 640 }
638 641
639 void ImeMenuTray::UpdateTrayLabel() { 642 void ImeMenuTray::UpdateTrayLabel() {
640 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_); 643 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
641 644
642 // Updates the tray label based on the current input method. 645 // Updates the tray label based on the current input method.
643 if (current_ime_.third_party) 646 if (current_ime_.third_party)
644 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); 647 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*"));
645 else 648 else
646 label_->SetText(current_ime_.short_name); 649 label_->SetText(current_ime_.short_name);
647 } 650 }
648 651
649 } // namespace ash 652 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_widget.cc ('k') | ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698