Commit 6df8a50c authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Remove unused argument from MessagePopupCollection::GetBaseLine

MessagePopupCollection::GetBaseLine had an unused argument
ToastContentsView* last_toast. It was just used as a boolean value.

TEST=message_center_unittests
BUG=none

Change-Id: I044a057074fdcf2cd5227746e83c0f8ecfd01ee3
Reviewed-on: https://chromium-review.googlesource.com/895204Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534873}
parent 4837a24f
......@@ -84,7 +84,7 @@ int AshPopupAlignmentDelegate::GetToastOriginX(
return work_area_.right() - kToastMarginX - toast_bounds.width();
}
int AshPopupAlignmentDelegate::GetBaseLine() const {
int AshPopupAlignmentDelegate::GetBaseline() const {
return work_area_.bottom() - kNoToastMarginBorderAndShadowOffset -
tray_bubble_height_;
}
......
......@@ -49,7 +49,7 @@ class ASH_EXPORT AshPopupAlignmentDelegate
// Overridden from message_center::PopupAlignmentDelegate:
int GetToastOriginX(const gfx::Rect& toast_bounds) const override;
int GetBaseLine() const override;
int GetBaseline() const override;
gfx::Rect GetWorkArea() const override;
bool IsTopDown() const override;
bool IsFromLeft() const override;
......
......@@ -95,21 +95,21 @@ TEST_F(AshPopupAlignmentDelegateTest, ShelfAlignment) {
UpdateDisplay("600x600");
gfx::Point toast_point;
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
toast_point.set_y(alignment_delegate()->GetBaseline());
EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_RIGHT);
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
toast_point.set_y(alignment_delegate()->GetBaseline());
EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
toast_point.set_y(alignment_delegate()->GetBaseline());
EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point));
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_TRUE(alignment_delegate()->IsFromLeft());
......@@ -121,14 +121,14 @@ TEST_F(AshPopupAlignmentDelegateTest, LockScreen) {
GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT);
gfx::Point toast_point;
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
toast_point.set_y(alignment_delegate()->GetBaseline());
EXPECT_EQ(BOTTOM_LEFT, GetPositionInDisplay(toast_point));
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_TRUE(alignment_delegate()->IsFromLeft());
BlockUserSession(BLOCKED_BY_LOCK_SCREEN);
toast_point.set_x(alignment_delegate()->GetToastOriginX(toast_size));
toast_point.set_y(alignment_delegate()->GetBaseLine());
toast_point.set_y(alignment_delegate()->GetBaseline());
EXPECT_EQ(BOTTOM_RIGHT, GetPositionInDisplay(toast_point));
EXPECT_FALSE(alignment_delegate()->IsTopDown());
EXPECT_FALSE(alignment_delegate()->IsFromLeft());
......@@ -138,7 +138,7 @@ TEST_F(AshPopupAlignmentDelegateTest, AutoHide) {
const gfx::Rect toast_size(0, 0, 10, 10);
UpdateDisplay("600x600");
int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
int baseline = alignment_delegate()->GetBaseLine();
int baseline = alignment_delegate()->GetBaseline();
// Create a window, otherwise autohide doesn't work.
std::unique_ptr<views::Widget> widget = CreateTestWidget(
......@@ -146,29 +146,29 @@ TEST_F(AshPopupAlignmentDelegateTest, AutoHide) {
Shelf* shelf = GetPrimaryShelf();
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
EXPECT_LT(baseline, alignment_delegate()->GetBaseline());
}
TEST_F(AshPopupAlignmentDelegateTest, DisplayResize) {
const gfx::Rect toast_size(0, 0, 10, 10);
UpdateDisplay("600x600");
int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
int baseline = alignment_delegate()->GetBaseLine();
int baseline = alignment_delegate()->GetBaseline();
UpdateDisplay("800x800");
EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
EXPECT_LT(baseline, alignment_delegate()->GetBaseline());
UpdateDisplay("400x400");
EXPECT_GT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_GT(baseline, alignment_delegate()->GetBaseLine());
EXPECT_GT(baseline, alignment_delegate()->GetBaseline());
}
TEST_F(AshPopupAlignmentDelegateTest, DockedMode) {
const gfx::Rect toast_size(0, 0, 10, 10);
UpdateDisplay("600x600");
int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
int baseline = alignment_delegate()->GetBaseLine();
int baseline = alignment_delegate()->GetBaseline();
// Emulate the docked mode; enter to an extended mode, then invoke
// OnNativeDisplaysChanged() with the info for the secondary display only.
......@@ -180,14 +180,14 @@ TEST_F(AshPopupAlignmentDelegateTest, DockedMode) {
display_manager()->OnNativeDisplaysChanged(new_info);
EXPECT_LT(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_LT(baseline, alignment_delegate()->GetBaseLine());
EXPECT_LT(baseline, alignment_delegate()->GetBaseline());
}
TEST_F(AshPopupAlignmentDelegateTest, TrayHeight) {
const gfx::Rect toast_size(0, 0, 10, 10);
UpdateDisplay("600x600");
int origin_x = alignment_delegate()->GetToastOriginX(toast_size);
int baseline = alignment_delegate()->GetBaseLine();
int baseline = alignment_delegate()->GetBaseline();
// Simulate the system tray bubble being open.
const int kTrayHeight = 100;
......@@ -195,7 +195,7 @@ TEST_F(AshPopupAlignmentDelegateTest, TrayHeight) {
EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size));
EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenPopups,
alignment_delegate()->GetBaseLine());
alignment_delegate()->GetBaseline());
}
TEST_F(AshPopupAlignmentDelegateTest, Extended) {
......@@ -211,7 +211,7 @@ TEST_F(AshPopupAlignmentDelegateTest, Extended) {
// Make sure that the toast position on the secondary display is
// positioned correctly.
EXPECT_LT(1300, for_2nd_display.GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
EXPECT_LT(700, for_2nd_display.GetBaseLine());
EXPECT_LT(700, for_2nd_display.GetBaseline());
}
TEST_F(AshPopupAlignmentDelegateTest, Unified) {
......@@ -236,17 +236,17 @@ TEST_F(AshPopupAlignmentDelegateTest, KeyboardShowing) {
ASSERT_TRUE(keyboard::IsKeyboardOverscrollEnabled());
UpdateDisplay("600x600");
int baseline = alignment_delegate()->GetBaseLine();
int baseline = alignment_delegate()->GetBaseline();
Shelf* shelf = GetPrimaryShelf();
gfx::Rect keyboard_bounds(0, 300, 600, 300);
shelf->SetVirtualKeyboardBoundsForTesting(keyboard_bounds);
int keyboard_baseline = alignment_delegate()->GetBaseLine();
int keyboard_baseline = alignment_delegate()->GetBaseline();
EXPECT_NE(baseline, keyboard_baseline);
EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
shelf->SetVirtualKeyboardBoundsForTesting(gfx::Rect());
EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
EXPECT_EQ(baseline, alignment_delegate()->GetBaseline());
}
} // namespace ash
......@@ -39,7 +39,7 @@ int DesktopPopupAlignmentDelegate::GetToastOriginX(
return work_area_.right() - kMarginBetweenPopups - toast_bounds.width();
}
int DesktopPopupAlignmentDelegate::GetBaseLine() const {
int DesktopPopupAlignmentDelegate::GetBaseline() const {
return IsTopDown() ? work_area_.y() + kMarginBetweenPopups
: work_area_.bottom() - kMarginBetweenPopups;
}
......
......@@ -33,7 +33,7 @@ class MESSAGE_CENTER_EXPORT DesktopPopupAlignmentDelegate
// Overridden from PopupAlignmentDelegate:
int GetToastOriginX(const gfx::Rect& toast_bounds) const override;
int GetBaseLine() const override;
int GetBaseline() const override;
gfx::Rect GetWorkArea() const override;
bool IsTopDown() const override;
bool IsFromLeft() const override;
......
......@@ -123,7 +123,7 @@ void MessagePopupCollection::UpdateWidgets() {
}
bool top_down = alignment_delegate_->IsTopDown();
int base = GetBaseLine(toasts_.empty() ? NULL : toasts_.back());
int base = GetBaseline();
#if defined(OS_CHROMEOS)
bool is_primary_display =
alignment_delegate_->IsPrimaryDisplayForNotification();
......@@ -291,8 +291,8 @@ void MessagePopupCollection::RemoveToast(ToastContentsView* toast,
void MessagePopupCollection::RepositionWidgets() {
bool top_down = alignment_delegate_->IsTopDown();
int base = GetBaseLine(NULL); // We don't want to position relative to last
// toast - we want re-position.
// We don't want to position relative to last toast - we want re-position.
int base = alignment_delegate_->GetBaseline();
for (Toasts::const_iterator iter = toasts_.begin(); iter != toasts_.end();) {
Toasts::const_iterator curr = iter++;
......@@ -361,14 +361,14 @@ void MessagePopupCollection::RepositionWidgetsWithTarget() {
}
}
int MessagePopupCollection::GetBaseLine(ToastContentsView* last_toast) const {
if (!last_toast) {
return alignment_delegate_->GetBaseLine();
} else if (alignment_delegate_->IsTopDown()) {
int MessagePopupCollection::GetBaseline() const {
if (toasts_.empty())
return alignment_delegate_->GetBaseline();
if (alignment_delegate_->IsTopDown())
return toasts_.back()->bounds().bottom() + kToastMarginY;
} else {
return toasts_.back()->origin().y() - kToastMarginY;
}
return toasts_.back()->origin().y() - kToastMarginY;
}
void MessagePopupCollection::OnNotificationAdded(
......
......@@ -115,9 +115,9 @@ class MESSAGE_CENTER_EXPORT MessagePopupCollection
// See crbug.com/224089
void RepositionWidgetsWithTarget();
// The base line is an (imaginary) line that would touch the bottom of the
// The baseline is an (imaginary) line that would touch the bottom of the
// next created notification if bottom-aligned or its top if top-aligned.
int GetBaseLine(ToastContentsView* last_toast) const;
int GetBaseline() const;
// Overridden from MessageCenterObserver:
void OnNotificationAdded(const std::string& notification_id) override;
......
......@@ -33,7 +33,7 @@ class MESSAGE_CENTER_EXPORT PopupAlignmentDelegate {
// Returns the baseline height of the current work area. That is the starting
// point if there are no other toasts.
virtual int GetBaseLine() const = 0;
virtual int GetBaseline() const = 0;
// Returns the rect of the current work area.
virtual gfx::Rect GetWorkArea() const = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment