Skip to content

Commit

Permalink
Merge pull request #7969 from /issues/12740
Browse files Browse the repository at this point in the history
Remove usage of BRAVE_CHROMIUM_BUILD and brave_chromium_build
  • Loading branch information
mariospr authored Feb 22, 2021
2 parents ec62869 + b39991f commit fc13ad8
Show file tree
Hide file tree
Showing 38 changed files with 135 additions and 187 deletions.
17 changes: 4 additions & 13 deletions build/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import("//brave/build/config.gni")

# Changing these will cause a full rebuild
brave_include_dirs_ = [
"//brave/chromium_src",
]
brave_include_dirs_ = [ "//brave/chromium_src" ]

if (brave_chromium_build) {
config("compiler") {
include_dirs = brave_include_dirs_
defines = [ "BRAVE_CHROMIUM_BUILD" ]
}
} else {
config("compiler") {}
config("compiler") {
include_dirs = brave_include_dirs_
}

# do not expose this as a public config anywhere
config("version") {
defines = [
"BRAVE_CHROMIUM_VERSION=\"$chrome_version_string\"",
]
defines = [ "BRAVE_CHROMIUM_VERSION=\"$chrome_version_string\"" ]
}
2 changes: 0 additions & 2 deletions build/features.gni
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
declare_args() {
brave_chromium_build = true

brave_services_key = ""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* 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/. */

#if defined(BRAVE_CHROMIUM_BUILD)
#define GOOGLE_CHROME_BUILD
#endif
#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/metrics/metrics_reporting_state.h"
#include "content/public/browser/web_ui.h"

#define GOOGLE_CHROME_BUILD
#include "../../../../../../../chrome/browser/ui/webui/settings/metrics_reporting_handler.cc"

#if defined(BRAVE_CHROMIUM_BUILD)
#undef GOOGLE_CHROME_BUILD
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_

#if defined(BRAVE_CHROMIUM_BUILD)
#define GOOGLE_CHROME_BUILD
#endif
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"

#define GOOGLE_CHROME_BUILD
#include "../../../../../../../chrome/browser/ui/webui/settings/metrics_reporting_handler.h"

#if defined(BRAVE_CHROMIUM_BUILD)
#undef GOOGLE_CHROME_BUILD
#endif

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_
8 changes: 4 additions & 4 deletions common/resource_bundle_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include "base/strings/sys_string_conversions.h"
#endif

#if defined(OS_ANDROID) && defined(BRAVE_CHROMIUM_BUILD)
#if defined(OS_ANDROID)
#include "ui/base/resource/resource_bundle_android.h"
#endif

namespace {

#if !defined(BRAVE_CHROMIUM_BUILD) || !defined(OS_ANDROID)
#if !defined(OS_ANDROID)
base::FilePath GetResourcesPakFilePath() {
#if defined(OS_MAC)
return base::mac::PathForFrameworkBundleResource(
Expand Down Expand Up @@ -67,7 +67,7 @@ base::FilePath GetScaledResourcesPakFilePath(ui::ScaleFactor scale_factor) {
namespace brave {

void InitializeResourceBundle() {
#if defined(OS_ANDROID) && defined(BRAVE_CHROMIUM_BUILD)
#if defined(OS_ANDROID)
ui::BraveLoadMainAndroidPackFile("assets/brave_resources.pak",
base::FilePath());
ui::BraveLoadBrave100PercentPackFile("assets/brave_100_percent.pak",
Expand All @@ -81,7 +81,7 @@ void InitializeResourceBundle() {
rb.AddDataPackFromPath(GetScaledResourcesPakFilePath(ui::SCALE_FACTOR_200P),
ui::SCALE_FACTOR_200P);
}
#endif // OS_ANDROID && defined(BRAVE_CHROMIUM_BUILD)
#endif // OS_ANDROID
}

// Returns true if this subprocess type needs the ResourceBundle initialized
Expand Down
9 changes: 2 additions & 7 deletions components/brave_rewards/browser/rewards_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "brave/components/brave_rewards/browser/static_values.h"
#include "brave/components/brave_rewards/browser/switches.h"
#include "brave/components/brave_rewards/common/pref_names.h"
#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "brave/components/services/bat_ledger/public/cpp/ledger_client_mojo_bridge.h"
#include "brave/grit/brave_generated_resources.h"
#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h"
Expand All @@ -61,6 +62,7 @@
#include "components/country_codes/country_codes.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/favicon_types.h"
#include "components/grit/brave_components_resources.h"
#include "components/os_crypt/os_crypt.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_task_traits.h"
Expand All @@ -79,13 +81,6 @@
#include "url/url_canon_stdstring.h"
#include "url/url_util.h"

#if defined(BRAVE_CHROMIUM_BUILD)
#include "brave/components/brave_rewards/resources/grit/brave_rewards_resources.h"
#include "components/grit/brave_components_resources.h"
#else
#include "components/grit/components_resources.h"
#endif

#if BUILDFLAG(ENABLE_GREASELION)
#include "brave/components/greaselion/browser/greaselion_service.h"
#endif
Expand Down
34 changes: 14 additions & 20 deletions patches/chrome-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae4220326d3790e2 100644
index 5eeb0d0c2598bbcff4981dcb6f43cae82ec37c99..1f53a398c9a77af1e08a1e0be2fd3c9d9e147b6d 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -166,6 +166,10 @@ if (!is_android && !is_mac) {
@@ -165,6 +165,7 @@ if (!is_android && !is_mac) {
"common/crash_keys.cc",
"common/crash_keys.h",
]
+ if (brave_chromium_build) {
+ sources -= [ "app/chrome_exe.rc", ]
+ sources += [ "//brave/app/brave_exe.rc", ]
+ }
+ sources -= [ "app/chrome_exe.rc", ] sources += [ "//brave/app/brave_exe.rc", ]

deps += [
":chrome_dll",
@@ -433,11 +437,12 @@ if (is_win) {
@@ -432,11 +433,12 @@ if (is_win) {
args += [ "--keystone=0" ]
}
}
Expand All @@ -27,15 +24,15 @@ index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae422032
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
@@ -455,6 +460,7 @@ if (is_win) {
@@ -454,6 +456,7 @@ if (is_win) {
"//chrome/common:buildflags",
"//chrome/common:version_header",
]
+ deps += [ "//brave:brave_app" ]

if (enable_stripping) {
# At link time, preserve the global symbols specified in the .exports
@@ -521,7 +527,7 @@ if (is_win) {
@@ -520,7 +523,7 @@ if (is_win) {
args =
[
"-b",
Expand All @@ -44,15 +41,15 @@ index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae422032
"-v",
chrome_version_full,
"-g",
@@ -590,6 +596,7 @@ if (is_win) {
@@ -589,6 +592,7 @@ if (is_win) {
# this dependency directly copies the file into the framework's
# resources directory.
public_deps += [ ":chrome_framework_widevine_signature" ]
+ public_deps -= [ ":chrome_framework_widevine_signature" ]
}
}

@@ -622,9 +629,11 @@ if (is_win) {
@@ -621,9 +625,11 @@ if (is_win) {
"--scm=0",
]
}
Expand All @@ -64,7 +61,7 @@ index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae422032
if (is_chrome_branded) {
# These entitlements are bound to the official Google Chrome signing
# certificate and will not necessarily work in any other build.
@@ -645,7 +654,7 @@ if (is_win) {
@@ -644,7 +650,7 @@ if (is_win) {

output_name = chrome_helper_name + invoker.helper_name_suffix

Expand All @@ -73,26 +70,23 @@ index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae422032
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
@@ -1045,6 +1054,10 @@ if (is_win) {
@@ -1044,6 +1050,7 @@ if (is_win) {
if (is_chrome_branded) {
deps += [ ":default_apps" ]
}
+ if (brave_chromium_build) {
+ deps += [ "//brave:framework_bundle_data" ]
+ if (defined(chrome_framework_version)) { framework_contents += [ "Frameworks", ] }
+ }
+ deps += [ "//brave:framework_bundle_data" ] if (defined(chrome_framework_version)) { framework_contents += [ "Frameworks", ] }

ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$chrome_framework_name.framework/Versions/$chrome_version_full/$chrome_framework_name" ]

@@ -1206,6 +1219,7 @@ if (is_win) {
@@ -1205,6 +1212,7 @@ if (is_win) {

group("browser_dependencies") {
public_deps = [
+ "//brave:browser_dependencies",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//chrome/app:shutdown_signal_handlers",
@@ -1307,12 +1321,13 @@ group("child_dependencies") {
@@ -1306,12 +1314,13 @@ group("child_dependencies") {
# this is OK because all of content is linked into one library.
"//content/browser",
]
Expand All @@ -107,7 +101,7 @@ index c28309a07dd643523e4a6d52bf90a9291a521399..d1b1d28c06e095c4c8eeacb9ae422032
output = "$target_gen_dir/chrome_exe_version.rc"
}

@@ -1366,6 +1381,7 @@ group("resources") {
@@ -1365,6 +1374,7 @@ group("resources") {
"//chrome/browser:resources",
"//chrome/common:resources",
"//chrome/renderer:resources",
Expand Down
2 changes: 1 addition & 1 deletion patches/chrome-VERSION.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/chrome/VERSION b/chrome/VERSION
index 2edc65ac36be89e6be4255a76282ffcaecc71130..59b0547a0bc9c1881b5a472a854c498b4511cc5b 100644
index 99cbe4cb779807cc3f34a4bb05475279f10d0f49..a3b2d0cb29647f600db54774f5aded6c924c10c6 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
Expand Down
4 changes: 2 additions & 2 deletions patches/chrome-app-chrome_crash_reporter_client.cc.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc
index b3a7aebffa224c360e3760f816887cb979999c57..cd8cf6856ae1fa1c28f1274ab2db1299d576e9f1 100644
index b3a7aebffa224c360e3760f816887cb979999c57..e56f309c199b87d63b32c33effb5e08017224f7f 100644
--- a/chrome/app/chrome_crash_reporter_client.cc
+++ b/chrome/app/chrome_crash_reporter_client.cc
@@ -154,7 +154,7 @@ bool ChromeCrashReporterClient::IsRunningUnattended() {
}

bool ChromeCrashReporterClient::GetCollectStatsConsent() {
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || (defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD))
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(OFFICIAL_BUILD)
bool is_official_chrome_build = true;
#else
bool is_official_chrome_build = false;
9 changes: 4 additions & 5 deletions patches/chrome-app-chrome_dll.rc.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc
index d299571ac031f4b3ff964fbf2dd865ba31bdd0bf..c63a4397ebdd9fae76ba331be26ed4f9dc14dfac 100644
index d299571ac031f4b3ff964fbf2dd865ba31bdd0bf..06eef7187c1c288d1db668b94ed742d538c6b2bf 100644
--- a/chrome/app/chrome_dll.rc
+++ b/chrome/app/chrome_dll.rc
@@ -164,6 +164,16 @@ END
@@ -164,6 +164,15 @@ END
// the icon from the current module). We can perhaps work around this in the
// future to get the icon from the .exe, which would save a copy.

+#if defined(BRAVE_CHROMIUM_BUILD)
+#if defined(OFFICIAL_BUILD)
+IDR_MAINFRAME ICON "theme\brave\win\brave.ico"
+IDR_SXS ICON "theme\brave\win\brave_canary.ico"
Expand All @@ -15,11 +14,11 @@ index d299571ac031f4b3ff964fbf2dd865ba31bdd0bf..c63a4397ebdd9fae76ba331be26ed4f9
+#else
+IDR_MAINFRAME ICON "theme\brave\win\brave_development.ico"
+#endif
+#else
+#if 0
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
IDR_MAINFRAME ICON "theme\google_chrome\win\chrome.ico"
IDR_SXS ICON "theme\google_chrome\win\chrome_sxs.ico"
@@ -172,6 +182,7 @@ IDR_X005_BETA ICON "theme\google_chrome\win\chrome_
@@ -172,6 +181,7 @@ IDR_X005_BETA ICON "theme\google_chrome\win\chrome_
#else
IDR_MAINFRAME ICON "theme\chromium\win\chromium.ico"
#endif
Expand Down
6 changes: 3 additions & 3 deletions patches/chrome-app-theme-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
diff --git a/chrome/app/theme/BUILD.gn b/chrome/app/theme/BUILD.gn
index 57e8917e359a2fc59f567bd33f9340e400e55b1f..b127c994019d8ba1e5750b33c300c2ec9dcf3463 100644
index 57e8917e359a2fc59f567bd33f9340e400e55b1f..a4489e2c34d1a02138afb05ccfc72d0129572f3e 100644
--- a/chrome/app/theme/BUILD.gn
+++ b/chrome/app/theme/BUILD.gn
@@ -21,6 +21,7 @@ grit("theme_resources") {
":chrome_unscaled_resources",
"//ui/resources",
]
+ if (brave_chromium_build) { deps += ["//brave/app/theme:brave_theme_resources"]}
+ deps += ["//brave/app/theme:brave_theme_resources"]

output_dir = "$root_gen_dir/chrome"
}
@@ -32,6 +33,7 @@ grit("chrome_unscaled_resources") {
"grit/chrome_unscaled_resources.h",
"chrome_unscaled_resources.pak",
]
+ if (brave_chromium_build) { deps = ["//brave/app/theme:brave_unscaled_resources"]}
+ deps = ["//brave/app/theme:brave_unscaled_resources"]

output_dir = "$root_gen_dir/chrome"
}
6 changes: 3 additions & 3 deletions patches/chrome-browser-first_run-upgrade_util_win.cc.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index 97cd4d1365eda7480c07c3b52c339515ca3acb40..a39aadfa07a3f1063c1fa3fd9a14ad8d159e2260 100644
index 97cd4d1365eda7480c07c3b52c339515ca3acb40..3394103ade301445a5996f7cde7d97801a0258dd 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -41,7 +41,7 @@
#include "components/prefs/pref_service.h"
#include "ui/base/ui_base_switches.h"

-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || (defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD))
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(OFFICIAL_BUILD)
#include "google_update/google_update_idl.h"
#endif

Expand All @@ -16,7 +16,7 @@ index 97cd4d1365eda7480c07c3b52c339515ca3acb40..a39aadfa07a3f1063c1fa3fd9a14ad8d

bool InvokeGoogleUpdateForRename() {
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || (defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD))
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(OFFICIAL_BUILD)
Microsoft::WRL::ComPtr<IProcessLauncher> ipl;
HRESULT hr = ::CoCreateInstance(__uuidof(ProcessLauncherClass), nullptr,
CLSCTX_ALL, IID_PPV_ARGS(&ipl));
6 changes: 2 additions & 4 deletions patches/chrome-browser-net-net_error_tab_helper.cc.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
diff --git a/chrome/browser/net/net_error_tab_helper.cc b/chrome/browser/net/net_error_tab_helper.cc
index 313758372e0fcb842ee6a5b5cd69a64b8a95b2ac..cc920fb9459462075a1a9c123ae7af34ea5c8ac8 100644
index 313758372e0fcb842ee6a5b5cd69a64b8a95b2ac..bc8c3c243dd2f05b5fa9708d1d72bfa9f6dffcc0 100644
--- a/chrome/browser/net/net_error_tab_helper.cc
+++ b/chrome/browser/net/net_error_tab_helper.cc
@@ -200,6 +200,9 @@ void NetErrorTabHelper::InitializePref(WebContents* contents) {
@@ -200,6 +200,7 @@ void NetErrorTabHelper::InitializePref(WebContents* contents) {
}

bool NetErrorTabHelper::ProbesAllowed() const {
+#if defined(BRAVE_CHROMIUM_BUILD)
+ return false;
+#endif
if (testing_state_ != TESTING_DEFAULT)
return testing_state_ == TESTING_FORCE_ENABLED;

6 changes: 2 additions & 4 deletions patches/chrome-browser-profiles-profile_io_data.cc.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 2f5ed4b15589ffa5bae18d7f06e6776f705f5229..62b9d86de52131eac490aeb41b55a057f4d9373e 100644
index 2f5ed4b15589ffa5bae18d7f06e6776f705f5229..a4bd6ab7ef01d4740211eff1de086fe1493f2129 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -248,6 +248,9 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
@@ -248,6 +248,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
#endif
content::kChromeUIScheme,
content::kChromeUIUntrustedScheme,
+#if defined(BRAVE_CHROMIUM_BUILD)
+ kBraveUIScheme,
+#endif
url::kDataScheme,
#if BUILDFLAG(IS_CHROMEOS_ASH)
content::kExternalFileScheme,
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
diff --git a/chrome/browser/ui/startup/startup_tab_provider.cc b/chrome/browser/ui/startup/startup_tab_provider.cc
index b16e6b9deb6c951007ab6932f028982ca7c74671..b453e5b069bd4721e1ee857e71843b0a5494b2db 100644
index b16e6b9deb6c951007ab6932f028982ca7c74671..833666f7469189cb319ea7f1a5fb00ce182972d0 100644
--- a/chrome/browser/ui/startup/startup_tab_provider.cc
+++ b/chrome/browser/ui/startup/startup_tab_provider.cc
@@ -144,7 +144,11 @@ StartupTabs StartupTabProviderImpl::GetExtensionCheckupTabs(
@@ -144,6 +144,7 @@ StartupTabs StartupTabProviderImpl::GetExtensionCheckupTabs(
bool StartupTabProviderImpl::CanShowWelcome(bool is_signin_allowed,
bool is_supervised_user,
bool is_force_signin_enabled) {
+#if defined(BRAVE_CHROMIUM_BUILD)
+ return true;
+#else
return is_signin_allowed && !is_supervised_user && !is_force_signin_enabled;
+#endif
}

// static
Loading

0 comments on commit fc13ad8

Please sign in to comment.