| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 72 // Gets arrow location based on shelf alignment. | 72 // Gets arrow location based on shelf alignment. |
| 73 views::BubbleBorder::Arrow OverflowBubbleView::GetBubbleArrow() const { | 73 views::BubbleBorder::Arrow OverflowBubbleView::GetBubbleArrow() const { |
| 74 if (!shelf_view_) | 74 if (!shelf_view_) |
| 75 return views::BubbleBorder::NONE; | 75 return views::BubbleBorder::NONE; |
| 76 return shelf_view_->shelf()->SelectValueForShelfAlignment( | 76 return shelf_view_->shelf()->SelectValueForShelfAlignment( |
| 77 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP, | 77 views::BubbleBorder::BOTTOM_LEFT, views::BubbleBorder::LEFT_TOP, |
| 78 views::BubbleBorder::RIGHT_TOP, views::BubbleBorder::TOP_LEFT); | 78 views::BubbleBorder::RIGHT_TOP); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void OverflowBubbleView::ScrollByXOffset(int x_offset) { | 81 void OverflowBubbleView::ScrollByXOffset(int x_offset) { |
| 82 const gfx::Rect visible_bounds(GetContentsBounds()); | 82 const gfx::Rect visible_bounds(GetContentsBounds()); |
| 83 const gfx::Size contents_size(GetContentsSize()); | 83 const gfx::Size contents_size(GetContentsSize()); |
| 84 | 84 |
| 85 DCHECK_GE(contents_size.width(), visible_bounds.width()); | 85 DCHECK_GE(contents_size.width(), visible_bounds.width()); |
| 86 int x = std::min(contents_size.width() - visible_bounds.width(), | 86 int x = std::min(contents_size.width() - visible_bounds.width(), |
| 87 std::max(0, scroll_offset_.x() + x_offset)); | 87 std::max(0, scroll_offset_.x() + x_offset)); |
| 88 scroll_offset_.set_x(x); | 88 scroll_offset_.set_x(x); |
| (...skipping 113 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 |