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

Hide other bookmarks #3620

Merged
merged 10 commits into from
Oct 16, 2019
Merged

Hide other bookmarks #3620

merged 10 commits into from
Oct 16, 2019

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Oct 7, 2019

fix brave/brave-browser#5158

Need brave/brave-browser#6344 for rename completely work

This PR make "Other Bookmarks" invisible and prevent user from adding bookmarks into "Other Bookmarks". Existing bookmarks in "Other Bookmarks" will be moved under the same name folder under "Bookmarks"(Bookmarks Bar).
We also rename "Bookmarks Bar" to "Bookmarks" in Bookmarks Manager, [Always] Show Bookmarks Bar in mac menu, menu and setting page

Submitter Checklist:

Test Plan:

Bookmarks Bar to Bookmarks

  1. Check chrome://bookmarks/ Screen Shot 2019-10-09 at 16 47 29
  2. Check main menu on Mac Screen Shot 2019-10-09 at 16 49 34
  3. Check menu on all platforms Screen Shot 2019-10-09 at 16 50 19
  4. Check chrome://settings/?search=bookmarks Screen Shot 2019-10-09 at 16 51 13

Hide Other Bookmarks with sync disabled

  1. Open old Brave in fresh profile
  2. Put more than one bookmarks into "Other Bookmarks" and one bookmark into "Bookmarks Bar"
  3. Check these places that it contains "Other Bookmarks"
    3.1 Bookmarks Bar Screen Shot 2019-10-09 at 17 14 49
    3.2 Bookmarks Manager Screen Shot 2019-10-09 at 17 15 41
    3.3 Main menu on Mac Screen Shot 2019-10-09 at 17 17 04
    3.4 Menu on all platforms Screen Shot 2019-10-09 at 17 18 52
    3.5 Bookmarks Icon Screen Shot 2019-10-09 at 17 19 48
    3.6 Edit Bookmark Dialog Screen Shot 2019-10-09 at 17 48 38
  4. Close the old Brave and launch new Brave with the same profile
  5. All existing bookmarks in "Other Bookmarks" will be moved to the same name folder at the end of "Bookmarks Bar"
  6. Check all places in step 3, user should have no way to see "Other Bookmarks" or add any bookmarks into it

Hide Other Bookmarks with sync enabled

  1. Open old Brave in two desktop devices (A, B)
  2. Put more than one bookmarks into "Other Bookmarks" and one bookmark into "Bookmarks Bar"
  3. Establish sync chain between device A and B
  4. Wait until both devices displaying same bookmarks
  5. Close the old Brave and launch new Brave with the same profile on device A
  6. All existing bookmarks in "Other Bookmarks" will be moved to the same name folder at the end of "Bookmarks Bar" on device A
  7. Check all places in step 3 of previous section, user should have no way to see "Other Bookmarks" or add any bookmarks into it on device A
  8. Wait for a while, device B should receive sync update and check step 6 on device B
  9. Relaunch device B with new Brave and check step 7 on device B

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.

@darkdh darkdh force-pushed the hide-other-bookmarks branch 3 times, most recently from e2f0a49 to a4cfdee Compare October 9, 2019 23:12
@darkdh darkdh marked this pull request as ready for review October 9, 2019 23:12
@darkdh darkdh requested a review from bridiver as a code owner October 9, 2019 23:12
@darkdh darkdh force-pushed the hide-other-bookmarks branch 2 times, most recently from 31be5b5 to 1e0da64 Compare October 9, 2019 23:45
@darkdh darkdh self-assigned this Oct 9, 2019
AlexeyBarabash
AlexeyBarabash previously approved these changes Oct 10, 2019
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash left a comment

Choose a reason for hiding this comment

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

looks good, STR passes


// other_node should remain hidden
#define BRAVE_IS_VISIBLE \
if (type() == OTHER_NODE) \
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't we use ChromeBookmarkClient::IsPermanentNodeVisible? That's how MOBILE is displayed on android/ios and hidden on desktop

Copy link
Collaborator

Choose a reason for hiding this comment

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

meaning subclass ChromeBookmarkClient if we haven't already

Copy link
Collaborator

Choose a reason for hiding this comment

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

wait, you already have BraveBookmarkClient::IsPermanentNodeVisible so why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

the patch was originally return visible_ to get rid of !children().empty().
Then I pulled upstream unit test to run and expect it to be just invisible without override TestBookmarkClient

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason that other node is not always empty listed here
https://github.com/brave/brave-core/pull/3620/files#r335092116

Copy link
Member Author

Choose a reason for hiding this comment

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

removed in 3f388ed


// Move bookmarks under "Other Bookmarks" permanent node to a same name folder
// at the end of "Bookmark Bar" permanent node
void BookmarkModel::MigrateOtherNode() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

are any of these calls private? Can't we just pass the BookmarkModel in to a method somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 122272a


// And put the bookmark bar and other nodes at the end of the list.
items_.push_back(Item(model->bookmark_bar_node(), Item::TYPE_NODE));
+ BRAVE_RECENTLY_USED_FOLDERS_COMBO_MODEL
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we subclass this with an override in BookmarkBubbleView and then call
RemoveNode(model->other_node()); in the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 456a86f

// If the "Other Bookmarks" folder has any content, make a submenu for it and
// fill it in.
- if (!model->other_node()->children().empty()) {
+ BRAVE_BUILD_ROOT_MENU
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this needed? The other node will always be empty now, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 3f388ed

bool has_other_children = !model_->other_node()->children().empty();
bool update_other =
has_other_children != other_bookmarks_button_->GetVisible();
+ BRAVE_UPDATE_OTHER_AND_MANAGED_BUTTONS_VISIBILITY
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this needed since has_other_children is false so it will set the visibility of the button to false here? https://github.com/brave/brave-core/pull/3620/files#diff-b3cabb3a3f40d70b6d97898b3f71b98fR19 so this is also maybe not needed? https://github.com/brave/brave-core/pull/3620/files#diff-b3cabb3a3f40d70b6d97898b3f71b98fR9

Copy link
Member Author

Choose a reason for hiding this comment

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

has_other_children will not always be true https://github.com/brave/brave-core/pull/3620/files#r335092116
and
https://github.com/brave/brave-core/pull/3620/files#diff-b3cabb3a3f40d70b6d97898b3f71b98fR9
is to prevent it from drawing separator (BookmarkBarView::UpdateBookmarksSeparatorVisibility)

Copy link
Collaborator

Choose a reason for hiding this comment

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

no, I'm saying has_other_children will always be false so other_bookmarks_button_->SetVisible(has_other_children); will always be set to false

Copy link
Member Author

@darkdh darkdh Oct 15, 2019

Choose a reason for hiding this comment

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

addressed in 3f388ed


private:
// BookmarkClient:
bool IsPermanentNodeVisible(const BookmarkPermanentNode* node) override {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not clear to me what we're doing here. Changing this in a test-only bookmark client doesn't seem to really validate anything useful for us in the test?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 0f076bb

@darkdh darkdh merged commit ccafc94 into master Oct 16, 2019
@darkdh darkdh deleted the hide-other-bookmarks branch October 16, 2019 22:08
@darkdh darkdh added this to the 0.73.x - Nightly milestone Oct 16, 2019
darkdh added a commit that referenced this pull request Jan 28, 2020
@darkdh darkdh mentioned this pull request Jan 28, 2020
32 tasks
darkdh added a commit that referenced this pull request Feb 8, 2020
darkdh added a commit that referenced this pull request Feb 20, 2020
jonathanKingston pushed a commit to jonathanKingston/brave-core that referenced this pull request Mar 11, 2020
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.

Desktop Bookmark Platform Alignment
3 participants