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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return static_cast<views::View*>(launcher_view_)->GetPreferredSize(); | 68 return static_cast<views::View*>(launcher_view_)->GetPreferredSize(); |
69 } | 69 } |
70 | 70 |
71 void ScrollByXOffset(int x_offset); | 71 void ScrollByXOffset(int x_offset); |
72 void ScrollByYOffset(int y_offset); | 72 void ScrollByYOffset(int y_offset); |
73 | 73 |
74 // views::View overrides: | 74 // views::View overrides: |
75 virtual gfx::Size GetPreferredSize() OVERRIDE; | 75 virtual gfx::Size GetPreferredSize() OVERRIDE; |
76 virtual void Layout() OVERRIDE; | 76 virtual void Layout() OVERRIDE; |
77 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 77 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
78 virtual bool OnMouseWheel(const views::MouseWheelEvent& event) OVERRIDE; | 78 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
79 virtual bool OnScrollEvent(const views::ScrollEvent & event) OVERRIDE; | 79 virtual bool OnScrollEvent(const ui::ScrollEvent& event) OVERRIDE; |
80 | 80 |
81 // views::BubbleDelegate overrides: | 81 // views::BubbleDelegate overrides: |
82 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 82 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
83 | 83 |
84 ShelfAlignment shelf_alignment_; | 84 ShelfAlignment shelf_alignment_; |
85 LauncherView* launcher_view_; // Owned by views hierarchy. | 85 LauncherView* launcher_view_; // Owned by views hierarchy. |
86 gfx::Point scroll_offset_; | 86 gfx::Point scroll_offset_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | 88 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); |
89 }; | 89 }; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) { | 172 void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) { |
173 // Ensures |launch_view_| is still visible. | 173 // Ensures |launch_view_| is still visible. |
174 ScrollByXOffset(0); | 174 ScrollByXOffset(0); |
175 ScrollByYOffset(0); | 175 ScrollByYOffset(0); |
176 Layout(); | 176 Layout(); |
177 | 177 |
178 SizeToContents(); | 178 SizeToContents(); |
179 } | 179 } |
180 | 180 |
181 bool OverflowBubbleView::OnMouseWheel(const views::MouseWheelEvent& event) { | 181 bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) { |
182 if (is_horizontal_alignment()) | 182 if (is_horizontal_alignment()) |
183 ScrollByXOffset(-event.offset()); | 183 ScrollByXOffset(-event.offset()); |
184 else | 184 else |
185 ScrollByYOffset(-event.offset()); | 185 ScrollByYOffset(-event.offset()); |
186 Layout(); | 186 Layout(); |
187 | 187 |
188 return true; | 188 return true; |
189 } | 189 } |
190 | 190 |
191 bool OverflowBubbleView::OnScrollEvent(const views::ScrollEvent & event) { | 191 bool OverflowBubbleView::OnScrollEvent(const ui::ScrollEvent& event) { |
192 ScrollByXOffset(-event.x_offset()); | 192 ScrollByXOffset(-event.x_offset()); |
193 ScrollByYOffset(-event.y_offset()); | 193 ScrollByYOffset(-event.y_offset()); |
194 Layout(); | 194 Layout(); |
195 return true; | 195 return true; |
196 } | 196 } |
197 | 197 |
198 gfx::Rect OverflowBubbleView::GetBubbleBounds() { | 198 gfx::Rect OverflowBubbleView::GetBubbleBounds() { |
199 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); | 199 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); |
200 gfx::Insets bubble_insets; | 200 gfx::Insets bubble_insets; |
201 border->GetInsets(&bubble_insets); | 201 border->GetInsets(&bubble_insets); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 bubble_ = NULL; | 281 bubble_ = NULL; |
282 } | 282 } |
283 | 283 |
284 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { | 284 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { |
285 DCHECK(widget == bubble_->GetWidget()); | 285 DCHECK(widget == bubble_->GetWidget()); |
286 bubble_ = NULL; | 286 bubble_ = NULL; |
287 } | 287 } |
288 | 288 |
289 } // namespace internal | 289 } // namespace internal |
290 } // namespace ash | 290 } // namespace ash |
OLD | NEW |