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/system/tray/tray_background_view.h" | 5 #include "ash/system/tray/tray_background_view.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 kPaddingFromBottomOfScreenBottomAlignment); | 523 kPaddingFromBottomOfScreenBottomAlignment); |
524 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { | 524 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { |
525 rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 5, | 525 rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 5, |
526 kPaddingFromBottomOfScreenVerticalAlignment); | 526 kPaddingFromBottomOfScreenVerticalAlignment); |
527 } else { | 527 } else { |
528 rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 1, | 528 rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment + 1, |
529 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); | 529 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); |
530 } | 530 } |
531 } else if (anchor_type == TrayBubbleView::ANCHOR_TYPE_BUBBLE) { | 531 } else if (anchor_type == TrayBubbleView::ANCHOR_TYPE_BUBBLE) { |
532 // Invert the offsets to align with the bubble below. | 532 // Invert the offsets to align with the bubble below. |
| 533 // Note that with the alternate shelf layout the tips are not shown and |
| 534 // the offsets for left and right alignment do not need to be applied. |
| 535 int vertical_alignment = ash::switches::UseAlternateShelfLayout() ? |
| 536 0 : kPaddingFromInnerEdgeOfLauncherVerticalAlignment; |
533 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { | 537 if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_LEFT) { |
534 rect.Inset(kPaddingFromInnerEdgeOfLauncherVerticalAlignment, | 538 rect.Inset(vertical_alignment, |
535 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); | 539 0, 0, kPaddingFromBottomOfScreenVerticalAlignment); |
536 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { | 540 } else if (anchor_alignment == TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT) { |
537 rect.Inset(0, 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment, | 541 rect.Inset(0, 0, vertical_alignment, |
538 kPaddingFromBottomOfScreenVerticalAlignment); | 542 kPaddingFromBottomOfScreenVerticalAlignment); |
539 } | 543 } |
540 } | 544 } |
541 } | 545 } |
542 | 546 |
543 // TODO(jennyz): May need to add left/right alignment in the following code. | 547 // TODO(jennyz): May need to add left/right alignment in the following code. |
544 if (rect.IsEmpty()) { | 548 if (rect.IsEmpty()) { |
545 aura::RootWindow* target_root = anchor_widget ? | 549 aura::RootWindow* target_root = anchor_widget ? |
546 anchor_widget->GetNativeView()->GetRootWindow() : | 550 anchor_widget->GetNativeView()->GetRootWindow() : |
547 Shell::GetPrimaryRootWindow(); | 551 Shell::GetPrimaryRootWindow(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); | 599 bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); |
596 ash::internal::ShelfLayoutManager* shelf = | 600 ash::internal::ShelfLayoutManager* shelf = |
597 ShelfLayoutManager::ForLauncher(root_window); | 601 ShelfLayoutManager::ForLauncher(root_window); |
598 bubble_view->SetArrowPaintType( | 602 bubble_view->SetArrowPaintType( |
599 shelf->IsVisible() ? views::BubbleBorder::PAINT_NORMAL : | 603 shelf->IsVisible() ? views::BubbleBorder::PAINT_NORMAL : |
600 views::BubbleBorder::PAINT_TRANSPARENT); | 604 views::BubbleBorder::PAINT_TRANSPARENT); |
601 } | 605 } |
602 | 606 |
603 } // namespace internal | 607 } // namespace internal |
604 } // namespace ash | 608 } // namespace ash |
OLD | NEW |