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

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

Issue 2420393002: Block shelf auto hidden when opt-in IME menu is shown. (Closed)
Patch Set: Block shelf auto hide. Created 4 years, 2 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_util.h" 12 #include "ash/common/shelf/wm_shelf_util.h"
12 #include "ash/common/shell_window_ids.h" 13 #include "ash/common/shell_window_ids.h"
13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 14 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
14 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 15 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
15 #include "ash/common/system/tray/hover_highlight_view.h" 16 #include "ash/common/system/tray/hover_highlight_view.h"
16 #include "ash/common/system/tray/system_tray_controller.h" 17 #include "ash/common/system/tray/system_tray_controller.h"
17 #include "ash/common/system/tray/system_tray_delegate.h" 18 #include "ash/common/system/tray/system_tray_delegate.h"
18 #include "ash/common/system/tray/system_tray_notifier.h" 19 #include "ash/common/system/tray/system_tray_notifier.h"
19 #include "ash/common/system/tray/tray_constants.h" 20 #include "ash/common/system/tray/tray_constants.h"
20 #include "ash/common/system/tray/tray_popup_header_button.h" 21 #include "ash/common/system/tray/tray_popup_header_button.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 DISALLOW_COPY_AND_ASSIGN(ImeButtonsView); 272 DISALLOW_COPY_AND_ASSIGN(ImeButtonsView);
272 }; 273 };
273 274
274 } // namespace 275 } // namespace
275 276
276 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf) 277 ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf)
277 : TrayBackgroundView(wm_shelf), 278 : TrayBackgroundView(wm_shelf),
278 label_(new ImeMenuLabel()), 279 label_(new ImeMenuLabel()),
279 show_keyboard_(false), 280 show_keyboard_(false),
280 force_show_keyboard_(false) { 281 force_show_keyboard_(false),
282 should_block_shelf_auto_hide_(false) {
281 SetupLabelForTray(label_); 283 SetupLabelForTray(label_);
282 tray_container()->AddChildView(label_); 284 tray_container()->AddChildView(label_);
283 SetContentsBackground(); 285 SetContentsBackground();
284 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); 286 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this);
285 } 287 }
286 288
287 ImeMenuTray::~ImeMenuTray() { 289 ImeMenuTray::~ImeMenuTray() {
288 if (bubble_) 290 if (bubble_)
289 bubble_->bubble_view()->reset_delegate(); 291 bubble_->bubble_view()->reset_delegate();
290 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); 292 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 bubble_view->AddChildView( 346 bubble_view->AddChildView(
345 new ImeButtonsView(this, true, true, true, true)); 347 new ImeButtonsView(this, true, true, true, true));
346 } else { 348 } else {
347 bubble_view->AddChildView( 349 bubble_view->AddChildView(
348 new ImeButtonsView(this, false, false, false, true)); 350 new ImeButtonsView(this, false, false, false, true));
349 } 351 }
350 } 352 }
351 353
352 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); 354 bubble_.reset(new TrayBubbleWrapper(this, bubble_view));
353 SetDrawBackgroundAsActive(true); 355 SetDrawBackgroundAsActive(true);
356 should_block_shelf_auto_hide_ = true;
354 } 357 }
355 358
356 void ImeMenuTray::HideImeMenuBubble() { 359 void ImeMenuTray::HideImeMenuBubble() {
357 bubble_.reset(); 360 bubble_.reset();
358 ime_list_view_ = nullptr; 361 ime_list_view_ = nullptr;
359 SetDrawBackgroundAsActive(false); 362 SetDrawBackgroundAsActive(false);
363 should_block_shelf_auto_hide_ = false;
360 } 364 }
361 365
362 bool ImeMenuTray::IsImeMenuBubbleShown() { 366 bool ImeMenuTray::IsImeMenuBubbleShown() {
363 return !!bubble_; 367 return !!bubble_;
364 } 368 }
365 369
366 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { 370 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) {
367 HideImeMenuBubble(); 371 HideImeMenuBubble();
368 372
369 // Overrides the keyboard url ref to make it shown with the given keyset. 373 // Overrides the keyboard url ref to make it shown with the given keyset.
(...skipping 20 matching lines...) Expand all
390 // keyboard for one time. 394 // keyboard for one time.
391 force_show_keyboard_ = true; 395 force_show_keyboard_ = true;
392 accessibility_delegate->SetVirtualKeyboardEnabled(true); 396 accessibility_delegate->SetVirtualKeyboardEnabled(true);
393 keyboard_controller = keyboard::KeyboardController::GetInstance(); 397 keyboard_controller = keyboard::KeyboardController::GetInstance();
394 if (keyboard_controller) { 398 if (keyboard_controller) {
395 keyboard_controller->AddObserver(this); 399 keyboard_controller->AddObserver(this);
396 keyboard_controller->ShowKeyboard(false); 400 keyboard_controller->ShowKeyboard(false);
397 } 401 }
398 } 402 }
399 403
404 bool ImeMenuTray::ShouldBlockShelfAutoHide() const {
405 return should_block_shelf_auto_hide_;
406 }
407
400 void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) { 408 void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) {
401 TrayBackgroundView::SetShelfAlignment(alignment); 409 TrayBackgroundView::SetShelfAlignment(alignment);
402 if (!MaterialDesignController::IsShelfMaterial()) 410 if (!MaterialDesignController::IsShelfMaterial())
403 tray_container()->SetBorder(views::Border::NullBorder()); 411 tray_container()->SetBorder(views::Border::NullBorder());
404 } 412 }
405 413
406 base::string16 ImeMenuTray::GetAccessibleNameForTray() { 414 base::string16 ImeMenuTray::GetAccessibleNameForTray() {
407 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME); 415 return l10n_util::GetStringUTF16(IDS_ASH_IME_MENU_ACCESSIBLE_NAME);
408 } 416 }
409 417
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_); 537 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
530 538
531 // Updates the tray label based on the current input method. 539 // Updates the tray label based on the current input method.
532 if (current_ime_.third_party) 540 if (current_ime_.third_party)
533 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); 541 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*"));
534 else 542 else
535 label_->SetText(current_ime_.short_name); 543 label_->SetText(current_ime_.short_name);
536 } 544 }
537 545
538 } // namespace ash 546 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.h ('k') | ash/common/system/status_area_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698