Skip to content

Commit

Permalink
use brave:// for the virtual url and chrome:// for the internal u…
Browse files Browse the repository at this point in the history
…rl to load

fix brave/brave-browser#1616
  • Loading branch information
bridiver committed Jan 18, 2019
1 parent 0e1ce21 commit d43dd5f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 142 deletions.
6 changes: 6 additions & 0 deletions browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ namespace {

bool HandleURLRewrite(GURL* url,
content::BrowserContext* browser_context) {
if (url->SchemeIs(kBraveUIScheme)) {
GURL::Replacements replacements;
replacements.SetSchemeStr(content::kChromeUIScheme);
*url = url->ReplaceComponents(replacements);
}

if (url->SchemeIs(content::kChromeUIScheme) &&
(url->host() == chrome::kChromeUIWelcomeHost ||
url->host() == chrome::kChromeUIWelcomeWin10Host)) {
Expand Down
26 changes: 7 additions & 19 deletions chromium_src/chrome/browser/browser_about_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,20 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#define FixupBrowserAboutURL FixupBrowserAboutURL_ChromiumImpl
#define WillHandleBrowserAboutURL WillHandleBrowserAboutURL_ChromiumImpl
#include "../../../../chrome/browser/browser_about_handler.cc"
#undef FixupBrowserAboutURL
#undef WillHandleBrowserAboutURL

#include "brave/common/url_constants.h"

bool FixupBrowserAboutURLBraveImpl(GURL* url,
content::BrowserContext* browser_context) {
if (url->SchemeIs(kBraveUIScheme)) {
bool FixupBrowserAboutURL(GURL* url,
content::BrowserContext* browser_context) {
bool result = FixupBrowserAboutURL_ChromiumImpl(url, browser_context);

if (url->SchemeIs(content::kChromeUIScheme)) {
GURL::Replacements replacements;
replacements.SetSchemeStr(content::kChromeUIScheme);
replacements.SetSchemeStr(kBraveUIScheme);
*url = url->ReplaceComponents(replacements);
}
return true;
}


bool FixupBrowserAboutURL(GURL* url,
content::BrowserContext* browser_context) {
FixupBrowserAboutURLBraveImpl(url, browser_context);
return FixupBrowserAboutURL_ChromiumImpl(url, browser_context);
}

bool WillHandleBrowserAboutURL(GURL* url,
content::BrowserContext* browser_context) {
FixupBrowserAboutURLBraveImpl(url, browser_context);
return WillHandleBrowserAboutURL_ChromiumImpl(url, browser_context);
return result;
}
3 changes: 0 additions & 3 deletions chromium_src/chrome/browser/ui/browser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
#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/components/omnibox/browser/brave_location_bar_model_impl.h"

#define LocationBarModelImpl BraveLocationBarModelImpl
#define BrowserContentSettingBubbleModelDelegate BraveBrowserContentSettingBubbleModelDelegate
#define BrowserCommandController BraveBrowserCommandController
#include "../../../../../chrome/browser/ui/browser.cc"
#undef BrowserContentSettingBubbleModelDelegate
#undef BrowserCommandController
#undef LocationBarModelImpl
19 changes: 1 addition & 18 deletions components/omnibox/browser/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
source_set("browser") {
# Only //components/omnibox/browser target can depend on this target
# because this target expands //components/omnibox/browser implementation.
visibility = [ "//components/omnibox/browser", ":unit_tests" ]
visibility = [ "//components/omnibox/browser" ]

sources = [
"brave_autocomplete_controller.cc",
"brave_autocomplete_controller.h",
"brave_location_bar_model_impl.cc",
"brave_location_bar_model_impl.h",
"constants.cc",
"constants.h",
"topsites_provider_data.cc",
Expand All @@ -22,18 +20,3 @@ source_set("browser") {
"//third_party/metrics_proto",
]
}

source_set("unit_tests") {
testonly = true
sources = [
"location_bar_model_impl_unittest.cc",
]

deps = [
":browser",
"//base",
"//components/omnibox/browser",
"//testing/gtest",
"//url",
]
}
36 changes: 0 additions & 36 deletions components/omnibox/browser/brave_location_bar_model_impl.cc

This file was deleted.

18 changes: 0 additions & 18 deletions components/omnibox/browser/brave_location_bar_model_impl.h

This file was deleted.

47 changes: 0 additions & 47 deletions components/omnibox/browser/location_bar_model_impl_unittest.cc

This file was deleted.

1 change: 0 additions & 1 deletion test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ test("brave_unit_tests") {
"//chrome/test:test_support",
"//components/prefs",
"//components/prefs:test_support",
"//brave/components/omnibox/browser:unit_tests",
"//components/version_info",
"//content/test:test_support",
"//components/signin/core/browser",
Expand Down

0 comments on commit d43dd5f

Please sign in to comment.