Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1938)

Unified Diff: ash/common/shelf/overflow_bubble_view.cc

Issue 2676673005: ash: Clean up shelf GetAlignment() and IsHorizontalAlignment() calls (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/shelf/overflow_bubble_view.h ('k') | ash/common/shelf/shelf_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/overflow_bubble_view.cc
diff --git a/ash/common/shelf/overflow_bubble_view.cc b/ash/common/shelf/overflow_bubble_view.cc
index ae7661803b41f67f53b184849c86eda5f3bd517f..25b0ef672dba7790057570679b0c2f6c15d0415a 100644
--- a/ash/common/shelf/overflow_bubble_view.cc
+++ b/ash/common/shelf/overflow_bubble_view.cc
@@ -9,7 +9,6 @@
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/wm_shelf.h"
-#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_window.h"
#include "ash/public/cpp/shell_window_ids.h"
@@ -37,7 +36,9 @@ const int kShelfViewLeadingInset = 8;
} // namespace
OverflowBubbleView::OverflowBubbleView(WmShelf* wm_shelf)
- : wm_shelf_(wm_shelf), shelf_view_(nullptr) {}
+ : wm_shelf_(wm_shelf), shelf_view_(nullptr) {
+ DCHECK(wm_shelf_);
+}
OverflowBubbleView::~OverflowBubbleView() {}
@@ -69,10 +70,6 @@ void OverflowBubbleView::InitOverflowBubble(views::View* anchor,
AddChildView(shelf_view_);
}
-bool OverflowBubbleView::IsHorizontalAlignment() const {
- return ::ash::IsHorizontalAlignment(wm_shelf_->GetAlignment());
-}
-
const gfx::Size OverflowBubbleView::GetContentsSize() const {
return shelf_view_->GetPreferredSize();
}
@@ -120,7 +117,7 @@ gfx::Size OverflowBubbleView::GetPreferredSize() const {
->GetDisplayNearestPoint(GetAnchorRect().CenterPoint())
.work_area();
if (!monitor_rect.IsEmpty()) {
- if (IsHorizontalAlignment()) {
+ if (wm_shelf_->IsHorizontalAlignment()) {
preferred_size.set_width(
std::min(preferred_size.width(),
static_cast<int>(monitor_rect.width() *
@@ -147,7 +144,7 @@ void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) {
SizeToContents();
// Ensures |shelf_view_| is still visible.
- if (IsHorizontalAlignment())
+ if (wm_shelf_->IsHorizontalAlignment())
ScrollByXOffset(0);
else
ScrollByYOffset(0);
@@ -159,7 +156,7 @@ bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) {
// recently, but the behavior of this function was retained to continue
// using Y offsets only. Might be good to simply scroll in both
// directions as in OverflowBubbleView::OnScrollEvent.
- if (IsHorizontalAlignment())
+ if (wm_shelf_->IsHorizontalAlignment())
ScrollByXOffset(-event.y_offset());
else
ScrollByYOffset(-event.y_offset());
« no previous file with comments | « ash/common/shelf/overflow_bubble_view.h ('k') | ash/common/shelf/shelf_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698