Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bookmark toggle on NTP whether bookmark is empty or not #2563

Merged
merged 1 commit into from
May 31, 2019

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented May 31, 2019

Fix brave/brave-browser#1306

Submitter Checklist:

Test Plan:

yarn test brave_browser_tests --filter=BookmarkTabHelper*

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@simonhong simonhong added this to the 0.68.x - Nightly milestone May 31, 2019
@simonhong simonhong requested review from bsclifton and emerick May 31, 2019 09:54
@simonhong simonhong self-assigned this May 31, 2019
!prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar))
return false;

+ return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was expecting to see something like return !IsNTP(web_contents()) here. Is it safe to just return false here without further checks?

Copy link
Member Author

@simonhong simonhong May 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emerick I think this method is used for preventing bookmark bar visible or hidden opposite to the kShowBookmarkBar prefs value.

When kShowBookmarkBar is set to hidden, this method only returns true when active tab is NTP and bookmark bar isn't empty if all above conditions aren't met. So, we can hide bookmark bar on NTP by returning false here in this case.

When kShowBookmarkBar is set to visible, this method isn't called except fullscreen condition.
According to the comment of Browser::ShouldHideUIForFullscreen(), browser controls UI can be visible on MacOS fullscreen mode by sliding down. When Browser::ShouldHideUIForFullscreen() returns true, this method will be called and we should also return false to hide bookmark bar.

So, I think returning false in here is safe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, got it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emerick Thanks for quick review!

@emerick emerick self-requested a review May 31, 2019 18:13
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@simonhong simonhong merged commit f9cfb4f into master May 31, 2019
@simonhong simonhong deleted the hide_bookmark_on_ntp branch May 31, 2019 18:44
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 😄👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't hide Bookmarks bar on New Tab page
3 participants