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

Display brave:// protocol for internal urls when hovered #15336

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions browser/ui/brave_browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ void BraveBrowser::ResetTryToCloseWindow() {
Browser::ResetTryToCloseWindow();
}

void BraveBrowser::UpdateTargetURL(content::WebContents* source,
const GURL& url) {
GURL target_url = url;
if (url.SchemeIs(content::kChromeUIScheme)) {
GURL::Replacements replacements;
replacements.SetSchemeStr(content::kBraveUIScheme);
target_url = target_url.ReplaceComponents(replacements);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be worth replacing 'chrome-untrusted' too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not so sure about that because chrome-untrusted is never meant to be displayed to users

Browser::UpdateTargetURL(source, target_url);
}

bool BraveBrowser::ShouldAskForBrowserClosingBeforeHandlers() {
if (g_suppress_dialog_for_testing)
return false;
Expand Down
1 change: 1 addition & 0 deletions browser/ui/brave_browser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class BraveBrowser : public Browser {
bool TryToCloseWindow(
bool skip_beforeunload,
const base::RepeatingCallback<void(bool)>& on_close_confirmed) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
void ResetTryToCloseWindow() override;

void TabStripEmpty() override;
Expand Down