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

Side by Side Diff: ash/system/tray/tray_background_view.cc

Issue 1929203002: mash: Fix crash when clicking on the shelf overflow icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tray/tray_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_util.h" 10 #include "ash/shelf/shelf_util.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 if (GetWidget()) 257 if (GetWidget())
258 GetWidget()->RemoveObserver(widget_observer_.get()); 258 GetWidget()->RemoveObserver(widget_observer_.get());
259 StopObservingImplicitAnimations(); 259 StopObservingImplicitAnimations();
260 } 260 }
261 261
262 void TrayBackgroundView::Initialize() { 262 void TrayBackgroundView::Initialize() {
263 GetWidget()->AddObserver(widget_observer_.get()); 263 GetWidget()->AddObserver(widget_observer_.get());
264 SetTrayBorder(); 264 SetTrayBorder();
265 } 265 }
266 266
267 // static
268 void TrayBackgroundView::InitializeBubbleAnimations(
269 views::Widget* bubble_widget) {
270 ::wm::SetWindowVisibilityAnimationType(
271 bubble_widget->GetNativeWindow(),
msw 2016/04/28 23:57:36 optional nit: cache this
James Cook 2016/04/29 16:17:40 Done.
272 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
273 ::wm::SetWindowVisibilityAnimationTransition(bubble_widget->GetNativeWindow(),
274 ::wm::ANIMATE_HIDE);
275 ::wm::SetWindowVisibilityAnimationDuration(
276 bubble_widget->GetNativeWindow(),
277 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs));
278 }
279
267 void TrayBackgroundView::SetVisible(bool visible) { 280 void TrayBackgroundView::SetVisible(bool visible) {
268 if (visible == layer()->GetTargetVisibility()) 281 if (visible == layer()->GetTargetVisibility())
269 return; 282 return;
270 283
271 if (visible) { 284 if (visible) {
272 // The alignment of the shelf can change while the TrayBackgroundView is 285 // The alignment of the shelf can change while the TrayBackgroundView is
273 // hidden. Reset the offscreen transform so that the animation to becoming 286 // hidden. Reset the offscreen transform so that the animation to becoming
274 // visible reflects the current layout. 287 // visible reflects the current layout.
275 HideTransformation(); 288 HideTransformation();
276 // SetVisible(false) is defered until the animation for hiding is done. 289 // SetVisible(false) is defered until the animation for hiding is done.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 464
452 void TrayBackgroundView::HideTransformation() { 465 void TrayBackgroundView::HideTransformation() {
453 gfx::Transform transform; 466 gfx::Transform transform;
454 if (IsHorizontalAlignment(shelf_alignment_)) 467 if (IsHorizontalAlignment(shelf_alignment_))
455 transform.Translate(width(), 0.0f); 468 transform.Translate(width(), 0.0f);
456 else 469 else
457 transform.Translate(0.0f, height()); 470 transform.Translate(0.0f, height());
458 layer()->SetTransform(transform); 471 layer()->SetTransform(transform);
459 } 472 }
460 473
461 void TrayBackgroundView::InitializeBubbleAnimations(
462 views::Widget* bubble_widget) {
463 ::wm::SetWindowVisibilityAnimationType(
464 bubble_widget->GetNativeWindow(),
465 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
466 ::wm::SetWindowVisibilityAnimationTransition(bubble_widget->GetNativeWindow(),
467 ::wm::ANIMATE_HIDE);
468 ::wm::SetWindowVisibilityAnimationDuration(
469 bubble_widget->GetNativeWindow(),
470 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMs));
471 }
472
473 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const { 474 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const {
474 return ash::Shell::GetContainer( 475 return ash::Shell::GetContainer(
475 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(), 476 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(),
476 ash::kShellWindowId_SettingBubbleContainer); 477 ash::kShellWindowId_SettingBubbleContainer);
477 } 478 }
478 479
479 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( 480 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect(
480 views::Widget* anchor_widget, 481 views::Widget* anchor_widget,
481 TrayBubbleView::AnchorType anchor_type, 482 TrayBubbleView::AnchorType anchor_type,
482 TrayBubbleView::AnchorAlignment anchor_alignment) const { 483 TrayBubbleView::AnchorAlignment anchor_alignment) const {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 background_->set_alpha(kTrayBackgroundAlpha); 583 background_->set_alpha(kTrayBackgroundAlpha);
583 SchedulePaint(); 584 SchedulePaint();
584 } 585 }
585 586
586 void TrayBackgroundView::UpdateBubbleViewArrow( 587 void TrayBackgroundView::UpdateBubbleViewArrow(
587 views::TrayBubbleView* bubble_view) { 588 views::TrayBubbleView* bubble_view) {
588 // Nothing to do here. 589 // Nothing to do here.
589 } 590 }
590 591
591 } // namespace ash 592 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698