| 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/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void OverflowBubbleView::ScrollByYOffset(int y_offset) { | 88 void OverflowBubbleView::ScrollByYOffset(int y_offset) { |
| 89 const gfx::Rect visible_bounds(GetContentsBounds()); | 89 const gfx::Rect visible_bounds(GetContentsBounds()); |
| 90 const gfx::Size contents_size(shelf_view_->GetPreferredSize()); | 90 const gfx::Size contents_size(shelf_view_->GetPreferredSize()); |
| 91 | 91 |
| 92 DCHECK_GE(contents_size.width(), visible_bounds.width()); | 92 DCHECK_GE(contents_size.width(), visible_bounds.width()); |
| 93 int y = std::min(contents_size.height() - visible_bounds.height(), | 93 int y = std::min(contents_size.height() - visible_bounds.height(), |
| 94 std::max(0, scroll_offset_.y() + y_offset)); | 94 std::max(0, scroll_offset_.y() + y_offset)); |
| 95 scroll_offset_.set_y(y); | 95 scroll_offset_.set_y(y); |
| 96 } | 96 } |
| 97 | 97 |
| 98 gfx::Size OverflowBubbleView::GetPreferredSize() const { | 98 gfx::Size OverflowBubbleView::CalculatePreferredSize() const { |
| 99 gfx::Size preferred_size = shelf_view_->GetPreferredSize(); | 99 gfx::Size preferred_size = shelf_view_->GetPreferredSize(); |
| 100 | 100 |
| 101 const gfx::Rect monitor_rect = | 101 const gfx::Rect monitor_rect = |
| 102 display::Screen::GetScreen() | 102 display::Screen::GetScreen() |
| 103 ->GetDisplayNearestPoint(GetAnchorRect().CenterPoint()) | 103 ->GetDisplayNearestPoint(GetAnchorRect().CenterPoint()) |
| 104 .work_area(); | 104 .work_area(); |
| 105 if (!monitor_rect.IsEmpty()) { | 105 if (!monitor_rect.IsEmpty()) { |
| 106 if (wm_shelf_->IsHorizontalAlignment()) { | 106 if (wm_shelf_->IsHorizontalAlignment()) { |
| 107 preferred_size.set_width(std::min( | 107 preferred_size.set_width(std::min( |
| 108 preferred_size.width(), monitor_rect.width() - 2 * kEndPadding)); | 108 preferred_size.width(), monitor_rect.width() - 2 * kEndPadding)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 else if (bounds.bottom() > monitor_rect.bottom()) | 202 else if (bounds.bottom() > monitor_rect.bottom()) |
| 203 bounds.Offset(monitor_rect.bottom() - bounds.bottom(), 0); | 203 bounds.Offset(monitor_rect.bottom() - bounds.bottom(), 0); |
| 204 return bounds; | 204 return bounds; |
| 205 } | 205 } |
| 206 | 206 |
| 207 void OverflowBubbleView::UpdateShelfBackground(SkColor color) { | 207 void OverflowBubbleView::UpdateShelfBackground(SkColor color) { |
| 208 set_color(color); | 208 set_color(color); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace ash | 211 } // namespace ash |
| OLD | NEW |