| OLD | NEW |
| 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/common/system/tray/tray_background_view.h" | 5 #include "ash/common/system/tray/tray_background_view.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shelf/wm_shelf_util.h" | 10 #include "ash/common/shelf/wm_shelf_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 namespace ash { | 54 namespace ash { |
| 55 | 55 |
| 56 // static | 56 // static |
| 57 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView"; | 57 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView"; |
| 58 | 58 |
| 59 // Used to track when the anchor widget changes position on screen so that the | 59 // Used to track when the anchor widget changes position on screen so that the |
| 60 // bubble position can be updated. | 60 // bubble position can be updated. |
| 61 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { | 61 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { |
| 62 public: | 62 public: |
| 63 explicit TrayWidgetObserver(TrayBackgroundView* host) | 63 explicit TrayWidgetObserver(TrayBackgroundView* host) : host_(host) {} |
| 64 : host_(host) { | |
| 65 } | |
| 66 | 64 |
| 67 void OnWidgetBoundsChanged(views::Widget* widget, | 65 void OnWidgetBoundsChanged(views::Widget* widget, |
| 68 const gfx::Rect& new_bounds) override { | 66 const gfx::Rect& new_bounds) override { |
| 69 host_->AnchorUpdated(); | 67 host_->AnchorUpdated(); |
| 70 } | 68 } |
| 71 | 69 |
| 72 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override { | 70 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override { |
| 73 host_->AnchorUpdated(); | 71 host_->AnchorUpdated(); |
| 74 } | 72 } |
| 75 | 73 |
| 76 private: | 74 private: |
| 77 TrayBackgroundView* host_; | 75 TrayBackgroundView* host_; |
| 78 | 76 |
| 79 DISALLOW_COPY_AND_ASSIGN(TrayWidgetObserver); | 77 DISALLOW_COPY_AND_ASSIGN(TrayWidgetObserver); |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 class TrayBackground : public views::Background { | 80 class TrayBackground : public views::Background { |
| 83 public: | 81 public: |
| 84 const static int kImageTypeDefault = 0; | 82 const static int kImageTypeDefault = 0; |
| 85 const static int kImageTypeOnBlack = 1; | 83 const static int kImageTypeOnBlack = 1; |
| 86 const static int kImageTypePressed = 2; | 84 const static int kImageTypePressed = 2; |
| 87 const static int kNumStates = 3; | 85 const static int kNumStates = 3; |
| 88 | 86 |
| 89 const static int kImageHorizontal = 0; | 87 const static int kImageHorizontal = 0; |
| 90 const static int kImageVertical = 1; | 88 const static int kImageVertical = 1; |
| 91 const static int kNumOrientations = 2; | 89 const static int kNumOrientations = 2; |
| 92 | 90 |
| 93 explicit TrayBackground(TrayBackgroundView* tray_background_view) : | 91 explicit TrayBackground(TrayBackgroundView* tray_background_view) |
| 94 tray_background_view_(tray_background_view) { | 92 : tray_background_view_(tray_background_view) {} |
| 95 } | |
| 96 | 93 |
| 97 ~TrayBackground() override {} | 94 ~TrayBackground() override {} |
| 98 | 95 |
| 99 private: | 96 private: |
| 100 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } | 97 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } |
| 101 | 98 |
| 102 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { | 99 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { |
| 103 SkColor background_color = SK_ColorTRANSPARENT; | 100 SkColor background_color = SK_ColorTRANSPARENT; |
| 104 if (GetShelf()->GetBackgroundType() == | 101 if (GetShelf()->GetBackgroundType() == |
| 105 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) { | 102 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 highlight_paint.setFlags(SkPaint::kAntiAlias_Flag); | 119 highlight_paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 123 highlight_paint.setColor(kShelfButtonActivatedHighlightColor); | 120 highlight_paint.setColor(kShelfButtonActivatedHighlightColor); |
| 124 canvas->DrawRoundRect(view->GetLocalBounds(), kCornerRadius, | 121 canvas->DrawRoundRect(view->GetLocalBounds(), kCornerRadius, |
| 125 highlight_paint); | 122 highlight_paint); |
| 126 } | 123 } |
| 127 } | 124 } |
| 128 | 125 |
| 129 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { | 126 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { |
| 130 const int kGridSizeForPainter = 9; | 127 const int kGridSizeForPainter = 9; |
| 131 const int kImages[kNumOrientations][kNumStates][kGridSizeForPainter] = { | 128 const int kImages[kNumOrientations][kNumStates][kGridSizeForPainter] = { |
| 132 { // Horizontal | 129 { |
| 133 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ), | 130 // Horizontal |
| 134 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_ONBLACK), | 131 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ), |
| 135 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_PRESSED), | 132 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_ONBLACK), |
| 136 }, | 133 IMAGE_GRID_HORIZONTAL(IDR_AURA_TRAY_BG_HORIZ_PRESSED), |
| 137 { // Vertical | 134 }, |
| 138 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL), | 135 { |
| 139 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_ONBLACK), | 136 // Vertical |
| 140 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_PRESSED), | 137 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL), |
| 141 } | 138 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_ONBLACK), |
| 142 }; | 139 IMAGE_GRID_VERTICAL(IDR_AURA_TRAY_BG_VERTICAL_PRESSED), |
| 140 }}; |
| 143 | 141 |
| 144 WmShelf* shelf = GetShelf(); | 142 WmShelf* shelf = GetShelf(); |
| 145 const int orientation = IsHorizontalAlignment(shelf->GetAlignment()) | 143 const int orientation = IsHorizontalAlignment(shelf->GetAlignment()) |
| 146 ? kImageHorizontal | 144 ? kImageHorizontal |
| 147 : kImageVertical; | 145 : kImageVertical; |
| 148 | 146 |
| 149 int state = kImageTypeDefault; | 147 int state = kImageTypeDefault; |
| 150 if (tray_background_view_->draw_background_as_active()) | 148 if (tray_background_view_->draw_background_as_active()) |
| 151 state = kImageTypePressed; | 149 state = kImageTypePressed; |
| 152 else if (shelf->IsDimmed()) | 150 else if (shelf->IsDimmed()) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 views::View::SetVisible(true); | 280 views::View::SetVisible(true); |
| 283 // If SetVisible(true) is called while animating to not visible, then | 281 // If SetVisible(true) is called while animating to not visible, then |
| 284 // views::View::SetVisible(true) is a no-op. When the previous animation | 282 // views::View::SetVisible(true) is a no-op. When the previous animation |
| 285 // ends layer->SetVisible(false) is called. To prevent this | 283 // ends layer->SetVisible(false) is called. To prevent this |
| 286 // layer->SetVisible(true) immediately interrupts the animation of this | 284 // layer->SetVisible(true) immediately interrupts the animation of this |
| 287 // property, and keeps the layer visible. | 285 // property, and keeps the layer visible. |
| 288 layer()->SetVisible(true); | 286 layer()->SetVisible(true); |
| 289 } | 287 } |
| 290 | 288 |
| 291 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); | 289 ui::ScopedLayerAnimationSettings animation(layer()->GetAnimator()); |
| 292 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 290 animation.SetTransitionDuration( |
| 293 kAnimationDurationForVisibilityMs)); | 291 base::TimeDelta::FromMilliseconds(kAnimationDurationForVisibilityMs)); |
| 294 animation.SetPreemptionStrategy( | 292 animation.SetPreemptionStrategy( |
| 295 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 293 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 296 | 294 |
| 297 if (visible) { | 295 if (visible) { |
| 298 animation.SetTweenType(gfx::Tween::EASE_OUT); | 296 animation.SetTweenType(gfx::Tween::EASE_OUT); |
| 299 // Show is delayed so as to allow time for other children of | 297 // Show is delayed so as to allow time for other children of |
| 300 // StatusAreaWidget to begin animating to their new positions. | 298 // StatusAreaWidget to begin animating to their new positions. |
| 301 layer()->GetAnimator()->SchedulePauseForProperties( | 299 layer()->GetAnimator()->SchedulePauseForProperties( |
| 302 base::TimeDelta::FromMilliseconds(kShowAnimationDelayMs), | 300 base::TimeDelta::FromMilliseconds(kShowAnimationDelayMs), |
| 303 ui::LayerAnimationElement::OPACITY | | 301 ui::LayerAnimationElement::OPACITY | |
| 304 ui::LayerAnimationElement::TRANSFORM); | 302 ui::LayerAnimationElement::TRANSFORM); |
| 305 layer()->SetOpacity(1.0f); | 303 layer()->SetOpacity(1.0f); |
| 306 gfx::Transform transform; | 304 gfx::Transform transform; |
| 307 transform.Translate(0.0f, 0.0f); | 305 transform.Translate(0.0f, 0.0f); |
| 308 layer()->SetTransform(transform); | 306 layer()->SetTransform(transform); |
| 309 } else { | 307 } else { |
| 310 // Listen only to the hide animation. As we cannot turn off visibility | 308 // Listen only to the hide animation. As we cannot turn off visibility |
| 311 // until the animation is over. | 309 // until the animation is over. |
| 312 animation.AddObserver(this); | 310 animation.AddObserver(this); |
| 313 animation.SetTweenType(gfx::Tween::EASE_IN); | 311 animation.SetTweenType(gfx::Tween::EASE_IN); |
| 314 layer()->SetOpacity(0.0f); | 312 layer()->SetOpacity(0.0f); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 345 // The tray itself expands to the right and bottom edge of the screen to make | 343 // The tray itself expands to the right and bottom edge of the screen to make |
| 346 // sure clicking on the edges brings up the popup. However, the focus border | 344 // sure clicking on the edges brings up the popup. However, the focus border |
| 347 // should be only around the container. | 345 // should be only around the container. |
| 348 return GetContentsBounds(); | 346 return GetContentsBounds(); |
| 349 } | 347 } |
| 350 | 348 |
| 351 void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) { | 349 void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) { |
| 352 if (switches::IsTouchFeedbackEnabled()) { | 350 if (switches::IsTouchFeedbackEnabled()) { |
| 353 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 351 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
| 354 SetDrawBackgroundAsActive(true); | 352 SetDrawBackgroundAsActive(true); |
| 355 } else if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || | 353 } else if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || |
| 356 event->type() == ui::ET_GESTURE_TAP_CANCEL) { | 354 event->type() == ui::ET_GESTURE_TAP_CANCEL) { |
| 357 SetDrawBackgroundAsActive(false); | 355 SetDrawBackgroundAsActive(false); |
| 358 } | 356 } |
| 359 } | 357 } |
| 360 ActionableView::OnGestureEvent(event); | 358 ActionableView::OnGestureEvent(event); |
| 361 } | 359 } |
| 362 | 360 |
| 363 void TrayBackgroundView::UpdateBackground(int alpha) { | 361 void TrayBackgroundView::UpdateBackground(int alpha) { |
| 364 // The animator should never fire when the alternate shelf layout is used. | 362 // The animator should never fire when the alternate shelf layout is used. |
| 365 if (!background_ || draw_background_as_active_) | 363 if (!background_ || draw_background_as_active_) |
| 366 return; | 364 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 381 tray_container_->SetAlignment(alignment); | 379 tray_container_->SetAlignment(alignment); |
| 382 } | 380 } |
| 383 | 381 |
| 384 void TrayBackgroundView::OnImplicitAnimationsCompleted() { | 382 void TrayBackgroundView::OnImplicitAnimationsCompleted() { |
| 385 // If there is another animation in the queue, the reverse animation was | 383 // If there is another animation in the queue, the reverse animation was |
| 386 // triggered before the completion of animating to invisible. Do not turn off | 384 // triggered before the completion of animating to invisible. Do not turn off |
| 387 // the visibility so that the next animation may render. The value of | 385 // the visibility so that the next animation may render. The value of |
| 388 // layer()->GetTargetVisibility() can be incorrect if the hide animation was | 386 // layer()->GetTargetVisibility() can be incorrect if the hide animation was |
| 389 // aborted to schedule an animation to become visible. As the new animation | 387 // aborted to schedule an animation to become visible. As the new animation |
| 390 // is not yet added to the queue. crbug.com/374236 | 388 // is not yet added to the queue. crbug.com/374236 |
| 391 if(layer()->GetAnimator()->is_animating() || | 389 if (layer()->GetAnimator()->is_animating() || layer()->GetTargetVisibility()) |
| 392 layer()->GetTargetVisibility()) | |
| 393 return; | 390 return; |
| 394 views::View::SetVisible(false); | 391 views::View::SetVisible(false); |
| 395 } | 392 } |
| 396 | 393 |
| 397 bool TrayBackgroundView::RequiresNotificationWhenAnimatorDestroyed() const { | 394 bool TrayBackgroundView::RequiresNotificationWhenAnimatorDestroyed() const { |
| 398 // This is needed so that OnImplicitAnimationsCompleted() is called even upon | 395 // This is needed so that OnImplicitAnimationsCompleted() is called even upon |
| 399 // destruction of the animator. This can occure when parallel animations | 396 // destruction of the animator. This can occure when parallel animations |
| 400 // caused by ScreenRotationAnimator end before the animations of | 397 // caused by ScreenRotationAnimator end before the animations of |
| 401 // TrayBackgroundView. This allows for a proper update to the visual state of | 398 // TrayBackgroundView. This allows for a proper update to the visual state of |
| 402 // the view. (crbug.com/476667) | 399 // the view. (crbug.com/476667) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 415 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( | 412 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( |
| 416 views::Widget* anchor_widget, | 413 views::Widget* anchor_widget, |
| 417 TrayBubbleView::AnchorType anchor_type, | 414 TrayBubbleView::AnchorType anchor_type, |
| 418 TrayBubbleView::AnchorAlignment anchor_alignment) const { | 415 TrayBubbleView::AnchorAlignment anchor_alignment) const { |
| 419 gfx::Rect rect; | 416 gfx::Rect rect; |
| 420 if (anchor_widget && anchor_widget->IsVisible()) { | 417 if (anchor_widget && anchor_widget->IsVisible()) { |
| 421 rect = anchor_widget->GetWindowBoundsInScreen(); | 418 rect = anchor_widget->GetWindowBoundsInScreen(); |
| 422 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) { | 419 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) { |
| 423 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { | 420 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { |
| 424 bool rtl = base::i18n::IsRTL(); | 421 bool rtl = base::i18n::IsRTL(); |
| 425 rect.Inset( | 422 rect.Inset(rtl ? kBubblePaddingHorizontalSide : 0, |
| 426 rtl ? kBubblePaddingHorizontalSide : 0, | 423 kBubblePaddingHorizontalBottom, |
| 427 kBubblePaddingHorizontalBottom, | 424 rtl ? 0 : kBubblePaddingHorizontalSide, 0); |
| 428 rtl ? 0 : kBubblePaddingHorizontalSide, | |
| 429 0); | |
| 430 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { | 425 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { |
| 431 rect.Inset(0, 0, kBubblePaddingVerticalSide + 4, | 426 rect.Inset(0, 0, kBubblePaddingVerticalSide + 4, |
| 432 kBubblePaddingVerticalBottom); | 427 kBubblePaddingVerticalBottom); |
| 433 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { | 428 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { |
| 434 rect.Inset(kBubblePaddingVerticalSide, 0, 0, | 429 rect.Inset(kBubblePaddingVerticalSide, 0, 0, |
| 435 kBubblePaddingVerticalBottom); | 430 kBubblePaddingVerticalBottom); |
| 436 } else { | 431 } else { |
| 437 // TODO(bruthig) May need to handle other ANCHOR_ALIGNMENT_ values. | 432 // TODO(bruthig) May need to handle other ANCHOR_ALIGNMENT_ values. |
| 438 // ie. ANCHOR_ALIGNMENT_TOP | 433 // ie. ANCHOR_ALIGNMENT_TOP |
| 439 DCHECK(false) << "Unhandled anchor alignment."; | 434 DCHECK(false) << "Unhandled anchor alignment."; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 454 } else { | 449 } else { |
| 455 WmWindow* target_root = anchor_widget | 450 WmWindow* target_root = anchor_widget |
| 456 ? WmLookup::Get() | 451 ? WmLookup::Get() |
| 457 ->GetWindowForWidget(anchor_widget) | 452 ->GetWindowForWidget(anchor_widget) |
| 458 ->GetRootWindow() | 453 ->GetRootWindow() |
| 459 : WmShell::Get()->GetPrimaryRootWindow(); | 454 : WmShell::Get()->GetPrimaryRootWindow(); |
| 460 rect = target_root->GetBounds(); | 455 rect = target_root->GetBounds(); |
| 461 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) { | 456 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) { |
| 462 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { | 457 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { |
| 463 rect = gfx::Rect( | 458 rect = gfx::Rect( |
| 464 base::i18n::IsRTL() ? | 459 base::i18n::IsRTL() |
| 465 kPaddingFromRightEdgeOfScreenBottomAlignment : | 460 ? kPaddingFromRightEdgeOfScreenBottomAlignment |
| 466 rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, | 461 : rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, |
| 467 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, | 462 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, 0, 0); |
| 468 0, 0); | |
| 469 rect = target_root->ConvertRectToScreen(rect); | 463 rect = target_root->ConvertRectToScreen(rect); |
| 470 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { | 464 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { |
| 471 rect = gfx::Rect( | 465 rect = gfx::Rect( |
| 472 kPaddingFromRightEdgeOfScreenBottomAlignment, | 466 kPaddingFromRightEdgeOfScreenBottomAlignment, |
| 473 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, | 467 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, 1, 1); |
| 474 1, 1); | |
| 475 rect = target_root->ConvertRectToScreen(rect); | 468 rect = target_root->ConvertRectToScreen(rect); |
| 476 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { | 469 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { |
| 477 rect = gfx::Rect( | 470 rect = gfx::Rect( |
| 478 rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, | 471 rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, |
| 479 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, | 472 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, 1, 1); |
| 480 1, 1); | |
| 481 rect = target_root->ConvertRectToScreen(rect); | 473 rect = target_root->ConvertRectToScreen(rect); |
| 482 } else { | 474 } else { |
| 483 // TODO(bruthig) May need to handle other ANCHOR_ALIGNMENT_ values. | 475 // TODO(bruthig) May need to handle other ANCHOR_ALIGNMENT_ values. |
| 484 // ie. ANCHOR_ALIGNMENT_TOP | 476 // ie. ANCHOR_ALIGNMENT_TOP |
| 485 DCHECK(false) << "Unhandled anchor alignment."; | 477 DCHECK(false) << "Unhandled anchor alignment."; |
| 486 } | 478 } |
| 487 } else { | 479 } else { |
| 488 rect = gfx::Rect( | 480 rect = gfx::Rect( |
| 489 base::i18n::IsRTL() ? | 481 base::i18n::IsRTL() |
| 490 kPaddingFromRightEdgeOfScreenBottomAlignment : | 482 ? kPaddingFromRightEdgeOfScreenBottomAlignment |
| 491 rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, | 483 : rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, |
| 492 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, | 484 rect.height() - kPaddingFromBottomOfScreenBottomAlignment, 0, 0); |
| 493 0, 0); | |
| 494 } | 485 } |
| 495 } | 486 } |
| 496 return rect; | 487 return rect; |
| 497 } | 488 } |
| 498 | 489 |
| 499 TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const { | 490 TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const { |
| 500 if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT) | 491 if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT) |
| 501 return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT; | 492 return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT; |
| 502 if (shelf_alignment_ == SHELF_ALIGNMENT_RIGHT) | 493 if (shelf_alignment_ == SHELF_ALIGNMENT_RIGHT) |
| 503 return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT; | 494 return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT; |
| 504 return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM; | 495 return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM; |
| 505 } | 496 } |
| 506 | 497 |
| 507 void TrayBackgroundView::SetDrawBackgroundAsActive(bool visible) { | 498 void TrayBackgroundView::SetDrawBackgroundAsActive(bool visible) { |
| 508 if (draw_background_as_active_ == visible) | 499 if (draw_background_as_active_ == visible) |
| 509 return; | 500 return; |
| 510 draw_background_as_active_ = visible; | 501 draw_background_as_active_ = visible; |
| 511 if (!background_) | 502 if (!background_) |
| 512 return; | 503 return; |
| 513 SchedulePaint(); | 504 SchedulePaint(); |
| 514 } | 505 } |
| 515 | 506 |
| 516 void TrayBackgroundView::UpdateBubbleViewArrow( | 507 void TrayBackgroundView::UpdateBubbleViewArrow( |
| 517 views::TrayBubbleView* bubble_view) { | 508 views::TrayBubbleView* bubble_view) { |
| 518 // Nothing to do here. | 509 // Nothing to do here. |
| 519 } | 510 } |
| 520 | 511 |
| 521 } // namespace ash | 512 } // namespace ash |
| OLD | NEW |