| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void ScrollByXOffset(int x_offset); | 67 void ScrollByXOffset(int x_offset); |
| 68 void ScrollByYOffset(int y_offset); | 68 void ScrollByYOffset(int y_offset); |
| 69 | 69 |
| 70 // views::View overrides: | 70 // views::View overrides: |
| 71 virtual gfx::Size GetPreferredSize() OVERRIDE; | 71 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 72 virtual void Layout() OVERRIDE; | 72 virtual void Layout() OVERRIDE; |
| 73 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 73 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 74 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 74 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
| 75 | 75 |
| 76 // ui::EventHandler overrides: | 76 // ui::EventHandler overrides: |
| 77 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 77 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
| 78 | 78 |
| 79 // views::BubbleDelegate overrides: | 79 // views::BubbleDelegate overrides: |
| 80 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 80 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
| 81 | 81 |
| 82 ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const { | 82 ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const { |
| 83 return ShelfLayoutManager::ForLauncher( | 83 return ShelfLayoutManager::ForLauncher( |
| 84 anchor_view()->GetWidget()->GetNativeView()); | 84 anchor_view()->GetWidget()->GetNativeView()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 LauncherView* launcher_view_; // Owned by views hierarchy. | 87 LauncherView* launcher_view_; // Owned by views hierarchy. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) { | 178 bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) { |
| 179 if (IsHorizontalAlignment()) | 179 if (IsHorizontalAlignment()) |
| 180 ScrollByXOffset(-event.offset()); | 180 ScrollByXOffset(-event.offset()); |
| 181 else | 181 else |
| 182 ScrollByYOffset(-event.offset()); | 182 ScrollByYOffset(-event.offset()); |
| 183 Layout(); | 183 Layout(); |
| 184 | 184 |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 | 187 |
| 188 ui::EventResult OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) { | 188 void OverflowBubbleView::OnScrollEvent(ui::ScrollEvent* event) { |
| 189 ScrollByXOffset(-event->x_offset()); | 189 ScrollByXOffset(-event->x_offset()); |
| 190 ScrollByYOffset(-event->y_offset()); | 190 ScrollByYOffset(-event->y_offset()); |
| 191 Layout(); | 191 Layout(); |
| 192 return ui::ER_HANDLED; | 192 event->SetHandled(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 gfx::Rect OverflowBubbleView::GetBubbleBounds() { | 195 gfx::Rect OverflowBubbleView::GetBubbleBounds() { |
| 196 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); | 196 views::BubbleBorder* border = GetBubbleFrameView()->bubble_border(); |
| 197 gfx::Insets bubble_insets = border->GetInsets(); | 197 gfx::Insets bubble_insets = border->GetInsets(); |
| 198 | 198 |
| 199 const int border_size = | 199 const int border_size = |
| 200 views::BubbleBorder::is_arrow_on_horizontal(arrow_location()) ? | 200 views::BubbleBorder::is_arrow_on_horizontal(arrow_location()) ? |
| 201 bubble_insets.left() : bubble_insets.top(); | 201 bubble_insets.left() : bubble_insets.top(); |
| 202 const int arrow_offset = border_size + kPadding + kLauncherViewLeadingInset + | 202 const int arrow_offset = border_size + kPadding + kLauncherViewLeadingInset + |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 bubble_ = NULL; | 275 bubble_ = NULL; |
| 276 } | 276 } |
| 277 | 277 |
| 278 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { | 278 void OverflowBubble::OnWidgetClosing(views::Widget* widget) { |
| 279 DCHECK(widget == bubble_->GetWidget()); | 279 DCHECK(widget == bubble_->GetWidget()); |
| 280 bubble_ = NULL; | 280 bubble_ = NULL; |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace internal | 283 } // namespace internal |
| 284 } // namespace ash | 284 } // namespace ash |
| OLD | NEW |