0

Use BUILDFLAG(GOOGLE_CHROME_BRANDING) more.

No behavior change.

TBR=tedchoc

Bug: 961769
Change-Id: Ic8d0cdfdaf5afb65b1ede5c83d15dddbbda8d144
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1724663
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681941}
This commit is contained in:
Nico Weber
2019-07-29 20:05:22 +00:00
committed by Commit Bot
parent 13a2718adb
commit cda4ff54c1
23 changed files with 58 additions and 24 deletions

@ -11,6 +11,7 @@
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_timeouts.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/apps/platform_apps/app_browsertest_util.h"
#include "chrome/browser/extensions/extension_browsertest.h"
@ -190,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(LoadAndLaunchExtensionBrowserTest,
const std::vector<base::string16>* errors =
extensions::LoadErrorReporter::GetInstance()->GetErrors();
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// The error is skipped on official builds.
EXPECT_TRUE(errors->empty());
#else

@ -11,7 +11,7 @@ license.
Therefore, if you want to add a trademarked resource, check it into the
internal repository, and pick a resource based on the branding
(`is_chrome_branded` in GN, `#if defined(GOOGLE_CHROME_BUILD)` in cpp). If
(`is_chrome_branded` in GN, `#if BUILDFLAG(GOOGLE_CHROME_BRANDING)` in cpp). If
possible, check an open source version into Chromium, so the feature
continues to work as expected in the open source build.

@ -135,6 +135,7 @@ template("google_apis_tmpl") {
deps = [
"//base",
"//base/third_party/dynamic_annotations",
"//build:branding_buildflags",
"//crypto",
"//mojo/public/cpp/bindings:struct_traits",
"//services/network/public/cpp",
@ -231,6 +232,7 @@ test("google_apis_unittests") {
":test_support",
"//base",
"//base/test:test_support",
"//build:branding_buildflags",
"//testing/gmock",
"//testing/gtest",
]

@ -16,13 +16,14 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/strings/stringize_macros.h"
#include "build/branding_buildflags.h"
#include "google_apis/gaia/gaia_switches.h"
#if defined(OS_MACOSX)
#include "google_apis/google_api_keys_mac.h"
#endif
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#include "google_apis/internal/google_chrome_api_keys.h"
#include "google_apis/internal/metrics_signing_key.h"
#endif
@ -252,7 +253,7 @@ class APIKeyCache {
}
#endif
#if !defined(GOOGLE_CHROME_BUILD)
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Don't allow using the environment to override API keys for official
// Google Chrome builds. There have been reports of mangled environments
// affecting users (crbug.com/710575).
@ -270,7 +271,7 @@ class APIKeyCache {
}
if (key_value == DUMMY_API_TOKEN) {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
// No key should be unset in an official build except the
// GOOGLE_DEFAULT_* keys. The default keys don't trigger this
// check as their "unset" value is not DUMMY_API_TOKEN.
@ -362,7 +363,7 @@ std::string GetSpdyProxyAuthValue() {
}
bool IsGoogleChromeAPIKeyUsed() {
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
return true;
#else
return false;

@ -14,6 +14,7 @@
#include "base/mac/bundle_locations.h"
#include "base/macros.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "google_apis/gaia/gaia_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -37,7 +38,10 @@
// After this test, for the remainder of this compilation unit, we
// need official keys to not be used.
#undef GOOGLE_CHROME_BUILD
#undef BUILDFLAG_INTERNAL_CHROMIUM_BRANDING
#undef BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING
#define BUILDFLAG_INTERNAL_CHROMIUM_BRANDING() (1)
#define BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING() (0)
#undef USE_OFFICIAL_GOOGLE_API_KEYS
// Override some keys using both preprocessor defines and Info.plist entries.

@ -13,6 +13,7 @@
#include "google_apis/google_api_keys_unittest.h"
#include "base/stl_util.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "google_apis/gaia/gaia_switches.h"
@ -88,7 +89,7 @@ void GoogleAPIKeysTest::TearDown() {
// This is the default baked-in value for OAuth IDs and secrets.
static const char kDummyToken[] = "dummytoken";
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
// Test official build behavior, since we are in a checkout where this
// is possible.
namespace official_build {
@ -186,11 +187,15 @@ TEST_F(GoogleAPIKeysTest, OfficialKeys) {
EXPECT_NE(DUMMY_API_TOKEN, secret_remoting_host);
EXPECT_NE(kDummyToken, secret_remoting_host);
}
#endif // defined(GOOGLE_CHROME_BUILD) || defined(USE_OFFICIAL_GOOGLE_API_KEYS)
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) ||
// defined(USE_OFFICIAL_GOOGLE_API_KEYS)
// After this test, for the remainder of this compilation unit, we
// need official keys to not be used.
#undef GOOGLE_CHROME_BUILD
#undef BUILDFLAG_INTERNAL_CHROMIUM_BRANDING
#undef BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING
#define BUILDFLAG_INTERNAL_CHROMIUM_BRANDING() (1)
#define BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING() (0)
#undef USE_OFFICIAL_GOOGLE_API_KEYS
// Test the set of keys temporarily baked into Chromium by default.
@ -398,7 +403,7 @@ TEST_F(GoogleAPIKeysTest, OverrideAllKeys) {
EXPECT_EQ("SECRET_REMOTING_HOST", secret_remoting_host);
}
#if !defined(GOOGLE_CHROME_BUILD)
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Override all keys using both preprocessor defines and environment
// variables. The environment variables should win.
@ -488,7 +493,7 @@ TEST_F(GoogleAPIKeysTest, OverrideAllKeysUsingEnvironment) {
EXPECT_EQ("env-SECRET_REMOTING_HOST", secret_remoting_host);
}
#endif // !defined(GOOGLE_CHROME_BUILD)
#endif // !BUILDFLAG(GOOGLE_CHROME_BRANDING)
#if defined(OS_IOS)
// Override all keys using both preprocessor defines and setters.

@ -155,6 +155,7 @@ jumbo_source_set("config_sources") {
deps = [
":process_json",
"//base",
"//build:branding_buildflags",
"//gpu/ipc/common:gpu_preferences_interface",
"//media:media_buildflags",
"//third_party/re2",

@ -41,6 +41,7 @@
#include "base/threading/thread.h"
#include "base/trace_event/trace_event.h"
#include "base/win/scoped_com_initializer.h"
#include "build/branding_buildflags.h"
#include "gpu/config/nvml_info.h"
#include "third_party/vulkan/include/vulkan/vulkan.h"
@ -158,7 +159,7 @@ std::string GetDeviceFileTimeProperty(DEVINST dev_inst,
} // namespace
#if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OFFICIAL_BUILD)
// This function has a real implementation for official builds that can
// be found in src/third_party/amd.
bool GetAMDSwitchableInfo(bool* is_switchable,

@ -813,6 +813,7 @@ if (is_win) {
]
deps = [
":headless_non_renderer",
"//build:branding_buildflags",
"//components/services/pdf_compositor/public/cpp:manifest",
"//components/services/pdf_compositor/public/mojom",
"//content:sandbox_helper_win",
@ -849,6 +850,7 @@ if (is_win) {
]
deps = [
":headless_renderer",
"//build:branding_buildflags",
"//content/public/child:child",
"//net",
"//ui/base",
@ -895,6 +897,7 @@ jumbo_static_library("headless_shell_lib") {
deps = [
":headless_renderer",
"//build:branding_buildflags",
"//components/os_crypt",
"//components/security_state/content",
"//components/services/pdf_compositor/public/cpp:manifest",

@ -23,6 +23,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "components/os_crypt/os_crypt_switches.h"
@ -672,7 +673,7 @@ int HeadlessShellMain(int argc, const char** argv) {
return EXIT_FAILURE;
// Crash reporting in headless mode is enabled by default in official builds.
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
builder.SetCrashReporterEnabled(true);
base::FilePath dumps_path;
base::PathService::Get(base::DIR_TEMP, &dumps_path);

@ -279,6 +279,8 @@ source_set("audio") {
"pulse/pulse_util.h",
]
deps += [ "//build:branding_buildflags" ]
if (link_pulseaudio) {
configs += [ ":libpulse" ]
} else {

@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "build/branding_buildflags.h"
#include "media/audio/audio_device_description.h"
#include "media/base/audio_timestamp_helper.h"
@ -30,7 +31,7 @@ namespace pulse {
namespace {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
static const char kBrowserDisplayName[] = "google-chrome";
#else
static const char kBrowserDisplayName[] = "chromium-browser";

@ -73,6 +73,7 @@ source_set("transport_security_state_generated_files") {
]
deps = [
"//build:branding_buildflags",
"//net:net_deps",
"//net:net_public_deps",
"//net/dns",

@ -25,6 +25,7 @@
#include "base/time/time.h"
#include "base/time/time_to_iso8601.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "crypto/sha2.h"
#include "net/base/hash_value.h"
@ -411,7 +412,7 @@ TransportSecurityState::TransportSecurityState()
sent_expect_ct_reports_cache_(kMaxReportCacheEntries) {
// Static pinning is only enabled for official builds to make sure that
// others don't end up with pins that cannot be easily updated.
#if !defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID) || defined(OS_IOS)
#if !BUILDFLAG(GOOGLE_CHROME_BRANDING) || defined(OS_ANDROID) || defined(OS_IOS)
enable_static_pins_ = false;
enable_static_expect_ct_ = false;
#endif

@ -527,6 +527,7 @@ source_set("unit_tests") {
deps = [
":common",
":test_support",
"//build:branding_buildflags",
"//remoting/host/file_transfer:unit_tests",
"//remoting/host/it2me:common",
"//remoting/host/native_messaging",

@ -44,7 +44,7 @@ inline constexpr bool IsDebug() {
}
inline constexpr bool IsChromeBranded() {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return true;
#elif BUILDFLAG(CHROMIUM_BRANDING)
return false;

@ -4,6 +4,7 @@
#include "remoting/host/resources.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "remoting/base/string_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -25,11 +26,11 @@ class ResourcesTest : public testing::Test {
// TODO(alexeypa): Reenable the test once http://crbug.com/269143 (ChromeOS) and
// http://crbug.com/268043 (MacOS) are fixed.
TEST_F(ResourcesTest, DISABLED_ProductName) {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
std::string expected_product_name = "Chrome Remote Desktop";
#else // defined(GOOGLE_CHROME_BUILD)
#else // BUILDFLAG(GOOGLE_CHROME_BRANDING)
std::string expected_product_name = "Chromoting";
#endif // !defined(GOOGLE_CHROME_BUILD)
#endif // BUILDFLAGdefined(GOOGLE_CRANDING)
// Chrome-style i18n is not used on Windows or Android.
#if defined(OS_WIN) || defined(OS_ANDROID)

@ -19,6 +19,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringize_macros.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "crypto/random.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/escape.h"
@ -91,7 +92,7 @@ void TokenValidatorImpl::StartValidateRequest(const std::string& token) {
third_party_auth_config_.token_validation_url, net::DEFAULT_PRIORITY,
this, MISSING_TRAFFIC_ANNOTATION);
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
std::string app_name = "Chrome Remote Desktop";
#else
std::string app_name = "Chromoting";

@ -15,6 +15,7 @@ component("mpris") {
deps = [
"//base",
"//build:branding_buildflags",
"//components/dbus/thread_linux",
"//dbus",
]

@ -4,11 +4,12 @@
#include "ui/base/mpris/mpris_service.h"
#include "build/branding_buildflags.h"
#include "ui/base/mpris/mpris_service_impl.h"
namespace mpris {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
const char kMprisAPIServiceNamePrefix[] =
"org.mpris.MediaPlayer2.chrome.instance";
#else

@ -12,6 +12,7 @@
#include "base/process/process.h"
#include "base/unguessable_token.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
#include "components/dbus/thread_linux/dbus_thread_linux.h"
#include "dbus/bus.h"
#include "dbus/exported_object.h"
@ -123,7 +124,7 @@ void MprisServiceImpl::InitializeProperties() {
media_player2_properties_["CanRaise"] = base::Value(false);
media_player2_properties_["HasTrackList"] = base::Value(false);
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
media_player2_properties_["Identity"] = base::Value("Chrome");
#else
media_player2_properties_["Identity"] = base::Value("Chromium");

@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
assert(is_mac, "This code is macOS-only.")
config("media_player_weak_link") {
ldflags = [
"-weak_framework",
@ -33,6 +35,7 @@ component("now_playing") {
deps = [
"//base",
"//build:branding_buildflags",
]
libs = [ "Foundation.framework" ]

@ -7,6 +7,7 @@
#import <MediaPlayer/MediaPlayer.h>
#include "base/mac/scoped_nsobject.h"
#include "build/branding_buildflags.h"
@interface NowPlayingInfoCenterDelegateCocoa ()
@ -49,7 +50,7 @@
forKey:MPNowPlayingInfoPropertyPlaybackRate];
[nowPlayingInfo_ setObject:[NSNumber numberWithDouble:0]
forKey:MPMediaItemPropertyPlaybackDuration];
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
[nowPlayingInfo_ setObject:@"Chrome" forKey:MPMediaItemPropertyTitle];
#else
[nowPlayingInfo_ setObject:@"Chromium" forKey:MPMediaItemPropertyTitle];