Skip to content

Commit

Permalink
LaCrOS: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_CHROMEOS_ASH)
Browse files Browse the repository at this point in the history
The change is mostly mechanical replacing defined(OS_CHROMEOS) with
BUILDFLAG(IS_CHROMEOS_ASH) and GN variable is_chromeos with is_ash
with some special cases (For those cases please refer to
http://go/lacros-macros).

The patch is made in preparation to switching lacros build from
target_os=linux to target_os=chromeos. This will prevent lacros from
changing behaviour after the switch.

Bug: 1052397
Change-Id: Ibe63a58f20c536f639c7d5af640df4f37ce460c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494280
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828629}
  • Loading branch information
Yuta Hijikata authored and Commit Bot committed Nov 18, 2020
1 parent 3c229a6 commit aef12cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions headless/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ component("headless_non_renderer") {
":headless_shared_sources",
":version_header",
"//base:base_static",
"//build:chromeos_buildflags",
"//components/cookie_config",
"//components/security_state/core",
"//content/public/common",
Expand Down
3 changes: 2 additions & 1 deletion headless/lib/browser/headless_browser_main_parts_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
#include "headless/lib/browser/headless_browser_main_parts.h"

#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"

namespace headless {

void HeadlessBrowserMainParts::PostMainMessageLoopStart() {
#if defined(USE_DBUS) && !defined(OS_CHROMEOS)
#if defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS_ASH)
bluez::BluezDBusManager::Initialize(/*system_bus=*/nullptr);
#endif
}
Expand Down
13 changes: 10 additions & 3 deletions headless/lib/browser/headless_request_context_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/task/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/resource_context.h"
Expand All @@ -26,7 +27,9 @@ namespace headless {

namespace {

#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
constexpr char kProductName[] = "HeadlessChrome";
#endif

Expand Down Expand Up @@ -56,7 +59,9 @@ net::NetworkTrafficAnnotationTag GetProxyConfigTrafficAnnotationTag() {
return traffic_annotation;
}

#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
::network::mojom::CryptConfigPtr BuildCryptConfigOnce(
const base::FilePath& user_data_path) {
static bool done_once = false;
Expand Down Expand Up @@ -218,7 +223,9 @@ HeadlessRequestContextManager::HeadlessRequestContextManager(
base::ThreadTaskRunnerHandle::Get());
}
}
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
auto crypt_config = BuildCryptConfigOnce(user_data_path_);
if (crypt_config)
content::GetNetworkService()->SetCryptConfig(std::move(crypt_config));
Expand Down

0 comments on commit aef12cc

Please sign in to comment.