From 09800ec51fee2aecc84eac47018b6c2c022da3b0 Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Tue, 21 Jan 2020 15:09:25 -0800 Subject: [PATCH] Unhide other bookmarks node https://github.com/brave/brave-core/pull/3620 --- browser/BUILD.gn | 2 -- browser/bookmarks/brave_bookmark_client.cc | 23 --------------- browser/bookmarks/brave_bookmark_client.h | 26 ----------------- .../brave_bookmark_client_browsertest.cc | 28 ------------------- browser/ui/BUILD.gn | 2 -- .../recently_used_folders_combo_model.cc | 17 ----------- .../recently_used_folders_combo_model.h | 22 --------------- .../bookmarks/bookmark_model_factory.cc | 2 -- .../recently_used_folders_combo_model.h | 16 ----------- .../views/bookmarks/bookmark_bubble_view.cc | 10 ------- ...-recently_used_folders_combo_model.h.patch | 12 -------- ...ws-bookmarks-bookmark_editor_view.cc.patch | 13 --------- test/BUILD.gn | 1 - 13 files changed, 174 deletions(-) delete mode 100644 browser/bookmarks/brave_bookmark_client.cc delete mode 100644 browser/bookmarks/brave_bookmark_client.h delete mode 100644 browser/bookmarks/brave_bookmark_client_browsertest.cc delete mode 100644 browser/ui/bookmark/recently_used_folders_combo_model.cc delete mode 100644 browser/ui/bookmark/recently_used_folders_combo_model.h delete mode 100644 chromium_src/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h delete mode 100644 chromium_src/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc delete mode 100644 patches/chrome-browser-ui-bookmarks-recently_used_folders_combo_model.h.patch delete mode 100644 patches/chrome-browser-ui-views-bookmarks-bookmark_editor_view.cc.patch diff --git a/browser/BUILD.gn b/browser/BUILD.gn index 3292e0d03282..50db8cab8d3e 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -27,8 +27,6 @@ source_set("browser_process") { "autocomplete/brave_autocomplete_provider_client.h", "autocomplete/brave_autocomplete_scheme_classifier.cc", "autocomplete/brave_autocomplete_scheme_classifier.h", - "bookmarks/brave_bookmark_client.cc", - "bookmarks/brave_bookmark_client.h", "brave_rewards/rewards_tab_helper.cc", "brave_rewards/rewards_tab_helper.h", "brave_shields/ad_block_pref_service_factory.cc", diff --git a/browser/bookmarks/brave_bookmark_client.cc b/browser/bookmarks/brave_bookmark_client.cc deleted file mode 100644 index 357840524003..000000000000 --- a/browser/bookmarks/brave_bookmark_client.cc +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/bookmarks/brave_bookmark_client.h" - -BraveBookmarkClient::BraveBookmarkClient( - Profile* profile, - bookmarks::ManagedBookmarkService* managed_bookmark_service, - sync_bookmarks::BookmarkSyncService* bookmark_sync_service) : - ChromeBookmarkClient(profile, managed_bookmark_service, - bookmark_sync_service) { -} - -BraveBookmarkClient::~BraveBookmarkClient() {} - -bool BraveBookmarkClient::IsPermanentNodeVisible( - const bookmarks::BookmarkPermanentNode* node) { - if (node->type() == bookmarks::BookmarkNode::OTHER_NODE) - return false; - return ChromeBookmarkClient::IsPermanentNodeVisible(node); -} diff --git a/browser/bookmarks/brave_bookmark_client.h b/browser/bookmarks/brave_bookmark_client.h deleted file mode 100644 index 0a3c571bf385..000000000000 --- a/browser/bookmarks/brave_bookmark_client.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_BROWSER_BOOKMARKS_BRAVE_BOOKMARK_CLIENT_H_ -#define BRAVE_BROWSER_BOOKMARKS_BRAVE_BOOKMARK_CLIENT_H_ - -#include "chrome/browser/bookmarks/chrome_bookmark_client.h" - -class BraveBookmarkClient : public ChromeBookmarkClient { - public: - BraveBookmarkClient( - Profile* profile, - bookmarks::ManagedBookmarkService* managed_bookmark_service, - sync_bookmarks::BookmarkSyncService* bookmark_sync_service); - ~BraveBookmarkClient() override; - - // bookmarks::BookmarkClient: - bool IsPermanentNodeVisible( - const bookmarks::BookmarkPermanentNode* node) override; - private: - DISALLOW_COPY_AND_ASSIGN(BraveBookmarkClient); -}; - -#endif // BRAVE_BROWSER_BOOKMARKS_BRAVE_BOOKMARK_CLIENT_H_ diff --git a/browser/bookmarks/brave_bookmark_client_browsertest.cc b/browser/bookmarks/brave_bookmark_client_browsertest.cc deleted file mode 100644 index 262998d1128a..000000000000 --- a/browser/bookmarks/brave_bookmark_client_browsertest.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "base/strings/utf_string_conversions.h" -#include "chrome/browser/bookmarks/bookmark_model_factory.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "components/bookmarks/browser/bookmark_model.h" - -using BraveBookmarkClientTest = InProcessBrowserTest; - -IN_PROC_BROWSER_TEST_F(BraveBookmarkClientTest, IsPermanentNodeVisible) { - bookmarks::BookmarkModel* bookmark_model = - BookmarkModelFactory::GetForBrowserContext(browser()->profile()); - EXPECT_TRUE(bookmark_model->bookmark_bar_node()->IsVisible()); - // Other node invisible by default - EXPECT_FALSE(bookmark_model->other_node()->IsVisible()); - EXPECT_FALSE(bookmark_model->mobile_node()->IsVisible()); - - bookmark_model->AddURL(bookmark_model->other_node(), 0, - base::ASCIIToUTF16("A"), GURL("https://A.com")); - EXPECT_TRUE(bookmark_model->other_node()->IsVisible()); - BraveMigrateOtherNode(bookmark_model); - EXPECT_FALSE(bookmark_model->other_node()->IsVisible()); -} diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 4ae7769914d5..4e866e1ff3d6 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -57,8 +57,6 @@ source_set("ui") { "bookmark/bookmark_prefs_service.h", "bookmark/bookmark_prefs_service_factory.cc", "bookmark/bookmark_prefs_service_factory.h", - "bookmark/recently_used_folders_combo_model.cc", - "bookmark/recently_used_folders_combo_model.h", "brave_browser_command_controller.cc", "brave_browser_command_controller.h", "brave_browser_content_setting_bubble_model_delegate.cc", diff --git a/browser/ui/bookmark/recently_used_folders_combo_model.cc b/browser/ui/bookmark/recently_used_folders_combo_model.cc deleted file mode 100644 index 0c36e0b5d99e..000000000000 --- a/browser/ui/bookmark/recently_used_folders_combo_model.cc +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/ui/bookmark/recently_used_folders_combo_model.h" - -#include "components/bookmarks/browser/bookmark_model.h" - -BraveRecentlyUsedFoldersComboModel::BraveRecentlyUsedFoldersComboModel( - bookmarks::BookmarkModel* model, - const bookmarks::BookmarkNode* node) - : RecentlyUsedFoldersComboModel(model, node) { - RecentlyUsedFoldersComboModel::RemoveNode(model->other_node()); -} - -BraveRecentlyUsedFoldersComboModel::~BraveRecentlyUsedFoldersComboModel() {} diff --git a/browser/ui/bookmark/recently_used_folders_combo_model.h b/browser/ui/bookmark/recently_used_folders_combo_model.h deleted file mode 100644 index 0854eefb0128..000000000000 --- a/browser/ui/bookmark/recently_used_folders_combo_model.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_BROWSER_UI_BOOKMARK_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ -#define BRAVE_BROWSER_UI_BOOKMARK_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ - -#include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" - -class BraveRecentlyUsedFoldersComboModel - : public RecentlyUsedFoldersComboModel { - public: - BraveRecentlyUsedFoldersComboModel(bookmarks::BookmarkModel* model, - const bookmarks::BookmarkNode* node); - ~BraveRecentlyUsedFoldersComboModel() override; - - private: - DISALLOW_COPY_AND_ASSIGN(BraveRecentlyUsedFoldersComboModel); -}; - -#endif // BRAVE_BROWSER_UI_BOOKMARK_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ diff --git a/chromium_src/chrome/browser/bookmarks/bookmark_model_factory.cc b/chromium_src/chrome/browser/bookmarks/bookmark_model_factory.cc index 19b26fba7d6a..fe8a987253dc 100644 --- a/chromium_src/chrome/browser/bookmarks/bookmark_model_factory.cc +++ b/chromium_src/chrome/browser/bookmarks/bookmark_model_factory.cc @@ -7,6 +7,4 @@ #define GetBrowserContextRedirectedInIncognito \ GetBrowserContextRedirectedInIncognitoOverride -#define ChromeBookmarkClient BraveBookmarkClient #include "../../../../../chrome/browser/bookmarks/bookmark_model_factory.cc" -#undef ChromeBookmarkClient diff --git a/chromium_src/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h b/chromium_src/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h deleted file mode 100644 index 78ac7c28c1ce..000000000000 --- a/chromium_src/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ -#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ - -#define BRAVE_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ \ - private: \ - friend class BraveRecentlyUsedFoldersComboModel; \ - public: -#include "../../../../../../chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" // NOLINT -#undef BRAVE_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ - -#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BOOKMARKS_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ diff --git a/chromium_src/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chromium_src/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc deleted file mode 100644 index e7e635279da9..000000000000 --- a/chromium_src/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright 2019 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "brave/browser/ui/bookmark/recently_used_folders_combo_model.h" - -#define RecentlyUsedFoldersComboModel BraveRecentlyUsedFoldersComboModel -#include "../../../../../../../chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc" -#undef RecentlyUsedFoldersComboModel diff --git a/patches/chrome-browser-ui-bookmarks-recently_used_folders_combo_model.h.patch b/patches/chrome-browser-ui-bookmarks-recently_used_folders_combo_model.h.patch deleted file mode 100644 index 7f6c58d8358c..000000000000 --- a/patches/chrome-browser-ui-bookmarks-recently_used_folders_combo_model.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h -index 73b769ef73a562b55da2844b77265b1f9d788d83..48794994e7f8dd3afce69d5be076f580fb13c22c 100644 ---- a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h -+++ b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h -@@ -73,6 +73,7 @@ class RecentlyUsedFoldersComboModel : public ui::ComboboxModel, - void MaybeChangeParent(const bookmarks::BookmarkNode* node, - int selected_index); - -+ BRAVE_RECENTLY_USED_FOLDERS_COMBO_MODEL_H_ - private: - // Returns the node at the specified |index|. - const bookmarks::BookmarkNode* GetNodeAt(int index); diff --git a/patches/chrome-browser-ui-views-bookmarks-bookmark_editor_view.cc.patch b/patches/chrome-browser-ui-views-bookmarks-bookmark_editor_view.cc.patch deleted file mode 100644 index 7a253217a31a..000000000000 --- a/patches/chrome-browser-ui-views-bookmarks-bookmark_editor_view.cc.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc -index 64121910b194aa23f2bdee0697a2dc3ef885e235..1feba675ee7bdf70361f708d4d74a9bb6dd20eea 100644 ---- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc -+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc -@@ -493,7 +493,7 @@ BookmarkEditorView::CreateRootNode() { - std::make_unique(base::string16(), 0); - const BookmarkNode* bb_root_node = bb_model_->root_node(); - CreateNodes(bb_root_node, root_node.get()); -- DCHECK_GE(root_node->children().size(), 2u); -+ DCHECK_GE(root_node->children().size(), 1u); - DCHECK_LE(root_node->children().size(), 4u); - DCHECK_EQ(BookmarkNode::BOOKMARK_BAR, bb_root_node->children()[0]->type()); - DCHECK_EQ(BookmarkNode::OTHER_NODE, bb_root_node->children()[1]->type()); diff --git a/test/BUILD.gn b/test/BUILD.gn index af9849db3182..8b7d7fbcc812 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -501,7 +501,6 @@ test("brave_browser_tests") { "//brave/browser/autocomplete/brave_autocomplete_provider_client_browsertest.cc", "//brave/browser/brave_scheme_load_browsertest.cc", "//brave/browser/autoplay/autoplay_permission_context_browsertest.cc", - "//brave/browser/bookmarks/brave_bookmark_client_browsertest.cc", "//brave/browser/brave_content_browser_client_browsertest.cc", "//brave/browser/brave_profile_prefs_browsertest.cc", "//brave/browser/brave_first_run_browsertest.h",