diff --git a/app/brave_generated_resources.grd b/app/brave_generated_resources.grd index 904bb94bb46e..a23636ce7aae 100644 --- a/app/brave_generated_resources.grd +++ b/app/brave_generated_resources.grd @@ -241,6 +241,9 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U Hides the Brave Rewards button in the location bar when Brave Rewards is not enabled + + Always show bookmarks bar on New Tab page + New Tor Identity diff --git a/browser/brave_tab_helpers.cc b/browser/brave_tab_helpers.cc index fefe0d2b3b74..6542a5a5bff0 100644 --- a/browser/brave_tab_helpers.cc +++ b/browser/brave_tab_helpers.cc @@ -7,6 +7,7 @@ #include "brave/browser/brave_drm_tab_helper.h" #include "brave/browser/greaselion/greaselion_tab_helper.h" +#include "brave/browser/ui/bookmark/brave_bookmark_tab_helper.h" #include "brave/components/brave_ads/browser/ads_tab_helper.h" #include "brave/components/brave_rewards/browser/buildflags/buildflags.h" #include "brave/components/brave_shields/browser/buildflags/buildflags.h" // For STP @@ -36,6 +37,8 @@ void AttachTabHelpers(content::WebContents* web_contents) { #endif // Add tab helpers here unless they are intended for android too BraveDrmTabHelper::CreateForWebContents(web_contents); + BraveBookmarkTabHelper::CreateForWebContents(web_contents); + #if BUILDFLAG(BRAVE_STP_ENABLED) if (TrackingProtectionHelper::IsSmartTrackingProtectionEnabled()) { brave_shields::TrackingProtectionHelper::CreateForWebContents(web_contents); diff --git a/browser/browser_context_keyed_service_factories.cc b/browser/browser_context_keyed_service_factories.cc index 029b7f47cadb..aa8cc2ed3d4b 100644 --- a/browser/browser_context_keyed_service_factories.cc +++ b/browser/browser_context_keyed_service_factories.cc @@ -12,6 +12,10 @@ #include "brave/components/brave_rewards/browser/rewards_service_factory.h" #include "brave/components/brave_sync/brave_sync_service_factory.h" +#if !defined(OS_ANDROID) +#include "brave/browser/ui/bookmark/bookmark_prefs_service_factory.h" +#endif + namespace brave { void EnsureBrowserContextKeyedServiceFactoriesBuilt() { @@ -21,6 +25,10 @@ void EnsureBrowserContextKeyedServiceFactoriesBuilt() { greaselion::GreaselionServiceFactory::GetInstance(); TorProfileServiceFactory::GetInstance(); SearchEngineProviderServiceFactory::GetInstance(); + +#if !defined(OS_ANDROID) + BookmarkPrefsServiceFactory::GetInstance(); +#endif } } // namespace brave diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index 1ac49150c443..ac71b6db74aa 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -78,6 +78,8 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetWhitelistedKeys() { settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_brave_whitelist)[browsing_data::prefs::kDeleteHostedAppsDataOnExit] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_brave_whitelist)[kAlwaysShowBookmarkBarOnNTP] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; // WebTorrent pref (*s_brave_whitelist)[kWebTorrentEnabled] = settings_api::PrefType::PREF_TYPE_BOOLEAN; diff --git a/browser/resources/settings/brave_appearance_page/brave_appearance_page.html b/browser/resources/settings/brave_appearance_page/brave_appearance_page.html index 8ec770a96629..fa4942d74d26 100644 --- a/browser/resources/settings/brave_appearance_page/brave_appearance_page.html +++ b/browser/resources/settings/brave_appearance_page/brave_appearance_page.html @@ -37,5 +37,10 @@ sub-label="$i18n{appearanceSettingsHideBraveRewardsButtonDesc}" > + + diff --git a/browser/ui/BUILD.gn b/browser/ui/BUILD.gn index 28559b056fc7..0eb2c1158ff1 100644 --- a/browser/ui/BUILD.gn +++ b/browser/ui/BUILD.gn @@ -25,6 +25,12 @@ source_set("ui") { if (!is_android) { sources += [ + "bookmark/brave_bookmark_tab_helper.cc", + "bookmark/brave_bookmark_tab_helper.h", + "bookmark/bookmark_prefs_service.cc", + "bookmark/bookmark_prefs_service.h", + "bookmark/bookmark_prefs_service_factory.cc", + "bookmark/bookmark_prefs_service_factory.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/bookmark_prefs_service.cc b/browser/ui/bookmark/bookmark_prefs_service.cc new file mode 100644 index 000000000000..b6b12a271fc5 --- /dev/null +++ b/browser/ui/bookmark/bookmark_prefs_service.cc @@ -0,0 +1,32 @@ +/* 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 "brave/browser/ui/bookmark/bookmark_prefs_service.h" + +#include "brave/common/pref_names.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_list.h" + +BookmarkPrefsService::BookmarkPrefsService(Profile* profile) + : profile_(profile), + prefs_(profile->GetPrefs()) { + pref_change_registrar_.Init(prefs_); + pref_change_registrar_.Add( + kAlwaysShowBookmarkBarOnNTP, + base::BindRepeating(&BookmarkPrefsService::OnPreferenceChanged, + base::Unretained(this))); +} + +BookmarkPrefsService::~BookmarkPrefsService() = default; + +void BookmarkPrefsService::OnPreferenceChanged() { + for (Browser* browser : *BrowserList::GetInstance()) { + if (profile_->IsSameProfile(browser->profile())) { + browser->UpdateBookmarkBarState( + Browser::BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); + } + } +} diff --git a/browser/ui/bookmark/bookmark_prefs_service.h b/browser/ui/bookmark/bookmark_prefs_service.h new file mode 100644 index 000000000000..e6cc9ae299ca --- /dev/null +++ b/browser/ui/bookmark/bookmark_prefs_service.h @@ -0,0 +1,31 @@ +/* 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/. */ + +#ifndef BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_H_ +#define BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_H_ + +#include "components/keyed_service/core/keyed_service.h" +#include "components/prefs/pref_change_registrar.h" +#include "content/public/browser/browser_thread.h" + +class PrefService; +class Profile; + +class BookmarkPrefsService : public KeyedService { + public: + explicit BookmarkPrefsService(Profile* profile); + ~BookmarkPrefsService() override; + + private: + void OnPreferenceChanged(); + + Profile* profile_; + PrefService* prefs_; + PrefChangeRegistrar pref_change_registrar_; + + DISALLOW_COPY_AND_ASSIGN(BookmarkPrefsService); +}; + +#endif // BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_H_ diff --git a/browser/ui/bookmark/bookmark_prefs_service_factory.cc b/browser/ui/bookmark/bookmark_prefs_service_factory.cc new file mode 100644 index 000000000000..3cad4da3bfe3 --- /dev/null +++ b/browser/ui/bookmark/bookmark_prefs_service_factory.cc @@ -0,0 +1,51 @@ +/* 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 "brave/browser/ui/bookmark/bookmark_prefs_service_factory.h" + +#include "brave/browser/ui/bookmark/bookmark_prefs_service.h" +#include "brave/common/pref_names.h" +#include "chrome/browser/profiles/incognito_helpers.h" +#include "chrome/browser/profiles/profile.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/pref_registry/pref_registry_syncable.h" + +// static +BookmarkPrefsService* BookmarkPrefsServiceFactory::GetForBrowserContext( + content::BrowserContext* context) { + return static_cast( + GetInstance()->GetServiceForBrowserContext(context, true)); +} + +// static +BookmarkPrefsServiceFactory* BookmarkPrefsServiceFactory::GetInstance() { + return base::Singleton::get(); +} + +BookmarkPrefsServiceFactory::BookmarkPrefsServiceFactory() + : BrowserContextKeyedServiceFactory( + "BookmarkPrefsService", + BrowserContextDependencyManager::GetInstance()) {} + +BookmarkPrefsServiceFactory::~BookmarkPrefsServiceFactory() {} + +KeyedService* BookmarkPrefsServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + return new BookmarkPrefsService(Profile::FromBrowserContext(context)); +} + +content::BrowserContext* BookmarkPrefsServiceFactory::GetBrowserContextToUse( + content::BrowserContext* context) const { + return chrome::GetBrowserContextRedirectedInIncognito(context); +} + +bool BookmarkPrefsServiceFactory::ServiceIsCreatedWithBrowserContext() const { + return true; +} + +void BookmarkPrefsServiceFactory::RegisterProfilePrefs( + user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterBooleanPref(kAlwaysShowBookmarkBarOnNTP, false); +} diff --git a/browser/ui/bookmark/bookmark_prefs_service_factory.h b/browser/ui/bookmark/bookmark_prefs_service_factory.h new file mode 100644 index 000000000000..92fb45e377ba --- /dev/null +++ b/browser/ui/bookmark/bookmark_prefs_service_factory.h @@ -0,0 +1,39 @@ +/* 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/. */ + +#ifndef BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_FACTORY_H_ +#define BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_FACTORY_H_ + +#include "base/memory/singleton.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" + +class BookmarkPrefsService; + +class BookmarkPrefsServiceFactory : public BrowserContextKeyedServiceFactory { + public: + static BookmarkPrefsService* GetForBrowserContext( + content::BrowserContext* context); + + static BookmarkPrefsServiceFactory* GetInstance(); + + private: + friend struct base::DefaultSingletonTraits; + + BookmarkPrefsServiceFactory(); + ~BookmarkPrefsServiceFactory() override; + + // BrowserContextKeyedServiceFactory: + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* profile) const override; + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; + bool ServiceIsCreatedWithBrowserContext() const override; + void RegisterProfilePrefs( + user_prefs::PrefRegistrySyncable* registry) override; + + DISALLOW_COPY_AND_ASSIGN(BookmarkPrefsServiceFactory); +}; + +#endif // BRAVE_BROWSER_UI_BOOKMARK_BOOKMARK_PREFS_SERVICE_FACTORY_H_ diff --git a/browser/ui/bookmark/bookmark_tab_helper_browsertest.cc b/browser/ui/bookmark/bookmark_tab_helper_browsertest.cc index 42b7c0b3667b..0a81e20737bc 100644 --- a/browser/ui/bookmark/bookmark_tab_helper_browsertest.cc +++ b/browser/ui/bookmark/bookmark_tab_helper_browsertest.cc @@ -5,6 +5,7 @@ #include +#include "brave/common/pref_names.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/search.h" @@ -16,6 +17,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/browser/bookmark_utils.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" @@ -36,6 +38,20 @@ bool IsNTP(content::WebContents* web_contents) { search::NavEntryIsInstantNTP(web_contents, entry); } +void AddBookmarkNode(Profile* profile) { + const GURL url = GURL("https://www.brave.com"); + bookmarks::BookmarkModel* bookmark_model = + BookmarkModelFactory::GetForBrowserContext(profile); + + std::vector nodes; + bookmark_model->GetNodesByURL(url, &nodes); + EXPECT_EQ(0UL, nodes.size()); + + bookmarks::AddIfNotBookmarked(bookmark_model, url, base::string16()); + bookmark_model->GetNodesByURL(url, &nodes); + EXPECT_EQ(1UL, nodes.size()); +} + } // namespace IN_PROC_BROWSER_TEST_F(BookmarkTabHelperBrowserTest, @@ -47,18 +63,33 @@ IN_PROC_BROWSER_TEST_F(BookmarkTabHelperBrowserTest, chrome::ToggleBookmarkBar(browser()); EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); - const GURL url = GURL("https://www.brave.com"); - bookmarks::BookmarkModel* bookmark_model = - BookmarkModelFactory::GetForBrowserContext(browser()->profile()); + AddBookmarkNode(browser()->profile()); - std::vector nodes; - bookmark_model->GetNodesByURL(url, &nodes); - EXPECT_EQ(0UL, nodes.size()); + chrome::ToggleBookmarkBar(browser()); - bookmarks::AddIfNotBookmarked(bookmark_model, url, base::string16()); - bookmark_model->GetNodesByURL(url, &nodes); - EXPECT_EQ(1UL, nodes.size()); + // Check bookmark is still hidden on NTP. + EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); +} +IN_PROC_BROWSER_TEST_F(BookmarkTabHelperBrowserTest, + AlwaysShowBookmarkBarOnNTPTest) { + auto* profile = browser()->profile(); + // Check default is false. + EXPECT_FALSE(profile->GetPrefs()->GetBoolean(kAlwaysShowBookmarkBarOnNTP)); + auto* contents = browser()->tab_strip_model()->GetActiveWebContents(); + EXPECT_TRUE(content::NavigateToURL(contents, + GURL(chrome::kChromeUINewTabURL))); + EXPECT_TRUE(IsNTP(contents)); + AddBookmarkNode(profile); + profile->GetPrefs()->SetBoolean(kAlwaysShowBookmarkBarOnNTP, true); + + // Check bookmark is visible on NTP. + EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); + + // Check bookmark is still visible on NTP regardless of kBookmarkBar pref + // change. chrome::ToggleBookmarkBar(browser()); - EXPECT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); + EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); + chrome::ToggleBookmarkBar(browser()); + EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); } diff --git a/browser/ui/bookmark/brave_bookmark_tab_helper.cc b/browser/ui/bookmark/brave_bookmark_tab_helper.cc new file mode 100644 index 000000000000..7855b1026608 --- /dev/null +++ b/browser/ui/bookmark/brave_bookmark_tab_helper.cc @@ -0,0 +1,48 @@ +/* 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 "brave/browser/ui/bookmark/brave_bookmark_tab_helper.h" + +#include "brave/common/pref_names.h" +#include "chrome/browser/profiles/profile.h" +#include "components/prefs/pref_service.h" + +BraveBookmarkTabHelper::BraveBookmarkTabHelper( + content::WebContents* web_contents) + : web_contents_(web_contents) { +} + +BraveBookmarkTabHelper::~BraveBookmarkTabHelper() { +} + +void BraveBookmarkTabHelper::AddObserver(BookmarkTabHelperObserver* observer) { + BookmarkTabHelper::FromWebContents(web_contents_)->AddObserver(observer); +} + +void BraveBookmarkTabHelper::RemoveObserver( + BookmarkTabHelperObserver* observer) { + BookmarkTabHelper::FromWebContents(web_contents_)->RemoveObserver(observer); +} + +bool BraveBookmarkTabHelper::ShouldShowBookmarkBar() { + BookmarkTabHelper* helper = + BookmarkTabHelper::FromWebContents(web_contents_); + if (!helper) + return false; + + // Originally, bookmark is visible for NTP when bookmarks are non empty. + // In that case, we want to hide bookmark bar on NTP if user chooses to hide. + // When bookmark should be hidden, we do not change it. + bool should_show = helper->ShouldShowBookmarkBar(); + if (should_show) { + Profile* profile = + Profile::FromBrowserContext(web_contents_->GetBrowserContext()); + should_show = profile->GetPrefs()->GetBoolean(kAlwaysShowBookmarkBarOnNTP); + } + + return should_show; +} + +WEB_CONTENTS_USER_DATA_KEY_IMPL(BraveBookmarkTabHelper) diff --git a/browser/ui/bookmark/brave_bookmark_tab_helper.h b/browser/ui/bookmark/brave_bookmark_tab_helper.h new file mode 100644 index 000000000000..5817897dc4ca --- /dev/null +++ b/browser/ui/bookmark/brave_bookmark_tab_helper.h @@ -0,0 +1,36 @@ +/* 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/. */ + +#ifndef BRAVE_BROWSER_UI_BOOKMARK_BRAVE_BOOKMARK_TAB_HELPER_H_ +#define BRAVE_BROWSER_UI_BOOKMARK_BRAVE_BOOKMARK_TAB_HELPER_H_ + +#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" +#include "content/public/browser/web_contents_user_data.h" + +class BookmarkTabHelperObserver; + +// This proxies BookmarkTabHelper apis that used by Browser. +class BraveBookmarkTabHelper + : public content::WebContentsUserData{ + public: + ~BraveBookmarkTabHelper() override; + + bool ShouldShowBookmarkBar(); + void AddObserver(BookmarkTabHelperObserver* observer); + void RemoveObserver(BookmarkTabHelperObserver* observer); + + private: + friend class content::WebContentsUserData; + + explicit BraveBookmarkTabHelper(content::WebContents* web_contents); + + content::WebContents* web_contents_; + + WEB_CONTENTS_USER_DATA_KEY_DECL(); + + DISALLOW_COPY_AND_ASSIGN(BraveBookmarkTabHelper); +}; + +#endif // BRAVE_BROWSER_UI_BOOKMARK_BRAVE_BOOKMARK_TAB_HELPER_H_ diff --git a/chromium_src/chrome/browser/ui/browser.cc b/chromium_src/chrome/browser/ui/browser.cc index 1127b2c1fdf4..14df4c416f1a 100644 --- a/chromium_src/chrome/browser/ui/browser.cc +++ b/chromium_src/chrome/browser/ui/browser.cc @@ -3,17 +3,29 @@ * 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 "chrome/browser/ui/browser_command_controller.h" -#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" -#include "brave/browser/ui/brave_browser_content_setting_bubble_model_delegate.h" #include "brave/browser/ui/brave_browser_command_controller.h" +#include "brave/browser/ui/brave_browser_content_setting_bubble_model_delegate.h" #include "brave/browser/ui/toolbar/brave_location_bar_model_delegate.h" +#include "chrome/browser/ui/browser_command_controller.h" +#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" + +#if !defined(OS_ANDROID) +#include "brave/browser/ui/bookmark/brave_bookmark_tab_helper.h" +#endif #define BrowserContentSettingBubbleModelDelegate \ BraveBrowserContentSettingBubbleModelDelegate #define BrowserCommandController BraveBrowserCommandController #define BrowserLocationBarModelDelegate BraveLocationBarModelDelegate +#if !defined(OS_ANDROID) +#define BookmarkTabHelper BraveBookmarkTabHelper +#endif + #include "../../../../../chrome/browser/ui/browser.cc" // NOLINT #undef BrowserLocationBarModelDelegate #undef BrowserContentSettingBubbleModelDelegate #undef BrowserCommandController + +#if !defined(OS_ANDROID) +#undef BookmarkTabHelper +#endif diff --git a/chromium_src/chrome/browser/ui/browser.h b/chromium_src/chrome/browser/ui/browser.h new file mode 100644 index 000000000000..f72d3442c31c --- /dev/null +++ b/chromium_src/chrome/browser/ui/browser.h @@ -0,0 +1,17 @@ +/* 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/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BROWSER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BROWSER_H_ + +#define BRAVE_BROWSER_H \ + private: \ + friend class BookmarkPrefsService; + +#include "../../../../../chrome/browser/ui/browser.h" // NOLINT + +#undef BRAVE_BROWSER_H + +#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_BROWSER_H_ diff --git a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index 0c067d8834bf..b31ca8478abe 100644 --- a/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chromium_src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc @@ -66,6 +66,8 @@ void BraveAddCommonStrings(content::WebUIDataSource* html_source, IDS_SETTINGS_HIDE_BRAVE_REWARDS_BUTTON_LABEL}, {"appearanceSettingsHideBraveRewardsButtonDesc", IDS_SETTINGS_HIDE_BRAVE_REWARDS_BUTTON_DESC}, + {"appearanceSettingsAlwaysShowBookmarkBarOnNTP", + IDS_SETTINGS_ALWAYS_SHOW_BOOKMARK_BAR_ON_NTP}, {"braveShieldsTitle", IDS_SETTINGS_BRAVE_SHIELDS_TITLE}, {"braveShieldsDefaultsSectionTitle", diff --git a/common/pref_names.cc b/common/pref_names.cc index 5476e9e3dc0d..9eaa91b551d1 100644 --- a/common/pref_names.cc +++ b/common/pref_names.cc @@ -66,3 +66,5 @@ const char kBraveEnabledMediaRouter[] = "brave.enable_media_router"; const char kBraveWalletAES256GCMSivNonce[] = "brave.wallet.aes_256_gcm_siv_nonce"; const char kBraveWalletEncryptedSeed[] = "brave.wallet.encrypted_seed"; +const char kAlwaysShowBookmarkBarOnNTP[] = + "brave.always_show_bookmark_bar_on_ntp"; diff --git a/common/pref_names.h b/common/pref_names.h index 4899fba72004..e413927049bc 100644 --- a/common/pref_names.h +++ b/common/pref_names.h @@ -55,5 +55,6 @@ extern const char kNewTabPageShowStats[]; extern const char kBraveEnabledMediaRouter[]; extern const char kBraveWalletAES256GCMSivNonce[]; extern const char kBraveWalletEncryptedSeed[]; +extern const char kAlwaysShowBookmarkBarOnNTP[]; #endif // BRAVE_COMMON_PREF_NAMES_H_ diff --git a/patches/chrome-browser-ui-bookmarks-bookmark_tab_helper.cc.patch b/patches/chrome-browser-ui-bookmarks-bookmark_tab_helper.cc.patch deleted file mode 100644 index c7e038840ab3..000000000000 --- a/patches/chrome-browser-ui-bookmarks-bookmark_tab_helper.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc -index f6ef61a0ac86ae55e8f9e80ece0758253af48520..888d656cf7080ebc32e90fc492e70a9b394d7026 100644 ---- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc -+++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc -@@ -67,6 +67,7 @@ bool BookmarkTabHelper::ShouldShowBookmarkBar() const { - !prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar)) - return false; - -+ return false; - // The bookmark bar is only shown on the NTP if the user - // has added something to it. - return IsNTP(web_contents()) && bookmark_model_ && diff --git a/patches/chrome-browser-ui-browser.h.patch b/patches/chrome-browser-ui-browser.h.patch new file mode 100644 index 000000000000..3b14921241be --- /dev/null +++ b/patches/chrome-browser-ui-browser.h.patch @@ -0,0 +1,12 @@ +diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h +index 1633ee2416ae5385a7ad1cd7fdefdad971a427e3..0670f17e6f574d84acabe06db608011de9d415d5 100644 +--- a/chrome/browser/ui/browser.h ++++ b/chrome/browser/ui/browser.h +@@ -593,6 +593,7 @@ class Browser : public TabStripModelObserver, + // dragging. + void SetIsInTabDragging(bool is_in_tab_dragging); + ++ BRAVE_BROWSER_H + private: + friend class BrowserTest; + friend class FullscreenControllerInteractiveTest;