diff --git a/common/brave_channel_info_linux.cc b/common/brave_channel_info_linux.cc new file mode 100644 index 000000000000..d8b95a8ad9b2 --- /dev/null +++ b/common/brave_channel_info_linux.cc @@ -0,0 +1,26 @@ +/* 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/brave_channel_info_linux.h" + +namespace brave { + +std::string GetChannelSuffixForDataDir() { + std::string modifier; + std::string data_dir_suffix; + + char* env = getenv("CHROME_VERSION_EXTRA"); + if (env) + modifier = env; + + // Chrome doesn't support canary channel on linux. + if (modifier == "unstable") // linux version of "dev" + data_dir_suffix = "-Dev"; + else if (modifier == "beta") + data_dir_suffix = "-Beta"; + + return data_dir_suffix; +} + +} // namespace brave diff --git a/common/brave_channel_info_linux.h b/common/brave_channel_info_linux.h new file mode 100644 index 000000000000..0775e3bede61 --- /dev/null +++ b/common/brave_channel_info_linux.h @@ -0,0 +1,16 @@ +/* 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_COMMON_BRAVE_CHANNEL_INFO_LINUX_H_ +#define BRAVE_COMMON_BRAVE_CHANNEL_INFO_LINUX_H_ + +#include + +namespace brave { + +std::string GetChannelSuffixForDataDir(); + +} // namespace brave + +#endif // BRAVE_COMMON_BRAVE_CHANNEL_INFO_LINUX_H_ diff --git a/patches/chrome-common-BUILD.gn.patch b/patches/chrome-common-BUILD.gn.patch index 56d7059a664f..6e9d879f408c 100644 --- a/patches/chrome-common-BUILD.gn.patch +++ b/patches/chrome-common-BUILD.gn.patch @@ -1,5 +1,5 @@ diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn -index d08a945c6b11a918fa5faedcb1c87c269772e877..946a111464968bf780a4cf9ffad851c435b4e228 100644 +index d08a945c6b11a918fa5faedcb1c87c269772e877..7c1daac9f4ff71120ba2eab713e5aec1e24c4bf1 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -528,6 +528,13 @@ static_library("non_code_constants") { @@ -20,13 +20,13 @@ index d08a945c6b11a918fa5faedcb1c87c269772e877..946a111464968bf780a4cf9ffad851c4 "pref_names.h", ] -+ if (brave_chromium_build) { -+ if (is_mac) { -+ sources += [ -+ "//brave/common/brave_paths_mac.mm", -+ "//brave/common/brave_paths_mac.h", -+ ] -+ } ++ if (brave_chromium_build && is_official_build) { ++ sources += [ ++ "//brave/common/brave_paths_mac.mm", ++ "//brave/common/brave_paths_mac.h", ++ "//brave/common/brave_channel_info_linux.cc", ++ "//brave/common/brave_channel_info_linux.h", ++ ] + } + public_deps = [ diff --git a/patches/chrome-common-chrome_paths_linux.cc.patch b/patches/chrome-common-chrome_paths_linux.cc.patch index 8e5d7e11eff9..81dc2b71cfcb 100644 --- a/patches/chrome-common-chrome_paths_linux.cc.patch +++ b/patches/chrome-common-chrome_paths_linux.cc.patch @@ -1,16 +1,34 @@ diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc -index fc47bd3f12418fdaed879e0b485bfc7cb572a6e8..b646812c6abafc22ffe62e06e46d818e15c80984 100644 +index fc47bd3f12418fdaed879e0b485bfc7cb572a6e8..9d7f74be49456b05c593ae2df4831c754d931a73 100644 --- a/chrome/common/chrome_paths_linux.cc +++ b/chrome/common/chrome_paths_linux.cc -@@ -89,8 +89,10 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) { +@@ -16,6 +16,10 @@ + #include "chrome/common/channel_info.h" + #include "chrome/common/chrome_paths_internal.h" ++#if defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD) ++#include "brave/common/brave_channel_info_linux.h" ++#endif ++ + namespace chrome { + + using base::nix::GetXDGDirectory; +@@ -87,10 +91,18 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) { + GetXDGDirectory(env.get(), kXdgConfigHomeEnvVar, kDotConfigDir); + } + ++#if defined(BRAVE_CHROMIUM_BUILD) ++#if defined(OFFICIAL_BUILD) ++ *result = config_dir.Append("Brave-Browser" + brave::GetChannelSuffixForDataDir()); ++#else ++ *result = config_dir.Append("Brave-Browser-Development"); ++#endif ++#else #if defined(GOOGLE_CHROME_BUILD) *result = config_dir.Append("google-chrome" + GetChannelSuffixForDataDir()); -+#elif defined(OFFICIAL_BUILD) -+ *result = config_dir.Append("brave-browser"); #else -- *result = config_dir.Append("chromium"); -+ *result = config_dir.Append("brave-browser-development"); + *result = config_dir.Append("chromium"); ++#endif #endif return true; }