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 20 matching lines...) Expand all Loading... | |
31 const int kShelfViewLeadingInset = 8; | 31 const int kShelfViewLeadingInset = 8; |
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; | |
42 AddChildView(shelf_view_); | |
43 | |
41 SetAnchorView(anchor); | 44 SetAnchorView(anchor); |
42 set_arrow(GetBubbleArrow()); | 45 set_arrow(GetBubbleArrow()); |
Greg Levin
2016/03/17 17:41:39
GetBubbleArrow() depends on having access to shelf
| |
43 set_background(NULL); | 46 set_background(NULL); |
44 set_color(SkColorSetARGB(kShelfBackgroundAlpha, 0, 0, 0)); | 47 set_color(SkColorSetARGB(kShelfBackgroundAlpha, 0, 0, 0)); |
45 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); | 48 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); |
46 // Overflow bubble should not get focus. If it get focus when it is shown, | 49 // Overflow bubble should not get focus. If it get focus when it is shown, |
47 // active state item is changed to running state. | 50 // active state item is changed to running state. |
48 set_can_activate(false); | 51 set_can_activate(false); |
49 | 52 |
50 // Makes bubble view has a layer and clip its children layers. | 53 // Makes bubble view has a layer and clip its children layers. |
51 SetPaintToLayer(true); | 54 SetPaintToLayer(true); |
52 layer()->SetFillsBoundsOpaquely(false); | 55 layer()->SetFillsBoundsOpaquely(false); |
53 layer()->SetMasksToBounds(true); | 56 layer()->SetMasksToBounds(true); |
54 | 57 |
55 shelf_view_ = shelf_view; | |
56 AddChildView(shelf_view_); | |
57 | |
58 set_parent_window(Shell::GetContainer( | 58 set_parent_window(Shell::GetContainer( |
59 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), | 59 anchor->GetWidget()->GetNativeWindow()->GetRootWindow(), |
60 kShellWindowId_ShelfBubbleContainer)); | 60 kShellWindowId_ShelfBubbleContainer)); |
61 views::BubbleDelegateView::CreateBubble(this); | 61 views::BubbleDelegateView::CreateBubble(this); |
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 |
(...skipping 134 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 |