-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add always show bookmark bar on NTP option
Some user might want to show bookmark on NTP when show bookmark bar option is false.
- Loading branch information
Showing
12 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
chromium_src/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* 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/common/pref_names.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "components/prefs/pref_service.h" | ||
|
||
namespace { | ||
bool ShouldShowBookmarkBarOnNTP(Profile* profile) { | ||
PrefService* prefs = profile->GetPrefs(); | ||
return prefs->GetBoolean(kAlwaysShowBookmarkBarOnNTP); | ||
} | ||
} // namespace | ||
|
||
#define ReturnFalseIfBookmarkBarShouldHide(profile) \ | ||
if (!ShouldShowBookmarkBarOnNTP(profile)) \ | ||
return false; | ||
|
||
#include "../../../../../../chrome/browser/ui/bookmarks/bookmark_tab_helper.cc" // NOLINT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
patches/chrome-browser-ui-bookmarks-bookmark_tab_helper.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc | ||
index f6ef61a0ac86ae55e8f9e80ece0758253af48520..888d656cf7080ebc32e90fc492e70a9b394d7026 100644 | ||
index f6ef61a0ac86ae55e8f9e80ece0758253af48520..d4e435dbda3b1a26690b33c73cfb21bdba3b6cdd 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; | ||
+ ReturnFalseIfBookmarkBarShouldHide(profile); | ||
// The bookmark bar is only shown on the NTP if the user | ||
// has added something to it. | ||
return IsNTP(web_contents()) && bookmark_model_ && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc | ||
index bac1e524636c5046248c7fc3b4317ec8cb29574f..43a2466d3bcc144efaca7160d7141c4c7d35a4ec 100644 | ||
--- a/chrome/browser/ui/browser.cc | ||
+++ b/chrome/browser/ui/browser.cc | ||
@@ -466,6 +466,7 @@ Browser::Browser(const CreateParams& params) | ||
base::Unretained(this), | ||
BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); | ||
|
||
+ RegisterAlwaysShowBookmarkBarOnNTPChange | ||
if (search::IsInstantExtendedAPIEnabled() && is_type_tabbed()) | ||
instant_controller_.reset(new BrowserInstantController(this)); | ||
|