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/launcher/overflow_bubble.h" | 5 #include "ash/launcher/overflow_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
10 #include "ash/launcher/launcher_view.h" | 10 #include "ash/launcher/launcher_view.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual void Layout() OVERRIDE; | 77 virtual void Layout() OVERRIDE; |
78 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 78 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
79 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 79 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
80 virtual bool OnScrollEvent(const ui::ScrollEvent& event) OVERRIDE; | 80 virtual bool OnScrollEvent(const ui::ScrollEvent& event) OVERRIDE; |
81 | 81 |
82 // views::BubbleDelegate overrides: | 82 // views::BubbleDelegate overrides: |
83 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 83 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
84 | 84 |
85 ShelfAlignment shelf_alignment_; | 85 ShelfAlignment shelf_alignment_; |
86 LauncherView* launcher_view_; // Owned by views hierarchy. | 86 LauncherView* launcher_view_; // Owned by views hierarchy. |
87 gfx::Point scroll_offset_; | 87 gfx::Vector2d scroll_offset_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | 89 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); |
90 }; | 90 }; |
91 | 91 |
92 OverflowBubbleView::OverflowBubbleView() | 92 OverflowBubbleView::OverflowBubbleView() |
93 : shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), | 93 : shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), |
94 launcher_view_(NULL) { | 94 launcher_view_(NULL) { |
95 } | 95 } |
96 | 96 |
97 OverflowBubbleView::~OverflowBubbleView() { | 97 OverflowBubbleView::~OverflowBubbleView() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 preferred_size.height(), | 159 preferred_size.height(), |
160 static_cast<int>(monitor_rect.height() * | 160 static_cast<int>(monitor_rect.height() * |
161 kMaxBubbleSizeToScreenRatio))); | 161 kMaxBubbleSizeToScreenRatio))); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 return preferred_size; | 165 return preferred_size; |
166 } | 166 } |
167 | 167 |
168 void OverflowBubbleView::Layout() { | 168 void OverflowBubbleView::Layout() { |
169 const gfx::Point origin(-scroll_offset_.x(), -scroll_offset_.y()); | 169 launcher_view_->SetBoundsRect(gfx::Rect( |
170 launcher_view_->SetBoundsRect(gfx::Rect(origin, GetContentsSize())); | 170 gfx::PointAtOffsetFromOrigin(-scroll_offset_), GetContentsSize())); |
171 } | 171 } |
172 | 172 |
173 void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) { | 173 void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) { |
174 // Ensures |launch_view_| is still visible. | 174 // Ensures |launch_view_| is still visible. |
175 ScrollByXOffset(0); | 175 ScrollByXOffset(0); |
176 ScrollByYOffset(0); | 176 ScrollByYOffset(0); |
177 Layout(); | 177 Layout(); |
178 | 178 |
179 SizeToContents(); | 179 SizeToContents(); |
180 } | 180 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 bubble_ = NULL; | 280 bubble_ = NULL; |
281 } | 281 } |
282 | 282 |
283 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { | 283 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { |
284 DCHECK(widget == bubble_->GetWidget()); | 284 DCHECK(widget == bubble_->GetWidget()); |
285 bubble_ = NULL; | 285 bubble_ = NULL; |
286 } | 286 } |
287 | 287 |
288 } // namespace internal | 288 } // namespace internal |
289 } // namespace ash | 289 } // namespace ash |
OLD | NEW |