| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/overflow_bubble_view.h" | 5 #include "ash/shelf/overflow_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 OverflowBubbleView::OverflowBubbleView() : shelf_view_(NULL) {} | 35 OverflowBubbleView::OverflowBubbleView() : shelf_view_(NULL) {} |
| 36 | 36 |
| 37 OverflowBubbleView::~OverflowBubbleView() {} | 37 OverflowBubbleView::~OverflowBubbleView() {} |
| 38 | 38 |
| 39 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, | 39 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, |
| 40 ShelfView* shelf_view) { | 40 ShelfView* shelf_view) { |
| 41 shelf_view_ = shelf_view; | 41 shelf_view_ = shelf_view; |
| 42 AddChildView(shelf_view_); | |
| 43 | 42 |
| 44 SetAnchorView(anchor); | 43 SetAnchorView(anchor); |
| 45 set_arrow(GetBubbleArrow()); | 44 set_arrow(GetBubbleArrow()); |
| 46 set_background(NULL); | 45 set_background(NULL); |
| 47 set_color(SkColorSetARGB(kShelfBackgroundAlpha, 0, 0, 0)); | 46 set_color(SkColorSetARGB(kShelfBackgroundAlpha, 0, 0, 0)); |
| 48 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); | 47 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); |
| 49 // Overflow bubble should not get focus. If it get focus when it is shown, | 48 // Overflow bubble should not get focus. If it get focus when it is shown, |
| 50 // active state item is changed to running state. | 49 // active state item is changed to running state. |
| 51 set_can_activate(false); | 50 set_can_activate(false); |
| 52 | 51 |
| 53 // Makes bubble view has a layer and clip its children layers. | 52 // Makes bubble view has a layer and clip its children layers. |
| 54 SetPaintToLayer(true); | 53 SetPaintToLayer(true); |
| 55 layer()->SetFillsBoundsOpaquely(false); | 54 layer()->SetFillsBoundsOpaquely(false); |
| 56 layer()->SetMasksToBounds(true); | 55 layer()->SetMasksToBounds(true); |
| 57 | 56 |
| 58 set_parent_window(Shell::GetContainer( | 57 set_parent_window(Shell::GetContainer( |
| 59 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), | 58 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), |
| 60 kShellWindowId_ShelfBubbleContainer)); | 59 kShellWindowId_ShelfBubbleContainer)); |
| 61 views::BubbleDelegateView::CreateBubble(this); | 60 views::BubbleDelegateView::CreateBubble(this); |
| 61 AddChildView(shelf_view_); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool OverflowBubbleView::IsHorizontalAlignment() const { | 64 bool OverflowBubbleView::IsHorizontalAlignment() const { |
| 65 return shelf_view_ ? shelf_view_->shelf()->IsHorizontalAlignment() : false; | 65 return shelf_view_ ? shelf_view_->shelf()->IsHorizontalAlignment() : false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 const gfx::Size OverflowBubbleView::GetContentsSize() const { | 68 const gfx::Size OverflowBubbleView::GetContentsSize() const { |
| 69 return static_cast<views::View*>(shelf_view_)->GetPreferredSize(); | 69 return static_cast<views::View*>(shelf_view_)->GetPreferredSize(); |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 bubble_rect.Offset(0, offset); | 203 bubble_rect.Offset(0, offset); |
| 204 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y()); | 204 border->set_arrow_offset(anchor_rect.CenterPoint().y() - bubble_rect.y()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 GetBubbleFrameView()->SchedulePaint(); | 207 GetBubbleFrameView()->SchedulePaint(); |
| 208 return bubble_rect; | 208 return bubble_rect; |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace ash | 211 } // namespace ash |
| OLD | NEW |