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

Unified Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc

Issue 2474843002: Add virtual keyboard item into opt-in IME menu. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
index 274c134d43975e4b5c4a909a3f7a12231b7beb80..6af9ab516c84ecc71f9ddb36acda0dc3242ee5c6 100644
--- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
+++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
@@ -300,7 +300,8 @@ ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf)
label_(new ImeMenuLabel()),
show_keyboard_(false),
force_show_keyboard_(false),
- should_block_shelf_auto_hide_(false) {
+ should_block_shelf_auto_hide_(false),
+ keyboard_suppressed_(false) {
if (MaterialDesignController::IsShelfMaterial()) {
SetInkDropMode(InkDropMode::ON);
SetContentsBackground(false);
@@ -309,13 +310,17 @@ ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf)
}
SetupLabelForTray(label_);
tray_container()->AddChildView(label_);
- WmShell::Get()->system_tray_notifier()->AddIMEObserver(this);
+ SystemTrayNotifier* tray_notifier = WmShell::Get()->system_tray_notifier();
+ tray_notifier->AddIMEObserver(this);
+ tray_notifier->AddVirtualKeyboardObserver(this);
}
ImeMenuTray::~ImeMenuTray() {
if (bubble_)
bubble_->bubble_view()->reset_delegate();
- WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this);
+ SystemTrayNotifier* tray_notifier = WmShell::Get()->system_tray_notifier();
+ tray_notifier->RemoveIMEObserver(this);
+ tray_notifier->RemoveVirtualKeyboardObserver(this);
}
void ImeMenuTray::ShowImeMenuBubble() {
@@ -341,8 +346,8 @@ void ImeMenuTray::ShowImeMenuBubble() {
}
// Adds IME list to the bubble.
- ime_list_view_ =
- new ImeListView(nullptr, false, ImeListView::SHOW_SINGLE_IME);
+ ime_list_view_ = new ImeListView(nullptr, ShouldShowKeyboardToggle(),
+ ImeListView::SHOW_SINGLE_IME);
uint32_t current_height = ime_list_view_->scroll_content()->height();
const gfx::Range height_range = GetImeListViewRange();
@@ -433,6 +438,11 @@ bool ImeMenuTray::ShouldShowEmojiHandwritingVoiceButtons() const {
!current_ime_.third_party;
}
+bool ImeMenuTray::ShouldShowKeyboardToggle() const {
+ return keyboard_suppressed_ &&
+ !WmShell::Get()->accessibility_delegate()->IsVirtualKeyboardEnabled();
+}
+
void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) {
TrayBackgroundView::SetShelfAlignment(alignment);
if (!MaterialDesignController::IsShelfMaterial())
@@ -541,6 +551,12 @@ void ImeMenuTray::OnKeyboardHidden() {
force_show_keyboard_ = false;
}
+void ImeMenuTray::OnKeyboardSuppressionChanged(bool suppressed) {
+ if (suppressed != keyboard_suppressed_ && bubble_)
+ HideImeMenuBubble();
+ keyboard_suppressed_ = suppressed;
+}
+
void ImeMenuTray::UpdateTrayLabel() {
WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698