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

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

Issue 2432163006: Show/Hide the shelf when showing/hiding IME menu. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this); 286 WmShell::Get()->system_tray_notifier()->AddIMEObserver(this);
287 } 287 }
288 288
289 ImeMenuTray::~ImeMenuTray() { 289 ImeMenuTray::~ImeMenuTray() {
290 if (bubble_) 290 if (bubble_)
291 bubble_->bubble_view()->reset_delegate(); 291 bubble_->bubble_view()->reset_delegate();
292 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this); 292 WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this);
293 } 293 }
294 294
295 void ImeMenuTray::ShowImeMenuBubble() { 295 void ImeMenuTray::ShowImeMenuBubble() {
296 should_block_shelf_auto_hide_ = true;
296 views::TrayBubbleView::InitParams init_params( 297 views::TrayBubbleView::InitParams init_params(
297 views::TrayBubbleView::ANCHOR_TYPE_TRAY, GetAnchorAlignment(), 298 views::TrayBubbleView::ANCHOR_TYPE_TRAY, GetAnchorAlignment(),
298 kTrayPopupMinWidth, kTrayPopupMaxWidth); 299 kTrayPopupMinWidth, kTrayPopupMaxWidth);
299 init_params.first_item_has_no_margin = true; 300 init_params.first_item_has_no_margin = true;
300 init_params.can_activate = true; 301 init_params.can_activate = true;
301 init_params.close_on_deactivate = true; 302 init_params.close_on_deactivate = true;
302 303
303 views::TrayBubbleView* bubble_view = 304 views::TrayBubbleView* bubble_view =
304 views::TrayBubbleView::Create(tray_container(), this, &init_params); 305 views::TrayBubbleView::Create(tray_container(), this, &init_params);
305 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0)); 306 bubble_view->set_margins(gfx::Insets(7, 0, 0, 0));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 bubble_view->AddChildView( 347 bubble_view->AddChildView(
347 new ImeButtonsView(this, true, true, true, true)); 348 new ImeButtonsView(this, true, true, true, true));
348 } else { 349 } else {
349 bubble_view->AddChildView( 350 bubble_view->AddChildView(
350 new ImeButtonsView(this, false, false, false, true)); 351 new ImeButtonsView(this, false, false, false, true));
351 } 352 }
352 } 353 }
353 354
354 bubble_.reset(new TrayBubbleWrapper(this, bubble_view)); 355 bubble_.reset(new TrayBubbleWrapper(this, bubble_view));
355 SetDrawBackgroundAsActive(true); 356 SetDrawBackgroundAsActive(true);
356 should_block_shelf_auto_hide_ = true;
357 } 357 }
358 358
359 void ImeMenuTray::HideImeMenuBubble() { 359 void ImeMenuTray::HideImeMenuBubble() {
360 bubble_.reset(); 360 bubble_.reset();
361 ime_list_view_ = nullptr; 361 ime_list_view_ = nullptr;
362 SetDrawBackgroundAsActive(false); 362 SetDrawBackgroundAsActive(false);
363 should_block_shelf_auto_hide_ = false; 363 should_block_shelf_auto_hide_ = false;
364 shelf()->UpdateAutoHideState();
364 } 365 }
365 366
366 bool ImeMenuTray::IsImeMenuBubbleShown() { 367 bool ImeMenuTray::IsImeMenuBubbleShown() {
367 return !!bubble_; 368 return !!bubble_;
368 } 369 }
369 370
370 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { 371 void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) {
371 HideImeMenuBubble(); 372 HideImeMenuBubble();
372 373
373 // Overrides the keyboard url ref to make it shown with the given keyset. 374 // Overrides the keyboard url ref to make it shown with the given keyset.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_); 538 WmShell::Get()->system_tray_delegate()->GetCurrentIME(&current_ime_);
538 539
539 // Updates the tray label based on the current input method. 540 // Updates the tray label based on the current input method.
540 if (current_ime_.third_party) 541 if (current_ime_.third_party)
541 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); 542 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*"));
542 else 543 else
543 label_->SetText(current_ime_.short_name); 544 label_->SetText(current_ime_.short_name);
544 } 545 }
545 546
546 } // namespace ash 547 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698