Remove all references to GOOGLE_CHROME_BUILD in components/

Bug: 961769
Change-Id: I5190c5a6b5eae4a1a7ffb9ee0fc0f52ed29186d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762762
Commit-Queue: Nico Weber <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Auto-Submit: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#689933}
diff --git a/components/update_client/BUILD.gn b/components/update_client/BUILD.gn
index 8ec4b59..de3d06b 100644
--- a/components/update_client/BUILD.gn
+++ b/components/update_client/BUILD.gn
@@ -126,6 +126,7 @@
 
   deps = [
     "//base",
+    "//build:branding_buildflags",
     "//components/client_update_protocol",
     "//components/crx_file",
     "//components/prefs",
@@ -224,6 +225,7 @@
     ":unzip_impl",
     ":update_client",
     "//base",
+    "//build:branding_buildflags",
     "//components/crx_file",
     "//components/prefs",
     "//components/prefs:test_support",
diff --git a/components/update_client/protocol_serializer_json.cc b/components/update_client/protocol_serializer_json.cc
index b94d2c05..8e7aee8 100644
--- a/components/update_client/protocol_serializer_json.cc
+++ b/components/update_client/protocol_serializer_json.cc
@@ -10,8 +10,8 @@
 
 #include "base/json/json_writer.h"
 #include "base/values.h"
+#include "build/branding_buildflags.h"
 #include "build/build_config.h"
-
 #include "components/update_client/updater_state.h"
 
 namespace update_client {
@@ -67,7 +67,7 @@
   if (!request.os.service_pack.empty())
     os_node->SetKey("sp", Value(request.os.service_pack));
 
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
   if (request.updater) {
     const auto& updater = *request.updater;
     auto* updater_node =
diff --git a/components/update_client/protocol_serializer_json_unittest.cc b/components/update_client/protocol_serializer_json_unittest.cc
index 1f4ce4a..4cf2666f 100644
--- a/components/update_client/protocol_serializer_json_unittest.cc
+++ b/components/update_client/protocol_serializer_json_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "components/update_client/protocol_serializer_json.h"
+
 #include <memory>
 #include <string>
 #include <utility>
@@ -10,12 +12,12 @@
 #include "base/optional.h"
 #include "base/values.h"
 #include "base/version.h"
+#include "build/branding_buildflags.h"
 #include "components/prefs/testing_pref_service.h"
 #include "components/update_client/activity_data_service.h"
 #include "components/update_client/persisted_data.h"
 #include "components/update_client/protocol_definition.h"
 #include "components/update_client/protocol_serializer.h"
-#include "components/update_client/protocol_serializer_json.h"
 #include "components/update_client/updater_state.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/re2/src/re2/re2.h"
@@ -114,11 +116,11 @@
       R"("os":{"arch":"[,-.\w]+","platform":"OS",("sp":"[\s\w]+",)?)"
       R"("version":"[-.\w]+"},"prodchannel":"channel","prodversion":"1.0",)"
       R"("protocol":"3.1","requestid":"{[-\w]{36}}","sessionid":"{[-\w]{36}}",)"
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
       R"("updater":{"autoupdatecheckenabled":false,"ismachine":true,)"
       R"("lastchecked":2,"laststarted":1,"name":"Omaha","updatepolicy":-1,)"
       R"("version":"1\.2\.3\.4"},)"
-#endif  // GOOGLE_CHROME_BUILD
+#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)
       R"("updaterchannel":"channel","updaterversion":"1.0"(,"wow64":true)?}})";
   EXPECT_TRUE(RE2::FullMatch(request, regex)) << request;
 }
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc
index c4c0dac..24fc086fa 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -25,6 +25,7 @@
 #include "base/test/task_environment.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/version.h"
+#include "build/branding_buildflags.h"
 #include "build/build_config.h"
 #include "components/prefs/testing_pref_service.h"
 #include "components/update_client/activity_data_service.h"
@@ -324,14 +325,14 @@
 
 #if defined(OS_WIN)
   EXPECT_TRUE(request->FindKey("domainjoined"));
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
   const auto* updater = request->FindKey("updater");
   EXPECT_TRUE(updater);
   EXPECT_EQ("Omaha", updater->FindKey("name")->GetString());
   EXPECT_TRUE(updater->FindKey("autoupdatecheckenabled")->is_bool());
   EXPECT_TRUE(updater->FindKey("ismachine")->is_bool());
   EXPECT_TRUE(updater->FindKey("updatepolicy")->is_int());
-#endif  // GOOGLE_CHROME_BUILD
+#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)
 #endif  // OS_WIN
 
   // Sanity check the arguments of the callback after parsing.
diff --git a/components/update_client/update_query_params.cc b/components/update_client/update_query_params.cc
index 119e71a..d9e1612 100644
--- a/components/update_client/update_query_params.cc
+++ b/components/update_client/update_query_params.cc
@@ -7,6 +7,7 @@
 #include "base/logging.h"
 #include "base/strings/stringprintf.h"
 #include "base/system/sys_info.h"
+#include "build/branding_buildflags.h"
 #include "build/build_config.h"
 #include "components/update_client/update_query_params_delegate.h"
 #include "components/version_info/version_info.h"
@@ -63,11 +64,11 @@
 
 const char kChrome[] = "chrome";
 
-#if defined(GOOGLE_CHROME_BUILD)
-const char kChromeCrx[] = "chromecrx";
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+const char kCrx[] = "chromecrx";
 #else
-const char kChromiumCrx[] = "chromiumcrx";
-#endif  // defined(GOOGLE_CHROME_BUILD)
+const char kCrx[] = "chromiumcrx";
+#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)
 
 UpdateQueryParamsDelegate* g_delegate = nullptr;
 
@@ -89,11 +90,7 @@
       return kChrome;
       break;
     case UpdateQueryParams::CRX:
-#if defined(GOOGLE_CHROME_BUILD)
-      return kChromeCrx;
-#else
-      return kChromiumCrx;
-#endif
+      return kCrx;
       break;
   }
   return kUnknown;
diff --git a/components/update_client/updater_state.cc b/components/update_client/updater_state.cc
index 7178b54..5d05c86 100644
--- a/components/update_client/updater_state.cc
+++ b/components/update_client/updater_state.cc
@@ -11,6 +11,7 @@
 #include "base/strings/string16.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/branding_buildflags.h"
 #include "build/build_config.h"
 
 namespace update_client {
@@ -40,14 +41,14 @@
 void UpdaterState::ReadState() {
   is_enterprise_managed_ = base::IsMachineExternallyManaged();
 
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
   updater_name_ = GetUpdaterName();
   updater_version_ = GetUpdaterVersion(is_machine_);
   last_autoupdate_started_ = GetUpdaterLastStartedAU(is_machine_);
   last_checked_ = GetUpdaterLastChecked(is_machine_);
   is_autoupdate_check_enabled_ = IsAutoupdateCheckEnabled();
   update_policy_ = GetUpdatePolicy();
-#endif  // GOOGLE_CHROME_BUILD
+#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)
 }
 #endif  // OS_WIN or Mac
 
diff --git a/components/update_client/updater_state_unittest.cc b/components/update_client/updater_state_unittest.cc
index 20fa0f7..e916adf 100644
--- a/components/update_client/updater_state_unittest.cc
+++ b/components/update_client/updater_state_unittest.cc
@@ -2,11 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "components/update_client/updater_state.h"
+
 #include "base/macros.h"
 #include "base/time/time.h"
 #include "base/version.h"
+#include "build/branding_buildflags.h"
 #include "build/build_config.h"
-#include "components/update_client/updater_state.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace update_client {
@@ -42,7 +44,7 @@
   EXPECT_STREQ("1", attributes.at("autoupdatecheckenabled").c_str());
   EXPECT_STREQ("1", attributes.at("updatepolicy").c_str());
 
-#if defined(GOOGLE_CHROME_BUILD)
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
 #if defined(OS_WIN)
   // The value of "ismachine".
   EXPECT_STREQ("0", UpdaterState::GetState(false)->at("ismachine").c_str());
@@ -56,7 +58,7 @@
   EXPECT_EQ(0UL, UpdaterState::GetState(true)->count("ismachine"));
   EXPECT_STREQ("Keystone", UpdaterState::GetState(false)->at("name").c_str());
 #endif  // OS_WIN
-#endif  // GOOGLE_CHROME_BUILD
+#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)
 
   // Tests some of the remaining values.
   updater_state = UpdaterState(false);