Refactor OS_LINUX preprocessor directive for LaCrOS effort.
Currently, ChromeOS defines the OS_LINUX directive as well as
OS_CHROMEOS. We're working to separate these two, so we're
making the fact that OS_LINUX == OS_LINUX || OS_CHROMEOS
explicit.
Bug: 1110266
Change-Id: I7d5724c1cd9720e917ca71d3af4eda1a6959fdfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352433
Commit-Queue: Sean McAllister <smcallis@google.com>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Evgenii Stepanov <eugenis@chromium.org>
Reviewed-by: manuk hovanesian <manukh@chromium.org>
Reviewed-by: Ben Greenstein <bengr@chromium.org>
Reviewed-by: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Parastoo Geranmayeh <parastoog@google.com>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799206}
diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc
index 568b692..af16c38 100644
--- a/build/sanitizers/sanitizer_options.cc
+++ b/build/sanitizers/sanitizer_options.cc
@@ -42,7 +42,7 @@
// detect_stack_use_after_return=1 - use fake stack to delay the reuse of
// stack allocations and detect stack-use-after-return errors.
// symbolize=1 - enable in-process symbolization.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
const char kAsanDefaultOptions[] =
"check_printf=1 use_sigaltstack=1 strip_path_prefix=/../../ "
"fast_unwind_on_fatal=1 detect_stack_use_after_return=1 "
@@ -57,9 +57,10 @@
const char* kAsanDefaultOptions =
"check_printf=1 use_sigaltstack=1 strip_path_prefix=\\..\\..\\ "
"fast_unwind_on_fatal=1 detect_stack_use_after_return=1 ";
-#endif // OS_LINUX
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
-#if defined(OS_LINUX) || defined(OS_APPLE) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) || \
+ defined(OS_WIN)
// Allow NaCl to override the default asan options.
extern const char* kAsanDefaultOptionsNaCl;
__attribute__((weak)) const char* kAsanDefaultOptionsNaCl = nullptr;
@@ -75,10 +76,11 @@
SANITIZER_HOOK_ATTRIBUTE const char *__asan_default_suppressions() {
return kASanDefaultSuppressions;
}
-#endif // OS_LINUX || OS_APPLE || OS_WIN
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE) ||
+ // defined(OS_WIN)
#endif // ADDRESS_SANITIZER
-#if defined(THREAD_SANITIZER) && defined(OS_LINUX)
+#if defined(THREAD_SANITIZER) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
// Default options for ThreadSanitizer in various configurations:
// detect_deadlocks=1 - enable deadlock (lock inversion) detection.
// second_deadlock_stack=1 - more verbose deadlock reports.
@@ -106,7 +108,8 @@
return kTSanDefaultSuppressions;
}
-#endif // THREAD_SANITIZER && OS_LINUX
+#endif // defined(THREAD_SANITIZER) && (defined(OS_LINUX) ||
+ // defined(OS_CHROMEOS))
#if defined(MEMORY_SANITIZER)
// Default options for MemorySanitizer:
diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc
index e1ed90a5..7e48806 100644
--- a/chrome/browser/profiles/profile_attributes_entry.cc
+++ b/chrome/browser/profiles/profile_attributes_entry.cc
@@ -189,7 +189,8 @@
if (is_force_signin_enabled_) {
if (!IsAuthenticated())
is_force_signin_profile_locked_ = true;
-#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_WIN)
} else if (IsSigninRequired()) {
// Profiles that require signin in the absence of an enterprise policy are
// left-overs from legacy supervised users. Just unlock them, so users can
diff --git a/chrome/browser/profiles/profile_window_browsertest.cc b/chrome/browser/profiles/profile_window_browsertest.cc
index 384392f..757c14b 100644
--- a/chrome/browser/profiles/profile_window_browsertest.cc
+++ b/chrome/browser/profiles/profile_window_browsertest.cc
@@ -271,7 +271,7 @@
}
// TODO(crbug.com/935746): Test is flaky on Win and Linux.
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
#define MAYBE_OpenBrowserWindowForProfileWithSigninRequired \
DISABLED_OpenBrowserWindowForProfileWithSigninRequired
#else
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 211a514..dba84e6 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -1170,7 +1170,8 @@
EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec());
}
-#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_WIN)
// http://crbug.com/83828. On Mac 10.6, the failure rate is 14%
#define MAYBE_FaviconChange DISABLED_FaviconChange
#else
diff --git a/chrome/browser/ui/browser_command_controller_interactive_browsertest.cc b/chrome/browser/ui/browser_command_controller_interactive_browsertest.cc
index 652baec..3d6ce45c 100644
--- a/chrome/browser/ui/browser_command_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/browser_command_controller_interactive_browsertest.cc
@@ -161,7 +161,7 @@
MAYBE_ShortcutsShouldTakeEffectInJsFullscreen) {
// This test is flaky. See http://crbug.com/759704.
// TODO(zijiehe): Find out the root cause.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
return;
#endif
ASSERT_NO_FATAL_FAILURE(SendShortcutsAndExpectNotPrevented(true));
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 114e8bc..99a89f79 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -1787,7 +1787,7 @@
EXPECT_EQ(base::UTF8ToUTF16(expected_url), omnibox_view->GetText());
}
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
// Flaky on Win and Linux. See https://crbug.com/1044335.
#define MAYBE_ReuseRVHWithWebUI DISABLED_ReuseRVHWithWebUI
#else
diff --git a/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc b/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc
index 66f0c7fb..fd1bde21 100644
--- a/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc
+++ b/chrome/browser/ui/exclusive_access/exclusive_access_bubble.cc
@@ -16,7 +16,7 @@
// NOTE(koz): Linux doesn't use the thick shadowed border, so we add padding
// here.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
const int ExclusiveAccessBubble::kPaddingPx = 8;
#else
const int ExclusiveAccessBubble::kPaddingPx = 15;
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
index 1667512..71e6e32 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc
@@ -415,7 +415,7 @@
// embedded flash fullscreen, since the Flash plugin handles user permissions
// requests itself).
// Flaky on Linux: crbug.com/1066607
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_PrivilegedMouseLockAndFullscreen \
DISABLED_PrivilegedMouseLockAndFullscreen
#else
diff --git a/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc b/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc
index eee6cfc..0df45dc1 100644
--- a/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc
+++ b/chrome/browser/ui/keyboard_lock_interactive_browsertest.cc
@@ -438,7 +438,7 @@
ASSERT_FALSE(IsKeyboardLockActive());
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// BringBrowserWindowToFront hangs on Linux: http://crbug.com/163931
#define MAYBE_GainAndLoseFocusInWindowMode DISABLED_GainAndLoseFocusInWindowMode
#else
@@ -499,7 +499,7 @@
ASSERT_FALSE(IsKeyboardLockActive());
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// BringBrowserWindowToFront hangs on Linux: http://crbug.com/163931
#define MAYBE_GainAndLoseFocusInFullscreen DISABLED_GainAndLoseFocusInFullscreen
#else
diff --git a/chrome/browser/ui/sad_tab.cc b/chrome/browser/ui/sad_tab.cc
index b416bef7..9897b90e 100644
--- a/chrome/browser/ui/sad_tab.cc
+++ b/chrome/browser/ui/sad_tab.cc
@@ -189,7 +189,7 @@
// Only show Incognito suggestion if not already in Incognito mode.
if (!web_contents_->GetBrowserContext()->IsOffTheRecord())
message_ids.insert(message_ids.begin(), IDS_SAD_TAB_RELOAD_INCOGNITO);
-#if defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS)
// Note: on macOS, Linux and ChromeOS, the first bullet is either one of
// IDS_SAD_TAB_RELOAD_CLOSE_TABS or IDS_SAD_TAB_RELOAD_CLOSE_NOTABS
// followed by one of the above suggestions.
diff --git a/chrome/browser/ui/sync/profile_signin_confirmation_helper_browsertest.cc b/chrome/browser/ui/sync/profile_signin_confirmation_helper_browsertest.cc
index cc6aece..9667f7e 100644
--- a/chrome/browser/ui/sync/profile_signin_confirmation_helper_browsertest.cc
+++ b/chrome/browser/ui/sync/profile_signin_confirmation_helper_browsertest.cc
@@ -33,7 +33,7 @@
// http://crbug.com/321302
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && \
- (defined(OS_MAC) || defined(OS_LINUX))
+ (defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS))
#define MAYBE_HasNotBeenShutdown DISABLED_HasNotBeenShutdown
#else
#define MAYBE_HasNotBeenShutdown HasNotBeenShutdown
@@ -48,7 +48,7 @@
// http://crbug.com/321302
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && \
- (defined(OS_MAC) || defined(OS_LINUX))
+ (defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS))
#define MAYBE_HasNoSyncedExtensions DISABLED_HasNoSyncedExtensions
#else
#define MAYBE_HasNoSyncedExtensions HasNoSyncedExtensions
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
index 4557479..6e17fb3b 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -914,7 +914,7 @@
// Windows clipboard only supports text URLs.
// Mac clipboard not reporting URL format available for some reason.
// crbug.com/751031
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
EXPECT_TRUE(
clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetUrlType(),
clipboard_buffer, /* data_dst = */ nullptr));
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
index ca09542a..6894969 100644
--- a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
@@ -766,7 +766,7 @@
ProfileMenuViewBase::ActionableItem::kPasswordsButton};
// TODO(https://crbug.com/1021930) flakey on Linux and Windows.
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
#define MAYBE_ProfileMenuClickTest_WithUnconsentedPrimaryAccount \
DISABLED_ProfileMenuClickTest_WithUnconsentedPrimaryAccount
#else
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc
index d071393..ba4753e 100644
--- a/chrome/browser/ui/webui/about_ui.cc
+++ b/chrome/browser/ui/webui/about_ui.cc
@@ -579,7 +579,7 @@
return html;
}
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_OPENBSD)
std::string AboutLinuxProxyConfig() {
std::string data;
AppendHeader(&data, 0,
@@ -635,7 +635,7 @@
response =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(idr);
}
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_OPENBSD)
} else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
response = AboutLinuxProxyConfig();
#endif
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 8823a4a..9370db88 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -238,11 +238,13 @@
#include "chrome/browser/ui/webui/conflicts/conflicts_ui.h"
#endif
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/discards/discards_ui.h"
#endif
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_ANDROID)
#include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
#endif
@@ -397,7 +399,7 @@
#if !defined(OS_ANDROID)
|| url.host_piece() == chrome::kChromeUITermsHost
#endif
-#if defined(OS_LINUX) || defined(OS_OPENBSD)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_OPENBSD)
|| url.host_piece() == chrome::kChromeUILinuxProxyConfigHost
#endif
#if defined(OS_CHROMEOS)
@@ -773,7 +775,8 @@
if (url.host_piece() == chrome::kChromeUINaClHost)
return &NewWebUI<NaClUI>;
#endif
-#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
if (url.host_piece() == chrome::kChromeUITabModalConfirmDialogHost)
return &NewWebUI<ConstrainedWebDialogUI>;
#endif
@@ -821,12 +824,14 @@
return &NewWebUI<media_router::MediaRouterInternalsUI>;
}
#endif
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_ANDROID)
if (url.host_piece() == chrome::kChromeUISandboxHost) {
return &NewWebUI<SandboxInternalsUI>;
}
#endif
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
if (url.host_piece() == chrome::kChromeUIDiscardsHost)
return &NewWebUI<DiscardsUI>;
#endif
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
index 04977014..f78e91f 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
@@ -94,7 +94,7 @@
// Tests that opening/closing the constrained window won't crash it.
// Flaky on trusty builder: http://crbug.com/1020490.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_BasicTest DISABLED_BasicTest
#else
#define MAYBE_BasicTest BasicTest
@@ -114,7 +114,7 @@
}
// TODO(https://crbug.com/1020038): Crashy on Linux
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_ReleaseWebContents DISABLED_ReleaseWebContents
#else
#define MAYBE_ReleaseWebContents ReleaseWebContents
diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc
index fbfd7d6..acf4c69 100644
--- a/chrome/browser/ui/webui/crashes_ui.cc
+++ b/chrome/browser/ui/webui/crashes_ui.cc
@@ -42,7 +42,7 @@
#include "chromeos/dbus/debug_daemon/debug_daemon_client.h"
#endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "components/crash/core/app/crashpad.h"
#endif
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc
index ff152a6..f809592 100644
--- a/chrome/common/webui_url_constants.cc
+++ b/chrome/common/webui_url_constants.cc
@@ -327,14 +327,17 @@
}
#endif // defined(OS_CHROMEOS)
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
const char kChromeUIDiscardsHost[] = "discards";
const char kChromeUIDiscardsURL[] = "chrome://discards/";
const char kChromeUIHatsHost[] = "hats";
const char kChromeUIHatsURL[] = "chrome://hats/";
+#if !defined(OS_CHROMEOS)
const char kChromeUIProfilePickerHost[] = "profile-picker";
const char kChromeUIProfilePickerUrl[] = "chrome://profile-picker/";
#endif
+#endif
#if !defined(OS_ANDROID)
const char kChromeUINearbyShareHost[] = "nearby";
@@ -345,7 +348,8 @@
const char kChromeUILinuxProxyConfigHost[] = "linux-proxy-config";
#endif
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_ANDROID)
const char kChromeUISandboxHost[] = "sandbox";
#endif
@@ -355,7 +359,8 @@
const char kChromeUIBrowserSwitchURL[] = "chrome://browser-switch/";
#endif
-#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
const char kChromeUITabModalConfirmDialogHost[] = "tab-modal-confirm-dialog";
#endif
@@ -522,13 +527,15 @@
kChromeUIInternetDetailDialogHost,
kChromeUIAssistantOptInHost,
#endif
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
kChromeUIDiscardsHost,
#endif
#if defined(OS_POSIX) && !defined(OS_MAC) && !defined(OS_ANDROID)
kChromeUILinuxProxyConfigHost,
#endif
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_ANDROID)
kChromeUISandboxHost,
#endif
#if defined(OS_WIN)
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h
index 49d83b0b..7e3abb3 100644
--- a/chrome/common/webui_url_constants.h
+++ b/chrome/common/webui_url_constants.h
@@ -283,7 +283,8 @@
#endif // defined(OS_CHROMEOS)
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
extern const char kChromeUIDiscardsHost[];
extern const char kChromeUIDiscardsURL[];
extern const char kChromeUIHatsHost[];
@@ -301,7 +302,8 @@
extern const char kChromeUILinuxProxyConfigHost[];
#endif
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
+ defined(OS_ANDROID)
extern const char kChromeUISandboxHost[];
#endif
@@ -311,7 +313,8 @@
extern const char kChromeUIBrowserSwitchURL[];
#endif
-#if (defined(OS_LINUX) && defined(TOOLKIT_VIEWS)) || defined(USE_AURA)
+#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
extern const char kChromeUITabModalConfirmDialogHost[];
#endif
diff --git a/chrome/test/data/webui/sandboxstatus_browsertest.js b/chrome/test/data/webui/sandboxstatus_browsertest.js
index bb484327..1b7722ca 100644
--- a/chrome/test/data/webui/sandboxstatus_browsertest.js
+++ b/chrome/test/data/webui/sandboxstatus_browsertest.js
@@ -27,7 +27,7 @@
// sandbox. See:
// https://chromium.googlesource.com/chromium/src/+/master/docs/linux/suid_sandbox_development.md
// - PLEASE DO NOT GLOBALLY DISABLE THIS TEST.
-GEN('#if defined(OS_LINUX)');
+GEN('#if defined(OS_LINUX) || defined(OS_CHROMEOS)');
GEN('# define MAYBE_testSUIDorNamespaceSandboxEnabled \\');
GEN(' testSUIDorNamespaceSandboxEnabled');
GEN('#else');
@@ -53,7 +53,7 @@
});
// The seccomp-bpf sandbox is also not compatible with ASAN.
-GEN('#if !defined(OS_LINUX)');
+GEN('#if !defined(OS_LINUX) && !defined(OS_CHROMEOS)');
GEN('# define MAYBE_testBPFSandboxEnabled \\');
GEN(' DISABLED_testBPFSandboxEnabled');
GEN('#else');
diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc
index a207ed8..a9d1823 100644
--- a/chrome/test/nacl/nacl_browsertest.cc
+++ b/chrome/test/nacl/nacl_browsertest.cc
@@ -164,7 +164,7 @@
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, IrtManifestFile) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_manifest_file_test.html"));
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// http://crbug.com/579804
#define MAYBE_IrtManifestFile DISABLED_IrtManifestFile
#else
@@ -183,7 +183,7 @@
IN_PROC_BROWSER_TEST_F(NaClBrowserTestNewlib, MAYBE_IrtException) {
RunNaClIntegrationTest(FILE_PATH_LITERAL("irt_exception_test.html"));
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// http://crbug.com/579804
#define MAYBE_IrtException2 DISABLED_IrtException
#else
@@ -391,7 +391,8 @@
// NaClBrowserTestPnacl.PnaclErrorHandling is flaky on Win, Mac, and Linux.
// http://crbug.com/704980, http://crbug.com/870309
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
#define MAYBE_PnaclErrorHandling DISABLED_PnaclErrorHandling
#else
#define MAYBE_PnaclErrorHandling PnaclErrorHandling
diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h
index 2b6be25..c7ce11e 100644
--- a/chrome/test/nacl/nacl_browsertest_util.h
+++ b/chrome/test/nacl/nacl_browsertest_util.h
@@ -172,7 +172,8 @@
// https://code.google.com/p/chromium/issues/detail?id=177555
#if (defined(OS_WIN) && !defined(NDEBUG))
# define MAYBE_PNACL(test_name) DISABLED_##test_name
-#elif defined(OS_LINUX) && defined(ADDRESS_SANITIZER)
+#elif defined(ADDRESS_SANITIZER) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
// NaClBrowserTestPnacl tests are very flaky on ASan, see crbug.com/1003259.
# define MAYBE_PNACL(test_name) DISABLED_##test_name
#else
@@ -190,9 +191,9 @@
// Currently, we only support it on x86-32 or ARM architecture.
// TODO(hidehiko,mazda): Enable this on x86-64, too, when it is supported.
-#if defined(OS_LINUX) && !defined(ADDRESS_SANITIZER) && \
- !defined(THREAD_SANITIZER) && !defined(MEMORY_SANITIZER) && \
- !defined(LEAK_SANITIZER) && \
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \
+ !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) && \
(defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARMEL))
# define MAYBE_NONSFI(test_case) test_case
#else
@@ -201,9 +202,9 @@
// Similar to MAYBE_NONSFI, this is available only on x86-32, x86-64 or
// ARM linux.
-#if defined(OS_LINUX) && !defined(ADDRESS_SANITIZER) && \
- !defined(THREAD_SANITIZER) && !defined(MEMORY_SANITIZER) && \
- !defined(LEAK_SANITIZER) && \
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \
+ !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) && \
(defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL))
# define MAYBE_PNACL_NONSFI(test_case) test_case
#else
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index c5eeef9..dddab34b 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -1916,8 +1916,9 @@
bool PersonalDataManager::ShouldShowCardsFromAccountOption() const {
// The feature is only for Linux, Windows and Mac.
-#if (!defined(OS_LINUX) && !defined(OS_WIN) && !defined(OS_APPLE)) || \
- defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
+ return false;
+#elif !defined(OS_LINUX) && !defined(OS_WIN) && !defined(OS_APPLE)
return false;
#else
// This option should only be shown for users that have not enabled the Sync
@@ -1940,8 +1941,7 @@
// The option should only be shown if the user has not already opted-in.
return !is_opted_in;
-#endif // (!defined(OS_LINUX) && !defined(OS_WIN) && !defined(OS_APPLE)) ||
- // defined(OS_CHROMEOS)
+#endif
}
void PersonalDataManager::OnUserAcceptedCardsFromAccountOption() {
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc
index b1f26bc3..925e878 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -6687,7 +6687,8 @@
#endif // !defined(OS_ANDROID)
// Sync Transport mode is only for Win, Mac, and Linux.
-#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \
+ defined(OS_CHROMEOS)
TEST_F(PersonalDataManagerTest, ServerCardsShowInTransportMode) {
// Set up PersonalDataManager in transport mode.
ResetPersonalDataManager(USER_MODE_NORMAL,
@@ -6750,7 +6751,7 @@
EXPECT_EQ(2U, personal_data_->GetServerCreditCards().size());
}
#endif // defined(OS_WIN) || defined(OS_MAC) ||
- // defined(OS_LINUX)
+ // defined(OS_LINUX) || defined(OS_CHROMEOS)
// Tests that all the non settings origins of autofill profiles are cleared but
// that the settings origins are untouched.
diff --git a/components/dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc b/components/dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc
index 4494c65..e862ea9 100644
--- a/components/dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc
+++ b/components/dom_distiller/content/browser/test/dom_distiller_js_browsertest.cc
@@ -114,7 +114,7 @@
// https://crbug.com/845180
// Then disabled more generally on Android: https://crbug.com/979685
#if defined(MEMORY_SANITIZER) || defined(OS_WIN) || defined(OS_ANDROID) || \
- (defined(OS_LINUX) && \
+ ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
(BUILDFLAG(CFI_CAST_CHECK) || BUILDFLAG(CFI_ICALL_CHECK) || \
BUILDFLAG(CFI_ENFORCEMENT_DIAGNOSTIC) || \
BUILDFLAG(CFI_ENFORCEMENT_TRAP)))
diff --git a/components/flags_ui/flags_state.cc b/components/flags_ui/flags_state.cc
index e251f1a..9c71f52 100644
--- a/components/flags_ui/flags_state.cc
+++ b/components/flags_ui/flags_state.cc
@@ -684,7 +684,7 @@
return kOsMac;
#elif defined(OS_WIN)
return kOsWin;
-#elif defined(OS_CHROMEOS) // Needs to be before the OS_LINUX check.
+#elif defined(OS_CHROMEOS)
return kOsCrOS;
#elif defined(OS_LINUX) || defined(OS_OPENBSD)
return kOsLinux;
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index 5fe93eb..b68e922 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -381,7 +381,7 @@
if (uses_nonsfi_mode_) {
bool nonsfi_mode_forced_by_command_line = false;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
nonsfi_mode_forced_by_command_line =
cmd->HasSwitch(switches::kEnableNaClNonSfiMode);
#endif
@@ -478,7 +478,7 @@
// Build command line for nacl.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
int flags = ChildProcessHost::CHILD_ALLOW_SELF;
#elif defined(OS_APPLE)
int flags = ChildProcessHost::CHILD_PLUGIN;
@@ -843,7 +843,7 @@
params.nexe_file = IPC::TakePlatformFileForTransit(std::move(nexe_file_));
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// In Non-SFI mode, create socket pairs for IPC channels here, unlike in
// SFI-mode, in which those channels are created in nacl_listener.cc.
// This is for security hardening. We can then prohibit the socketpair()
diff --git a/components/nacl/common/nacl_nonsfi_util.cc b/components/nacl/common/nacl_nonsfi_util.cc
index b0c30b6..f042010 100644
--- a/components/nacl/common/nacl_nonsfi_util.cc
+++ b/components/nacl/common/nacl_nonsfi_util.cc
@@ -14,7 +14,7 @@
#if defined(OS_CHROMEOS) && \
(defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL))
return true;
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNaClNonSfiMode);
#else
diff --git a/components/nacl/common/nacl_paths.cc b/components/nacl/common/nacl_paths.cc
index 1930e57..71615dc 100644
--- a/components/nacl/common/nacl_paths.cc
+++ b/components/nacl/common/nacl_paths.cc
@@ -12,7 +12,7 @@
namespace {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// File name of the nacl_helper and nacl_helper_bootstrap, Linux only.
const base::FilePath::CharType kInternalNaClHelperFileName[] =
FILE_PATH_LITERAL("nacl_helper");
@@ -37,7 +37,7 @@
bool PathProvider(int key, base::FilePath* result) {
switch (key) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
case FILE_NACL_HELPER:
return GetNaClHelperPath(kInternalNaClHelperFileName, result);
case FILE_NACL_HELPER_NONSFI:
diff --git a/components/nacl/common/nacl_paths.h b/components/nacl/common/nacl_paths.h
index 3b0dd74..935f582 100644
--- a/components/nacl/common/nacl_paths.h
+++ b/components/nacl/common/nacl_paths.h
@@ -15,10 +15,10 @@
enum {
PATH_START = 9000,
-#if defined(OS_LINUX)
- FILE_NACL_HELPER = PATH_START, // Full path to Linux nacl_helper executable.
- FILE_NACL_HELPER_NONSFI, // path to nacl_helper_nonsfi executable,
- FILE_NACL_HELPER_BOOTSTRAP, // ... and nacl_helper_bootstrap executable.
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
+ FILE_NACL_HELPER = PATH_START, // Full path to Linux nacl_helper executable.
+ FILE_NACL_HELPER_NONSFI, // path to nacl_helper_nonsfi executable,
+ FILE_NACL_HELPER_BOOTSTRAP, // ... and nacl_helper_bootstrap executable.
#endif
PATH_END
diff --git a/components/nacl/common/nacl_types.h b/components/nacl/common/nacl_types.h
index 495629a..c1f5b397 100644
--- a/components/nacl/common/nacl_types.h
+++ b/components/nacl/common/nacl_types.h
@@ -80,7 +80,7 @@
IPC::PlatformFileForTransit debug_stub_server_bound_socket;
#endif
-#if defined(OS_LINUX) || defined(OS_NACL_NONSFI)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_NACL_NONSFI)
// These are for Non-SFI mode IPC channels.
// For security hardening, unlike in SFI mode, we cannot create socket pairs
// in a NaCl loader process. Thus, the browser process creates the
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 4472050..09b7d1d 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -41,7 +41,7 @@
#include "native_client/src/public/nacl_app.h"
#include "native_client/src/public/nacl_desc.h"
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "content/public/common/zygote/sandbox_support_linux.h"
#endif
@@ -156,7 +156,7 @@
: shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
io_thread_("NaCl_IOThread"),
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
prereserved_sandbox_size_(0),
#endif
#if defined(OS_POSIX)
@@ -226,7 +226,7 @@
base::RunLoop().Run();
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// static
int NaClListener::MakeSharedMemorySegment(size_t length, int executable) {
return content::SharedMemoryIPCSupport::MakeSharedMemorySegment(length,
@@ -288,7 +288,7 @@
void NaClListener::OnStart(nacl::NaClStartParams params) {
is_started_ = true;
-#if defined(OS_LINUX) || defined(OS_APPLE)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE)
int urandom_fd = HANDLE_EINTR(dup(base::GetUrandomFD()));
if (urandom_fd < 0) {
LOG(FATAL) << "Failed to dup() the urandom FD";
@@ -351,7 +351,7 @@
args->number_of_cores = number_of_cores_;
#endif
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
args->create_memory_object_func = &MakeSharedMemorySegment;
#endif
@@ -415,7 +415,7 @@
DebugStubPortSelectedHandler;
#endif
args->load_status_handler_func = LoadStatusCallback;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
args->prereserved_sandbox_size = prereserved_sandbox_size_;
#endif
diff --git a/components/nacl/loader/nacl_listener.h b/components/nacl/loader/nacl_listener.h
index def8955b8..90d90590 100644
--- a/components/nacl/loader/nacl_listener.h
+++ b/components/nacl/loader/nacl_listener.h
@@ -39,7 +39,7 @@
bool Send(IPC::Message* msg);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
void set_prereserved_sandbox_size(size_t prereserved_sandbox_size) {
prereserved_sandbox_size_ = prereserved_sandbox_size;
}
@@ -69,7 +69,7 @@
base::FilePath file_path);
private:
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
static int MakeSharedMemorySegment(size_t length, int executable);
#endif
@@ -96,7 +96,7 @@
base::WaitableEvent shutdown_event_;
base::Thread io_thread_;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
size_t prereserved_sandbox_size_;
#endif
#if defined(OS_POSIX)
diff --git a/components/nacl/loader/nacl_main.cc b/components/nacl/loader/nacl_main.cc
index 4eeda49..d52f019 100644
--- a/components/nacl/loader/nacl_main.cc
+++ b/components/nacl/loader/nacl_main.cc
@@ -36,7 +36,7 @@
base::HighResolutionTimerManager hi_res_timer_manager;
#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \
- defined(OS_ANDROID)
+ defined(OS_CHROMEOS) || defined(OS_ANDROID)
NaClMainPlatformDelegate platform;
bool no_sandbox =
parsed_command_line.HasSwitch(sandbox::policy::switches::kNoSandbox);
diff --git a/components/omnibox/browser/location_bar_model_impl_unittest.cc b/components/omnibox/browser/location_bar_model_impl_unittest.cc
index 5062f89..bf7e460 100644
--- a/components/omnibox/browser/location_bar_model_impl_unittest.cc
+++ b/components/omnibox/browser/location_bar_model_impl_unittest.cc
@@ -273,7 +273,7 @@
// TODO(https://crbug.com/1010418): Fix flakes on linux_chromium_asan_rel_ng and
// re-enable this test.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_PreventElisionWorks DISABLED_PreventElisionWorks
#else
#define MAYBE_PreventElisionWorks PreventElisionWorks
diff --git a/content/browser/renderer_host/input/input_device_change_observer.cc b/content/browser/renderer_host/input/input_device_change_observer.cc
index 8280ecc..867c40e 100644
--- a/content/browser/renderer_host/input/input_device_change_observer.cc
+++ b/content/browser/renderer_host/input/input_device_change_observer.cc
@@ -10,7 +10,7 @@
#if defined(OS_WIN)
#include "ui/events/devices/input_device_observer_win.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "ui/events/devices/device_data_manager.h"
#elif defined(OS_ANDROID)
#include "ui/events/devices/input_device_observer_android.h"
@@ -22,7 +22,7 @@
render_view_host_impl_ = rvhi;
#if defined(OS_WIN)
ui::InputDeviceObserverWin::GetInstance()->AddObserver(this);
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
ui::DeviceDataManager::GetInstance()->AddObserver(this);
#elif defined(OS_ANDROID)
ui::InputDeviceObserverAndroid::GetInstance()->AddObserver(this);
@@ -32,7 +32,7 @@
InputDeviceChangeObserver::~InputDeviceChangeObserver() {
#if defined(OS_WIN)
ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this);
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
#elif defined(OS_ANDROID)
ui::InputDeviceObserverAndroid::GetInstance()->RemoveObserver(this);
diff --git a/content/browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc b/content/browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc
index 32be99948..77ec6a4 100644
--- a/content/browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc
+++ b/content/browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc
@@ -28,7 +28,7 @@
} // namespace
// Disable test on Android ASAN bot: crbug.com/807420
-#if defined(OS_WIN) || defined(OS_LINUX) || \
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
(defined(OS_ANDROID) && !defined(ADDRESS_SANITIZER))
IN_PROC_BROWSER_TEST_F(InteractionMediaQueriesDynamicTest,
PointerMediaQueriesDynamic) {
diff --git a/content/browser/utility_process_sandbox_browsertest.cc b/content/browser/utility_process_sandbox_browsertest.cc
index 105d97d..d34af1c 100644
--- a/content/browser/utility_process_sandbox_browsertest.cc
+++ b/content/browser/utility_process_sandbox_browsertest.cc
@@ -38,7 +38,7 @@
// These sandbox types can't be spawned in a utility process.
if (t == SandboxType::kRenderer || t == SandboxType::kGpu)
continue;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
if (t == SandboxType::kZygoteIntermediateSandbox)
continue;
#endif
diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc
index 02985a52..57f1dcf 100644
--- a/content/public/app/content_main_delegate.cc
+++ b/content/public/app/content_main_delegate.cc
@@ -24,12 +24,12 @@
return -1;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
void ContentMainDelegate::ZygoteStarting(
std::vector<std::unique_ptr<ZygoteForkDelegate>>* delegates) {}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
int ContentMainDelegate::TerminateForFatalInitializationError() {
CHECK(false);
diff --git a/content/public/app/content_main_delegate.h b/content/public/app/content_main_delegate.h
index 0ca9247..a384cd8 100644
--- a/content/public/app/content_main_delegate.h
+++ b/content/public/app/content_main_delegate.h
@@ -60,7 +60,7 @@
// Called right before the process exits.
virtual void ProcessExiting(const std::string& process_type) {}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Tells the embedder that the zygote process is starting, and allows it to
// specify one or more zygote delegates if it wishes by storing them in
// |*delegates|.
@@ -69,7 +69,7 @@
// Called every time the zygote process forks.
virtual void ZygoteForked() {}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
// Fatal errors during initialization are reported by this function, so that
// the embedder can implement graceful exit by displaying some message and
diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc
index 21bbdf51..103ad65 100644
--- a/device/bluetooth/bluetooth_adapter.cc
+++ b/device/bluetooth/bluetooth_adapter.cc
@@ -41,7 +41,7 @@
return GetWeakPtr();
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
void BluetoothAdapter::Shutdown() {
NOTIMPLEMENTED();
}
diff --git a/device/bluetooth/bluetooth_adapter.h b/device/bluetooth/bluetooth_adapter.h
index 863eefd..02272d5 100644
--- a/device/bluetooth/bluetooth_adapter.h
+++ b/device/bluetooth/bluetooth_adapter.h
@@ -358,7 +358,7 @@
// Returns a weak pointer to an existing adapter for testing purposes only.
base::WeakPtr<BluetoothAdapter> GetWeakPtrForTesting();
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Shutdown the adapter: tear down and clean up all objects owned by
// BluetoothAdapter. After this call, the BluetoothAdapter will behave as if
// no Bluetooth controller exists in the local system. |IsPresent| will return
@@ -558,7 +558,7 @@
CreateAdvertisementCallback callback,
AdvertisementErrorCallback error_callback) = 0;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Sets the interval between two consecutive advertisements. Valid ranges
// for the interval are from 20ms to 10.24 seconds, with min <= max.
// Note: This is a best effort. The actual interval may vary non-trivially
diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc
index 97f4ba5..cd43370 100644
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -46,7 +46,7 @@
if (Get()->adapter_)
return true;
#if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_LINUX) || \
- defined(OS_MAC)
+ defined(OS_CHROMEOS) || defined(OS_MAC)
return true;
#else
return false;
@@ -68,7 +68,7 @@
return base::win::GetVersion() >= base::win::Version::WIN10;
#elif defined(OS_MAC)
return true;
-#elif defined(OS_LINUX)
+#elif (defined(OS_LINUX) || defined(OS_CHROMEOS))
return true;
#else
return false;
@@ -130,7 +130,7 @@
#endif // defined(OS_WIN)
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// static
void BluetoothAdapterFactory::Shutdown() {
if (Get()->adapter_)
diff --git a/device/bluetooth/bluetooth_adapter_factory.h b/device/bluetooth/bluetooth_adapter_factory.h
index ee8b3c3..471cf27 100644
--- a/device/bluetooth/bluetooth_adapter_factory.h
+++ b/device/bluetooth/bluetooth_adapter_factory.h
@@ -70,7 +70,7 @@
// GetAdapter(), as the default adapter already supports Bluetooth classic.
void GetClassicAdapter(AdapterCallback callback);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Calls |BluetoothAdapter::Shutdown| on the adapter if
// present.
static void Shutdown();
diff --git a/device/bluetooth/bluetooth_advertisement.h b/device/bluetooth/bluetooth_advertisement.h
index 7b1844b..258ea1f 100644
--- a/device/bluetooth/bluetooth_advertisement.h
+++ b/device/bluetooth/bluetooth_advertisement.h
@@ -42,7 +42,7 @@
// through a platform API.
ERROR_RESET_ADVERTISING, // Error while resetting advertising.
ERROR_ADAPTER_POWERED_OFF, // Error because the adapter is off
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
ERROR_INVALID_ADVERTISEMENT_INTERVAL, // Advertisement interval specified
// is out of valid range.
#endif
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 8bdf528..643cad1f 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -206,7 +206,7 @@
// and metrics logging,
virtual uint32_t GetBluetoothClass() const = 0;
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Returns the transport type of the device. Some devices only support one
// of BR/EDR or LE, and some support both.
virtual BluetoothTransport GetType() const = 0;
diff --git a/device/bluetooth/bluetooth_local_gatt_characteristic.cc b/device/bluetooth/bluetooth_local_gatt_characteristic.cc
index 1bda9f4..33e44fc 100644
--- a/device/bluetooth/bluetooth_local_gatt_characteristic.cc
+++ b/device/bluetooth/bluetooth_local_gatt_characteristic.cc
@@ -10,7 +10,7 @@
namespace device {
-#if !defined(OS_LINUX) || defined(LINUX_WITHOUT_DBUS)
+#if (!defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(LINUX_WITHOUT_DBUS)
// static
base::WeakPtr<BluetoothLocalGattCharacteristic>
BluetoothLocalGattCharacteristic::Create(const BluetoothUUID& uuid,
diff --git a/device/bluetooth/bluetooth_local_gatt_descriptor.cc b/device/bluetooth/bluetooth_local_gatt_descriptor.cc
index ab8dbab2..05a338fe 100644
--- a/device/bluetooth/bluetooth_local_gatt_descriptor.cc
+++ b/device/bluetooth/bluetooth_local_gatt_descriptor.cc
@@ -9,7 +9,7 @@
namespace device {
-#if !defined(OS_LINUX) || defined(LINUX_WITHOUT_DBUS)
+#if (!defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(LINUX_WITHOUT_DBUS)
// static
base::WeakPtr<BluetoothLocalGattDescriptor>
BluetoothLocalGattDescriptor::Create(
diff --git a/device/bluetooth/bluetooth_local_gatt_service.cc b/device/bluetooth/bluetooth_local_gatt_service.cc
index b55403e..53b1d720 100644
--- a/device/bluetooth/bluetooth_local_gatt_service.cc
+++ b/device/bluetooth/bluetooth_local_gatt_service.cc
@@ -8,7 +8,7 @@
namespace device {
-#if !defined(OS_LINUX) || defined(LINUX_WITHOUT_DBUS)
+#if (!defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(LINUX_WITHOUT_DBUS)
// static
base::WeakPtr<BluetoothLocalGattService> BluetoothLocalGattService::Create(
BluetoothAdapter* adapter,
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc
index 6fdcf1a..de16011a 100644
--- a/net/disk_cache/disk_cache_perftest.cc
+++ b/net/disk_cache/disk_cache_perftest.cc
@@ -458,7 +458,7 @@
file_path = enumerator.Next()) {
ASSERT_TRUE(base::EvictFileFromSystemCache(file_path));
}
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID)
// And, cache directories, on platforms where the eviction utility supports
// this (currently Linux and Android only).
if (simple_cache_mode_) {
diff --git a/sandbox/linux/syscall_broker/broker_process_unittest.cc b/sandbox/linux/syscall_broker/broker_process_unittest.cc
index 1e7f06a2..e4a8b04 100644
--- a/sandbox/linux/syscall_broker/broker_process_unittest.cc
+++ b/sandbox/linux/syscall_broker/broker_process_unittest.cc
@@ -514,7 +514,7 @@
// expected.
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Flaky on Linux NG bots: https://crbug.com/595199.
#define MAYBE_RecvMsgDescriptorLeak DISABLED_RecvMsgDescriptorLeak
#else
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc
index 7bd90fd..0b563e6 100644
--- a/third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc
+++ b/third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc
@@ -244,7 +244,8 @@
TEST_F(WebRtcAudioRendererTest, VerifySinkParameters) {
SetupRenderer(kDefaultOutputDeviceId);
renderer_proxy_->Start();
-#if defined(OS_LINUX) || defined(OS_MAC) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_MAC) || \
+ defined(OS_FUCHSIA)
static const int kExpectedBufferSize = kHardwareSampleRate / 100;
#elif defined(OS_ANDROID)
static const int kExpectedBufferSize = 2 * kHardwareSampleRate / 100;
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
index cec2916..f41f004 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
+++ b/tools/traffic_annotation/auditor/traffic_annotation_auditor.cc
@@ -590,7 +590,7 @@
FILE_PATH_LITERAL("buildtools/win/gn.exe"),
#elif defined(OS_MAC)
FILE_PATH_LITERAL("buildtools/mac/gn"),
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
FILE_PATH_LITERAL("buildtools/linux64/gn"),
#else
// Fallback to using PATH to find gn.
diff --git a/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc b/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc
index b923b68..324e85fb 100644
--- a/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc
+++ b/tools/traffic_annotation/auditor/traffic_annotation_exporter.cc
@@ -86,7 +86,7 @@
: source_path_(source_path), modified_(false) {
all_supported_platforms_.push_back("linux");
all_supported_platforms_.push_back("windows");
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
current_platform_ = "linux";
#elif defined(OS_WIN)
current_platform_ = "windows";
diff --git a/ui/base/x/x11_shm_image_pool.cc b/ui/base/x/x11_shm_image_pool.cc
index 23c2428..42b102cd3 100644
--- a/ui/base/x/x11_shm_image_pool.cc
+++ b/ui/base/x/x11_shm_image_pool.cc
@@ -203,7 +203,7 @@
shmctl(state.shminfo_.shmid, IPC_RMID, nullptr);
return false;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// On Linux, a shmid can still be attached after IPC_RMID if otherwise
// kept alive. Detach before XShmAttach to prevent a memory leak in case
// the process dies.
@@ -213,7 +213,7 @@
if (!XShmAttach(display_, &state.shminfo_))
return false;
state.shmem_attached_to_server_ = true;
-#if !defined(OS_LINUX)
+#if !defined(OS_LINUX) && !defined(OS_CHROMEOS)
// The Linux-specific shmctl behavior above may not be portable, so we're
// forced to do IPC_RMID after the server has attached to the segment.
// XShmAttach is asynchronous, so we must also sync.
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index 12b4786..0c92673 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -6309,7 +6309,7 @@
const internal::TextRunList* run_list = GetHarfBuzzRunList();
ASSERT_EQ(1U, run_list->runs().size());
-#if defined(OS_LINUX) || defined(OS_APPLE)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_APPLE)
// On Linux and macOS, the flags should be found, so two glyphs result.
EXPECT_EQ(2u, run_list->runs()[0]->shape.glyph_count);
#elif defined(OS_ANDROID)
@@ -6459,7 +6459,7 @@
// this test assumes the font "Arial" doesn't provide a unicode glyph for a
// particular character, and that there is a system fallback font which does.
// TODO(msw): Fallback doesn't find a glyph on Linux and Android.
-#if !defined(OS_LINUX) && !defined(OS_ANDROID)
+#if !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
TEST_F(RenderTextTest, HarfBuzz_UnicodeFallback) {
RenderTextHarfBuzz* render_text = GetRenderText();
render_text->SetFontList(FontList("Arial, 12px"));
@@ -6470,7 +6470,7 @@
ASSERT_EQ(1U, run_list->size());
EXPECT_EQ(0U, run_list->runs()[0]->CountMissingGlyphs());
}
-#endif // !defined(OS_LINUX) && !defined(OS_ANDROID)
+#endif // !defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
// Ensure that the fallback fonts offered by GetFallbackFont() support glyphs
// for different languages.
@@ -7006,7 +7006,8 @@
render_text->SetText(ASCIIToUTF16("x"));
DrawVisualText();
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
+ defined(OS_FUCHSIA)
// On Linux, whether subpixel AA is supported is determined by the platform
// FontConfig. Force it into a particular style after computing runs. Other
// platforms use a known default FontRenderParams from a static local.
@@ -7020,7 +7021,8 @@
render_text->set_subpixel_rendering_suppressed(true);
DrawVisualText();
-#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FUCHSIA)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_ANDROID) || \
+ defined(OS_FUCHSIA)
// For Linux, runs shouldn't be re-calculated, and the suppression of the
// SUBPIXEL_RENDERING_RGB set above should now take effect. But, after
// checking, apply the override anyway to be explicit that it is suppressed.
@@ -7872,7 +7874,7 @@
ExpectTextLog(kUnselected);
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
TEST_F(RenderTextTest, StringSizeUpdatedWhenDeviceScaleFactorChanges) {
RenderText* render_text = GetRenderText();
render_text->SetText(ASCIIToUTF16("Test - 1"));
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc
index 5570113..88953b0 100644
--- a/ui/views/controls/button/label_button_unittest.cc
+++ b/ui/views/controls/button/label_button_unittest.cc
@@ -111,7 +111,8 @@
// NativeTheme and use a hardcoded black or (on Mac) have a NativeTheme that
// reliably returns black.
styled_normal_text_color_ = SK_ColorBLACK;
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
// The Linux theme provides a non-black highlight text color, but it's not
// used for styled buttons.
styled_highlight_text_color_ = styled_normal_text_color_ =
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc
index ebdfd8c..7c361f7b 100644
--- a/ui/views/controls/label_unittest.cc
+++ b/ui/views/controls/label_unittest.cc
@@ -244,7 +244,7 @@
}
TEST_F(LabelTest, FontPropertySymbol) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// On linux, the fonts are mocked with a custom FontConfig. The "Courier New"
// family name is mapped to Cousine-Regular.ttf (see: $build/test_fonts/*).
std::string font_name("Courier New");
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 2f4c4c90..4da194d 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -192,14 +192,14 @@
#endif
return ui::TextEditCommand::DELETE_BACKWARD;
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Only erase by line break on Linux and ChromeOS.
if (shift)
return ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE;
#endif
return ui::TextEditCommand::DELETE_WORD_BACKWARD;
case ui::VKEY_DELETE:
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Only erase by line break on Linux and ChromeOS.
if (shift && control)
return ui::TextEditCommand::DELETE_TO_END_OF_LINE;
@@ -267,7 +267,7 @@
// Control-modified key combination, but we cannot extend it to other platforms
// as Control has different meanings and behaviors.
// https://crrev.com/2580483002/#msg46
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
return flags & ui::EF_CONTROL_DOWN;
#else
return false;
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc
index 5311c69..f3919ee 100644
--- a/ui/views/controls/textfield/textfield_model_unittest.cc
+++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -186,7 +186,7 @@
// TODO(xji): temporarily disable in platform Win since the complex script
// characters turned into empty square due to font regression. So, not able
// to test 2 characters belong to the same grapheme.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
EXPECT_EQ(
base::WideToUTF16(L"\x0915\x093f\x0061\x0062\x0915\x094d\x092e\x094d"),
model.text());
@@ -198,7 +198,7 @@
// TODO(xji): temporarily disable in platform Win since the complex script
// characters turned into empty square due to font regression. So, not able
// to test 2 characters belong to the same grapheme.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
EXPECT_TRUE(model.Delete());
EXPECT_EQ(base::WideToUTF16(L"\x0061\x0062\x0915\x094d\x092e\x094d"),
model.text());
@@ -371,7 +371,7 @@
// TODO(xji): temporarily disable in platform Win since the complex script
// characters turned into empty square due to font regression. So, not able
// to test 2 characters belong to the same grapheme.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
model.Append(
base::WideToUTF16(L"abc\x05E9\x05BC\x05C1\x05B8\x05E0\x05B8"
L"def"));
@@ -955,7 +955,7 @@
// TODO(xji): temporarily disable in platform Win since the complex script
// characters and Chinese characters are turned into empty square due to font
// regression.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
TEST_F(TextfieldModelTest, SelectWordTest_MixScripts) {
TextfieldModel model(nullptr);
std::vector<WordAndCursor> word_and_cursor;
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index afbbc32..5816163 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -981,7 +981,7 @@
EXPECT_STR_EQ("TexT!1!1", textfield_->GetText());
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Control key shouldn't generate a printable character on Linux.
TEST_F(TextfieldTest, KeyTestControlModifier) {
InitTextfield();
@@ -1333,7 +1333,7 @@
SendWordEvent(ui::VKEY_LEFT, shift);
shift = true;
SendWordEvent(ui::VKEY_BACK, shift);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
EXPECT_STR_EQ("three ", textfield_->GetText());
#else
EXPECT_STR_EQ("one three ", textfield_->GetText());
@@ -1354,7 +1354,7 @@
SendWordEvent(ui::VKEY_RIGHT, shift);
shift = true;
SendWordEvent(ui::VKEY_DELETE, shift);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
EXPECT_STR_EQ(" two", textfield_->GetText());
#elif defined(OS_WIN)
EXPECT_STR_EQ("two four", textfield_->GetText());
diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc
index fcbafdf8..175c7cb 100644
--- a/ui/views/examples/widget_example.cc
+++ b/ui/views/examples/widget_example.cc
@@ -80,7 +80,7 @@
DIALOG);
BuildButton(container, GetStringUTF16(IDS_WIDGET_MODAL_BUTTON_LABEL),
MODAL_DIALOG);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Windows does not support TYPE_CONTROL top-level widgets.
BuildButton(container, GetStringUTF16(IDS_WIDGET_CHILD_WIDGET_BUTTON_LABEL),
CHILD);
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc
index 07a1aff0..155fb12 100644
--- a/ui/views/style/platform_style.cc
+++ b/ui/views/style/platform_style.cc
@@ -74,7 +74,8 @@
#endif // OS_APPLE
-#if !BUILDFLAG(ENABLE_DESKTOP_AURA) || !defined(OS_LINUX)
+#if !BUILDFLAG(ENABLE_DESKTOP_AURA) || \
+ (!defined(OS_LINUX) && !defined(OS_CHROMEOS))
// static
std::unique_ptr<Border> PlatformStyle::CreateThemedLabelButtonBorder(
LabelButton* button) {
diff --git a/ui/views/test/widget_test_aura.cc b/ui/views/test/widget_test_aura.cc
index e431eef..117ac6e9 100644
--- a/ui/views/test/widget_test_aura.cc
+++ b/ui/views/test/widget_test_aura.cc
@@ -13,7 +13,8 @@
#include "ui/views/widget/widget.h"
#include "ui/wm/core/shadow_controller.h"
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
#endif
@@ -72,7 +73,8 @@
std::vector<aura::Window*> GetAllTopLevelWindows() {
std::vector<aura::Window*> roots;
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
roots = DesktopWindowTreeHostLinux::GetAllOpenWindows();
#elif defined(OS_WIN)
{
diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc
index a6d428a..f856122 100644
--- a/ui/views/views_delegate.cc
+++ b/ui/views/views_delegate.cc
@@ -85,7 +85,8 @@
bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
return false;
}
-#elif defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#elif BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
return nullptr;
}
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h
index e3706dcc..177271c 100644
--- a/ui/views/views_delegate.h
+++ b/ui/views/views_delegate.h
@@ -133,7 +133,8 @@
// Returns true if the window passed in is in the Windows 8 metro
// environment.
virtual bool IsWindowInMetro(gfx::NativeWindow window) const;
-#elif defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#elif BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
virtual gfx::ImageSkia* GetDefaultWindowIcon() const;
#endif
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
index 71e7bbc..2192dab 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -69,7 +69,7 @@
// On Linux we test this with popup windows because the WM may ignore the size
// suggestion for normal windows.
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP);
#else
Widget::InitParams init_params =
diff --git a/ui/views/widget/desktop_aura/desktop_screen_ozone.cc b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
index 05fc9cde..1f00883 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_ozone.cc
@@ -26,7 +26,7 @@
// To avoid multiple definitions when use_x11 && use_ozone is true, disable this
// factory method for OS_LINUX as Linux has a factory method that decides what
// screen to use based on IsUsingOzonePlatform feature flag.
-#if !defined(OS_LINUX)
+#if !defined(OS_LINUX) && !defined(OS_CHROMEOS)
display::Screen* CreateDesktopScreen() {
return new DesktopScreenOzone();
}
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index a5dedf7..254be7a 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -64,7 +64,8 @@
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
#endif
-#if BUILDFLAG(ENABLE_DESKTOP_AURA) && defined(OS_LINUX)
+#if BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
#endif
@@ -1073,7 +1074,8 @@
// Widget, public:
namespace {
-#if BUILDFLAG(ENABLE_DESKTOP_AURA) && (defined(OS_WIN) || defined(OS_LINUX))
+#if BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS))
void CloseWindow(aura::Window* window) {
if (window) {
Widget* widget = Widget::GetWidgetForNativeView(window);
@@ -1103,13 +1105,15 @@
EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, 0);
#endif
-#if BUILDFLAG(ENABLE_DESKTOP_AURA) && defined(OS_LINUX)
+#if BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
DesktopWindowTreeHostLinux::CleanUpWindowList(CloseWindow);
#endif
}
const ui::NativeTheme* Widget::GetNativeTheme() const {
-#if BUILDFLAG(ENABLE_DESKTOP_AURA) && defined(OS_LINUX)
+#if BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+ (defined(OS_LINUX) || defined(OS_CHROMEOS))
const LinuxUI* linux_ui = LinuxUI::instance();
if (linux_ui) {
ui::NativeTheme* native_theme =
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
index 2a1de563..c495bbb 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -1242,7 +1242,8 @@
}
#endif
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
// Tests that when a desktop native widget has modal transient child, it should
// avoid restore focused view itself as the modal transient child window will do
// that, thus avoids having multiple focused view visually (crbug.com/727641).
@@ -1289,7 +1290,8 @@
EXPECT_TRUE(dialog_textfield->HasFocus());
EXPECT_FALSE(textfield->HasFocus());
}
-#endif // defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) &&
+ // BUILDFLAG(ENABLE_DESKTOP_AURA)
namespace {
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 15570f9..b4061bd 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -1022,7 +1022,7 @@
native_widget->GetWindowPlacement(&restored_bounds, &show_state);
EXPECT_EQ(expected_bounds, restored_bounds);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Non-desktop/Ash widgets start off in "default" until a Restore().
EXPECT_EQ(ui::SHOW_STATE_DEFAULT, show_state);
widget->Restore();
diff --git a/ui/views/window/dialog_delegate.cc b/ui/views/window/dialog_delegate.cc
index 0d0347e..8b75d5e 100644
--- a/ui/views/window/dialog_delegate.cc
+++ b/ui/views/window/dialog_delegate.cc
@@ -62,7 +62,8 @@
// static
bool DialogDelegate::CanSupportCustomFrame(gfx::NativeView parent) {
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
// The new style doesn't support unparented dialogs on Linux desktop.
return parent != nullptr;
#else
diff --git a/ui/views/window/frame_background.cc b/ui/views/window/frame_background.cc
index 6e8de530..50e11d3 100644
--- a/ui/views/window/frame_background.cc
+++ b/ui/views/window/frame_background.cc
@@ -99,7 +99,8 @@
const View* view) const {
// Fill the top with the frame color first so we have a constant background
// for areas not covered by the theme image.
-#if defined(OS_LINUX) && BUILDFLAG(ENABLE_DESKTOP_AURA)
+#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
auto* native_theme = view->GetNativeTheme();
ui::NativeTheme::ExtraParams params;
params.frame_top_area.use_custom_frame = use_custom_frame_;