0

google_apis: Remove Lacros leftovers

Lacros is gone.

- Replace IS_CHROMEOS_ASH uses with IS_CHROMEOS.
- Remove IS_CHROMEOS_LACROS uses.
- Remove includes of build/chromeos_buildflags.h or replace the with
  build/build_config.h.
- Remove imports of chromeos/ui_mode.gni.

Bug: b:354842935
Change-Id: I1c49e9eef253057fc68286fdd1d55d1cf116a486
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6228659
Reviewed-by: Monica Basta <msalama@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1415926}
This commit is contained in:
Georg Neis
2025-02-04 17:01:08 -08:00
committed by Chromium LUCI CQ
parent d4cb8f07c9
commit 0c0448b8fe
19 changed files with 34 additions and 52 deletions

@ -4,7 +4,6 @@
import("//build/buildflag_header.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//testing/test.gni")
@ -178,7 +177,6 @@ component("google_apis") {
public_deps = [
":buildflags",
"//base",
"//build:chromeos_buildflags",
"//services/network/public/cpp",
]
@ -186,7 +184,6 @@ component("google_apis") {
":proto",
"//base/version_info:channel",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//crypto",
"//mojo/public/cpp/bindings:struct_traits",
"//net",
@ -288,7 +285,6 @@ test("google_apis_unittests") {
"//base/test:test_support",
"//base/version_info:channel",
"//build:branding_buildflags",
"//build:chromeos_buildflags",
"//google_apis/calendar:calendar_unittests",
"//google_apis/common:common_unittests",
"//testing/gmock",

@ -20,7 +20,6 @@
#include "base/strings/stringize_macros.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/buildflags.h"
#include "google_apis/default_api_keys.h"
#include "google_apis/gaia/gaia_config.h"
@ -153,7 +152,7 @@ ApiKeyCache::ApiKeyCache(const DefaultApiKeys& default_api_keys) {
default_api_keys.allow_unset_values);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
api_key_sharing_ = CalculateKeyValue(
default_api_keys.google_api_key_sharing,
STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_SHARING), nullptr, std::string(),

@ -9,7 +9,6 @@
#include "base/feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/buildflags.h"
#include "google_apis/google_api_keys.h"
@ -34,7 +33,7 @@ class COMPONENT_EXPORT(GOOGLE_APIS) ApiKeyCache {
#if !BUILDFLAG(IS_ANDROID)
const std::string& api_key_hats() const { return api_key_hats_; }
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const std::string& api_key_sharing() const { return api_key_sharing_; }
const std::string& api_key_read_aloud() const { return api_key_read_aloud_; }
const std::string& api_key_fresnel() const { return api_key_fresnel_; }
@ -63,7 +62,7 @@ class COMPONENT_EXPORT(GOOGLE_APIS) ApiKeyCache {
#if !BUILDFLAG(IS_ANDROID)
std::string api_key_hats_;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::string api_key_sharing_;
std::string api_key_read_aloud_;
std::string api_key_fresnel_;

@ -2,9 +2,7 @@
# Use of this source code is governed by a BSD - style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//testing/test.gni")
assert(is_chromeos)

@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "build/branding_buildflags.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "google_apis/default_api_keys.h"
// This file contains a definition of `GetDefaultApiKeysFromDefinedValues()`
@ -73,7 +73,7 @@
#endif
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// API key for the Nearby Sharing Service.
#if !defined(GOOGLE_API_KEY_SHARING)
#define GOOGLE_API_KEY_SHARING google_apis::DefaultApiKeys::kUnsetApiToken
@ -92,7 +92,7 @@
#if !defined(GOOGLE_API_KEY_BOCA)
#define GOOGLE_API_KEY_BOCA google_apis::DefaultApiKeys::kUnsetApiToken
#endif
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// These are used as shortcuts for developers and users providing
// OAuth credentials via preprocessor defines or environment
@ -122,7 +122,7 @@ constexpr ::google_apis::DefaultApiKeys GetDefaultApiKeysFromDefinedValues() {
#endif // BUILDFLAG(IS_ANDROID)
.google_api_key_remoting = GOOGLE_API_KEY_REMOTING,
.google_api_key_soda = GOOGLE_API_KEY_SODA,
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
.google_api_key_sharing = GOOGLE_API_KEY_SHARING,
.google_api_key_read_aloud = GOOGLE_API_KEY_READ_ALOUD,
.google_api_key_fresnel = GOOGLE_API_KEY_FRESNEL,

@ -5,9 +5,7 @@
#ifndef GOOGLE_APIS_DEFAULT_API_KEYS_H_
#define GOOGLE_APIS_DEFAULT_API_KEYS_H_
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
namespace google_apis {
@ -31,7 +29,7 @@ struct DefaultApiKeys {
#endif // BUILDFLAG(IS_ANDROID)
const char* google_api_key_remoting;
const char* google_api_key_soda;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const char* google_api_key_sharing;
const char* google_api_key_read_aloud;
const char* google_api_key_fresnel;

@ -7,6 +7,7 @@
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/containers/to_vector.h"
#include "build/build_config.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_id.h"
@ -49,7 +50,7 @@ CoreAccountId CoreAccountId::FromRobotEmail(const std::string& robot_email) {
return CoreAccountId::FromString(robot_email);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// static
CoreAccountId CoreAccountId::FromEmail(const std::string& email) {
if (email.empty())

@ -11,7 +11,6 @@
#include "base/component_export.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/gaia/gaia_id.h"
// Represent the id of an account for interaction with GAIA.
@ -80,13 +79,13 @@ struct COMPONENT_EXPORT(GOOGLE_APIS) CoreAccountId {
// |CoreAccountId::ToString()|.
static CoreAccountId FromString(const std::string& value);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Only on ChromeOS, CoreAccountId objects may be created from Gaia emails.
//
// Create a CoreAccountId object from an email.
// Returns an empty CoreAccountId if |email| is empty.
static CoreAccountId FromEmail(const std::string& email);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// ---------------------------------------- ---------------------------------
private:

@ -12,7 +12,6 @@
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/gaia/gaia_config.h"
#include "google_apis/gaia/gaia_features.h"
#include "google_apis/gaia/gaia_switches.h"

@ -15,7 +15,6 @@
#include "base/test/scoped_command_line.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/gaia/gaia_config.h"
#include "google_apis/gaia/gaia_features.h"
#include "testing/gmock/include/gmock/gmock.h"

@ -15,7 +15,7 @@
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/google_service_auth_error.h"
@ -54,10 +54,10 @@ constexpr char kErrorKey[] = "error";
constexpr char kErrorSubTypeKey[] = "error_subtype";
constexpr char kErrorDescriptionKey[] = "error_description";
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
constexpr char kRaptRequiredError[] = "rapt_required";
constexpr char kInvalidRaptError[] = "invalid_rapt";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
OAuth2AccessTokenFetcherImpl::OAuth2Response
OAuth2ResponseErrorToOAuth2Response(const std::string& error) {
@ -129,7 +129,7 @@ static std::unique_ptr<network::SimpleURLLoader> CreateURLLoader(
GoogleServiceAuthError CreateErrorForInvalidGrant(
const std::string& error_subtype,
const std::string& error_description) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// ChromeOS cannot handle RAPT-type re-authentication requests and is
// supposed to be excluded from RAPT re-authentication on the server side.
// Just to be safe we need to handle this anyways. If we do not handle this,
@ -142,7 +142,7 @@ GoogleServiceAuthError CreateErrorForInvalidGrant(
return GoogleServiceAuthError::FromScopeLimitedUnrecoverableError(
error_description);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Persistent error requiring the user to sign in again.
return GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(

@ -15,7 +15,7 @@
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "google_apis/gaia/gaia_access_token_fetcher.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
@ -223,7 +223,7 @@ TEST_F(OAuth2AccessTokenFetcherImplTest, CancelOngoingRequest) {
base::RunLoop().RunUntilIdle();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(OAuth2AccessTokenFetcherImplTest, GetAccessTokenRaptRequiredFailure) {
SetupGetAccessToken(net::OK, net::HTTP_BAD_REQUEST,
kRaptRequiredErrorResponse);
@ -235,7 +235,7 @@ TEST_F(OAuth2AccessTokenFetcherImplTest, GetAccessTokenRaptRequiredFailure) {
fetcher_->Start("client_id", "client_secret", ScopeList());
base::RunLoop().RunUntilIdle();
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TEST_F(OAuth2AccessTokenFetcherImplTest, MakeGetAccessTokenBodyNoScope) {
std::string body =

@ -70,7 +70,6 @@ component("gcm") {
]
deps = [
"//base",
"//build:chromeos_buildflags",
"//mojo/public/cpp/system:system",
"//net",
"//services/network/public/cpp",
@ -166,7 +165,6 @@ test("gcm_unit_tests") {
":test_support",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//google_apis",
"//google_apis:run_all_unittests",
"//google_apis:test_support",

@ -8,7 +8,7 @@
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/sequenced_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "build/build_config.h"
#include "google_apis/credentials_mode.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
#include "google_apis/gcm/protocol/checkin.pb.h"
@ -139,7 +139,7 @@ void CheckinRequest::Start() {
checkin_proto::AndroidCheckinProto* checkin = request.mutable_checkin();
checkin->mutable_chrome_build()->CopyFrom(request_info_.chrome_build_proto);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
checkin->set_type(checkin_proto::DEVICE_CHROME_OS);
#else
checkin->set_type(checkin_proto::DEVICE_CHROME_BROWSER);

@ -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 "google_apis/gcm/engine/checkin_request.h"
#include <stdint.h>
#include <memory>
@ -9,8 +11,7 @@
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/gcm/engine/checkin_request.h"
#include "build/build_config.h"
#include "google_apis/gcm/engine/gcm_request_test_base.h"
#include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
#include "google_apis/gcm/protocol/checkin.pb.h"
@ -147,7 +148,7 @@ TEST_F(CheckinRequestTest, FetcherDataAndURL) {
EXPECT_EQ(chrome_build_proto_.channel(),
request_proto.checkin().chrome_build().channel());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
EXPECT_EQ(checkin_proto::DEVICE_CHROME_OS, request_proto.checkin().type());
#else
EXPECT_EQ(checkin_proto::DEVICE_CHROME_BROWSER,

@ -14,7 +14,6 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/gcm/protocol/mcs.pb.h"
#include "net/base/network_change_notifier.h"
@ -32,13 +31,13 @@ const int kMinClientHeartbeatIntervalMs = 1000 * 30; // 30 seconds.
// Minimum time spent sleeping before we force a new heartbeat.
const int kMinSuspendTimeMs = 1000 * 10; // 10 seconds.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_LINUX)
// The period at which to check if the heartbeat time has passed. Used to
// protect against platforms where the timer is delayed by the system being
// suspended. Only needed on linux because the other OSes provide a standard
// way to be notified of system suspend and resume events.
const int kHeartbeatMissedCheckMs = 1000 * 60 * 5; // 5 minutes.
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#endif // BUILDFLAG(IS_LINUX)
} // namespace
@ -191,7 +190,7 @@ void HeartbeatManager::RestartTimer() {
base::BindRepeating(&HeartbeatManager::OnHeartbeatTriggered,
weak_ptr_factory_.GetWeakPtr()));
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_LINUX)
// Windows, Mac, Android, iOS, and Chrome OS all provide a way to be notified
// when the system is suspending or resuming. The only one that does not is
// Linux so we need to poll to check for missed heartbeats.
@ -200,7 +199,7 @@ void HeartbeatManager::RestartTimer() {
base::BindOnce(&HeartbeatManager::CheckForMissedHeartbeat,
weak_ptr_factory_.GetWeakPtr()),
base::Milliseconds(kHeartbeatMissedCheckMs));
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#endif // BUILDFLAG(IS_LINUX)
}
void HeartbeatManager::CheckForMissedHeartbeat() {
@ -214,14 +213,14 @@ void HeartbeatManager::CheckForMissedHeartbeat() {
return;
}
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_LINUX)
// Otherwise check again later.
io_task_runner_->PostDelayedTask(
FROM_HERE,
base::BindOnce(&HeartbeatManager::CheckForMissedHeartbeat,
weak_ptr_factory_.GetWeakPtr()),
base::Milliseconds(kHeartbeatMissedCheckMs));
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#endif // BUILDFLAG(IS_LINUX)
}
void HeartbeatManager::UpdateHeartbeatInterval() {

@ -13,7 +13,6 @@
#include "base/version_info/channel.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/api_key_cache.h"
#include "google_apis/buildflags.h"
#include "google_apis/default_api_keys.h"
@ -99,7 +98,7 @@ const std::string& GetHatsAPIKey() {
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const std::string& GetSharingAPIKey() {
return GetApiKeyCacheInstance().api_key_sharing();
}

@ -10,7 +10,6 @@
#include "base/component_export.h"
#include "base/functional/callback_helpers.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "google_apis/buildflags.h"
namespace version_info {
@ -102,7 +101,7 @@ COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetSodaAPIKey();
COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetHatsAPIKey();
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Retrieves the Sharing API Key.
COMPONENT_EXPORT(GOOGLE_APIS) const std::string& GetSharingAPIKey();

@ -2,9 +2,7 @@
# Use of this source code is governed by a BSD - style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//testing/test.gni")
assert(is_chromeos)