Commit 27fdaae4 authored by James Cook's avatar James Cook Committed by Commit Bot

Lacros: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_CHROMEOS_ASH)

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.

I added a couple TODOs for lacros work items that need followup and
deleted an unused include.

Bug: 1052397
Change-Id: I726fc10295074dbc9cff4501b0d67ea2b4f7de54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536798Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827476}
parent 8c43c962
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "base/task_runner.h" #include "base/task_runner.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h"
...@@ -1462,7 +1463,8 @@ bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile( ...@@ -1462,7 +1463,8 @@ bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferreredForFile(
// On Android, always prefer opening with an external app. On ChromeOS, there // On Android, always prefer opening with an external app. On ChromeOS, there
// are no external apps so just allow all opens to be handled by the "System." // are no external apps so just allow all opens to be handled by the "System."
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PLUGINS) #if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
BUILDFLAG(ENABLE_PLUGINS)
// TODO(asanka): Consider other file types and MIME types. // TODO(asanka): Consider other file types and MIME types.
// http://crbug.com/323561 // http://crbug.com/323561
if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) || if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf")) ||
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "base/test/test_file_util.h" #include "base/test/test_file_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
...@@ -392,7 +393,7 @@ bool IsDownloadExternallyRemoved(DownloadItem* item) { ...@@ -392,7 +393,7 @@ bool IsDownloadExternallyRemoved(DownloadItem* item) {
return item->GetFileExternallyRemoved(); return item->GetFileExternallyRemoved();
} }
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
// Called when a download starts. Marks the download as hidden. // Called when a download starts. Marks the download as hidden.
void SetHiddenDownloadCallback(DownloadItem* item, void SetHiddenDownloadCallback(DownloadItem* item,
download::DownloadInterruptReason reason) { download::DownloadInterruptReason reason) {
...@@ -2719,7 +2720,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTestWithHistogramTester, ...@@ -2719,7 +2720,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTestWithHistogramTester,
} }
// Times out often on debug ChromeOS because test is slow. // Times out often on debug ChromeOS because test is slow.
#if defined(OS_CHROMEOS) && (!defined(NDEBUG) || defined(MEMORY_SANITIZER)) #if BUILDFLAG(IS_CHROMEOS_ASH) && \
(!defined(NDEBUG) || defined(MEMORY_SANITIZER))
#define MAYBE_SaveLargeImage DISABLED_SaveLargeImage #define MAYBE_SaveLargeImage DISABLED_SaveLargeImage
#elif defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) #elif defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX)
// Flaking on Windows, macOS, and Linux. https://crbug.com/1141263 // Flaking on Windows, macOS, and Linux. https://crbug.com/1141263
...@@ -3791,7 +3793,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_PauseResumeCancel) { ...@@ -3791,7 +3793,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_PauseResumeCancel) {
// quarantining files on Mac because it is not a cocoa app. // quarantining files on Mac because it is not a cocoa app.
// TODO(benjhayden) test the equivalents on other platforms. // TODO(benjhayden) test the equivalents on other platforms.
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) #if (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
defined(ARCH_CPU_ARM_FAMILY)
// Timing out on ARM linux: http://crbug.com/238459 // Timing out on ARM linux: http://crbug.com/238459
#define MAYBE_DownloadTest_PercentComplete DISABLED_DownloadTest_PercentComplete #define MAYBE_DownloadTest_PercentComplete DISABLED_DownloadTest_PercentComplete
#else #else
...@@ -4721,7 +4724,7 @@ IN_PROC_BROWSER_TEST_F( ...@@ -4721,7 +4724,7 @@ IN_PROC_BROWSER_TEST_F(
// The rest of these tests rely on the download shelf, which ChromeOS doesn't // The rest of these tests rely on the download shelf, which ChromeOS doesn't
// use. // use.
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
// Test that the download shelf is shown by starting a download. // Test that the download shelf is shown by starting a download.
IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadAndWait) { IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadAndWait) {
embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory()); embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
...@@ -4988,4 +4991,4 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxDenyInstallClosesShelf) { ...@@ -4988,4 +4991,4 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxDenyInstallClosesShelf) {
// Download shelf should close. // Download shelf should close.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
} }
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/download_dir_util.h" #include "chrome/browser/download/download_dir_util.h"
#include "chrome/browser/download/download_prefs.h" #include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/policy/policy_path_parser.h" #include "chrome/browser/policy/policy_path_parser.h"
...@@ -37,9 +38,11 @@ bool DownloadDirPolicyHandler::CheckPolicySettings( ...@@ -37,9 +38,11 @@ bool DownloadDirPolicyHandler::CheckPolicySettings(
if (!CheckAndGetValue(policies, errors, &value)) if (!CheckAndGetValue(policies, errors, &value))
return false; return false;
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// Download directory can only be set as a user policy. If it is set through // Download directory can only be set as a user policy. If it is set through
// platform policy for a chromeos=1 build, ignore it. // platform policy for a chromeos=1 build, ignore it.
// TODO(https://crbug.com/1148846): Sort out download directory policy for
// lacros.
if (value && if (value &&
policies.Get(policy_name())->scope != policy::POLICY_SCOPE_USER) { policies.Get(policy_name())->scope != policy::POLICY_SCOPE_USER) {
errors->AddError(policy_name(), IDS_POLICY_SCOPE_ERROR); errors->AddError(policy_name(), IDS_POLICY_SCOPE_ERROR);
...@@ -76,7 +79,9 @@ void DownloadDirPolicyHandler::ApplyPolicySettingsWithParameters( ...@@ -76,7 +79,9 @@ void DownloadDirPolicyHandler::ApplyPolicySettingsWithParameters(
// Otherwise, it would enable a user to bypass the mandatory policy. // Otherwise, it would enable a user to bypass the mandatory policy.
if (policies.Get(policy_name())->level == policy::POLICY_LEVEL_MANDATORY) { if (policies.Get(policy_name())->level == policy::POLICY_LEVEL_MANDATORY) {
prefs->SetBoolean(prefs::kPromptForDownload, false); prefs->SetBoolean(prefs::kPromptForDownload, false);
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// TODO(https://crbug.com/1148846): Sort out download directory policy for
// lacros.
if (download_dir_util::DownloadToDrive(string_value, parameters)) { if (download_dir_util::DownloadToDrive(string_value, parameters)) {
prefs->SetBoolean(drive::prefs::kDisableDrive, false); prefs->SetBoolean(drive::prefs::kDisableDrive, false);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/download_dir_util.h" #include "chrome/browser/download/download_dir_util.h"
#include "chrome/browser/download/download_prefs.h" #include "chrome/browser/download/download_prefs.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -27,7 +28,7 @@ namespace { ...@@ -27,7 +28,7 @@ namespace {
const char* kUserIDHash = "deadbeef"; const char* kUserIDHash = "deadbeef";
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
const char* kRelativeToDriveRoot = "/home/"; const char* kRelativeToDriveRoot = "/home/";
#endif #endif
...@@ -54,7 +55,7 @@ class DownloadDirPolicyHandlerTest ...@@ -54,7 +55,7 @@ class DownloadDirPolicyHandlerTest
scoped_refptr<policy::ConfigurationPolicyPrefStore> recommended_store_; scoped_refptr<policy::ConfigurationPolicyPrefStore> recommended_store_;
}; };
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) { TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) {
policy::PolicyMap policy; policy::PolicyMap policy;
EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
...@@ -74,7 +75,7 @@ TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) { ...@@ -74,7 +75,7 @@ TEST_F(DownloadDirPolicyHandlerTest, SetDownloadDirectory) {
} }
#endif #endif
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(DownloadDirPolicyHandlerTest, SetDownloadToDrive) { TEST_F(DownloadDirPolicyHandlerTest, SetDownloadToDrive) {
EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL)); EXPECT_FALSE(store_->GetValue(prefs::kPromptForDownload, NULL));
......
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
#include "chrome/browser/policy/policy_path_parser.h" #include "chrome/browser/policy/policy_path_parser.h"
#include "components/policy/core/browser/configuration_policy_handler_parameters.h" #include "components/policy/core/browser/configuration_policy_handler_parameters.h"
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
namespace { namespace {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// Drive root folder relative to its mount point. // Drive root folder relative to its mount point.
const base::FilePath::CharType* kRootRelativeToDriveMount = const base::FilePath::CharType* kRootRelativeToDriveMount =
FILE_PATH_LITERAL("root"); FILE_PATH_LITERAL("root");
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
} // namespace } // namespace
namespace download_dir_util { namespace download_dir_util {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
const char kDriveNamePolicyVariableName[] = "${google_drive}"; const char kDriveNamePolicyVariableName[] = "${google_drive}";
bool DownloadToDrive(const base::FilePath::StringType& string_value, bool DownloadToDrive(const base::FilePath::StringType& string_value,
...@@ -54,12 +54,12 @@ bool ExpandDrivePolicyVariable(Profile* profile, ...@@ -54,12 +54,12 @@ bool ExpandDrivePolicyVariable(Profile* profile,
position, strlen(kDriveNamePolicyVariableName), google_drive_root)); position, strlen(kDriveNamePolicyVariableName), google_drive_root));
return true; return true;
} }
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
base::FilePath::StringType ExpandDownloadDirectoryPath( base::FilePath::StringType ExpandDownloadDirectoryPath(
const base::FilePath::StringType& string_value, const base::FilePath::StringType& string_value,
const policy::PolicyHandlerParameters& parameters) { const policy::PolicyHandlerParameters& parameters) {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
return string_value; return string_value;
#else #else
return policy::path_parser::ExpandPathVariables(string_value); return policy::path_parser::ExpandPathVariables(string_value);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DIR_UTIL_H_ #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_DIR_UTIL_H_
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "build/chromeos_buildflags.h"
class Profile; class Profile;
...@@ -15,7 +16,7 @@ struct PolicyHandlerParameters; ...@@ -15,7 +16,7 @@ struct PolicyHandlerParameters;
namespace download_dir_util { namespace download_dir_util {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
extern const char kDriveNamePolicyVariableName[]; extern const char kDriveNamePolicyVariableName[];
// Returns whether |string_value| points to a directory in Drive or not. // Returns whether |string_value| points to a directory in Drive or not.
...@@ -28,7 +29,7 @@ bool DownloadToDrive(const base::FilePath::StringType& string_value, ...@@ -28,7 +29,7 @@ bool DownloadToDrive(const base::FilePath::StringType& string_value,
bool ExpandDrivePolicyVariable(Profile* profile, bool ExpandDrivePolicyVariable(Profile* profile,
const base::FilePath& old_path, const base::FilePath& old_path,
base::FilePath* new_path); base::FilePath* new_path);
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Expands path variables in the download directory path |string_value|. // Expands path variables in the download directory path |string_value|.
base::FilePath::StringType ExpandDownloadDirectoryPath( base::FilePath::StringType ExpandDownloadDirectoryPath(
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_core_service_factory.h" #include "chrome/browser/download/download_core_service_factory.h"
#include "chrome/browser/download/download_core_service_impl.h" #include "chrome/browser/download/download_core_service_impl.h"
...@@ -46,12 +47,12 @@ ...@@ -46,12 +47,12 @@
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/save_page_type.h" #include "content/public/browser/save_page_type.h"
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_util.h" #include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chromeos/dbus/cros_disks_client.h" #include "chromeos/dbus/cros_disks_client.h"
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/browser/ui/pdf/adobe_reader_info_win.h" #include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
...@@ -133,7 +134,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { ...@@ -133,7 +134,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
PrefService* prefs = profile->GetPrefs(); PrefService* prefs = profile->GetPrefs();
pref_change_registrar_.Init(prefs); pref_change_registrar_.Init(prefs);
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
// On Chrome OS, the default download directory is different for each profile. // On Chrome OS, the default download directory is different for each profile.
// If the profile-unaware default path (from GetDefaultDownloadDirectory()) // If the profile-unaware default path (from GetDefaultDownloadDirectory())
// is set (this happens during the initial preference registration in static // is set (this happens during the initial preference registration in static
...@@ -170,7 +171,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { ...@@ -170,7 +171,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
content::DownloadManager::GetTaskRunner()->PostTask( content::DownloadManager::GetTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(base::IgnoreResult(&base::CreateDirectory), FROM_HERE, base::BindOnce(base::IgnoreResult(&base::CreateDirectory),
GetDefaultDownloadDirectoryForProfile())); GetDefaultDownloadDirectoryForProfile()));
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \ #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
defined(OS_MAC) defined(OS_MAC)
...@@ -328,7 +329,7 @@ void DownloadPrefs::RegisterProfilePrefs( ...@@ -328,7 +329,7 @@ void DownloadPrefs::RegisterProfilePrefs(
} }
base::FilePath DownloadPrefs::GetDefaultDownloadDirectoryForProfile() const { base::FilePath DownloadPrefs::GetDefaultDownloadDirectoryForProfile() const {
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
return file_manager::util::GetDownloadsFolderForProfile(profile_); return file_manager::util::GetDownloadsFolderForProfile(profile_);
#else #else
return GetDefaultDownloadDirectory(); return GetDefaultDownloadDirectory();
...@@ -549,7 +550,8 @@ void DownloadPrefs::SaveAutoOpenState() { ...@@ -549,7 +550,8 @@ void DownloadPrefs::SaveAutoOpenState() {
base::FilePath DownloadPrefs::SanitizeDownloadTargetPath( base::FilePath DownloadPrefs::SanitizeDownloadTargetPath(
const base::FilePath& path) const { const base::FilePath& path) const {
#if defined(OS_CHROMEOS) // TODO(https://crbug.com/1148848): Sort out path sanitization for Lacros.
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (skip_sanitize_download_target_path_for_testing_) if (skip_sanitize_download_target_path_for_testing_)
return path; return path;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/download_prompt_status.h" #include "chrome/browser/download/download_prompt_status.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
...@@ -18,12 +19,12 @@ ...@@ -18,12 +19,12 @@
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/chromeos/drive/drive_integration_service.h" #include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "components/drive/drive_pref_names.h" #include "components/drive/drive_pref_names.h"
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
using safe_browsing::FileTypePolicies; using safe_browsing::FileTypePolicies;
...@@ -361,7 +362,7 @@ TEST(DownloadPrefsTest, DefaultPathChangedToInvalidValue) { ...@@ -361,7 +362,7 @@ TEST(DownloadPrefsTest, DefaultPathChangedToInvalidValue) {
download_prefs.GetDefaultDownloadDirectory()); download_prefs.GetDefaultDownloadDirectory());
} }
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
void ExpectValidDownloadDir(Profile* profile, void ExpectValidDownloadDir(Profile* profile,
DownloadPrefs* prefs, DownloadPrefs* prefs,
base::FilePath path) { base::FilePath path) {
...@@ -447,7 +448,7 @@ TEST(DownloadPrefsTest, DownloadDirSanitization) { ...@@ -447,7 +448,7 @@ TEST(DownloadPrefsTest, DownloadDirSanitization) {
EXPECT_EQ(prefs2.DownloadPath(), default_dir2); EXPECT_EQ(prefs2.DownloadPath(), default_dir2);
} }
} }
#endif // OS_CHROMEOS #endif // BUILDFLAG(IS_CHROMEOS_ASH)
#ifdef OS_ANDROID #ifdef OS_ANDROID
TEST(DownloadPrefsTest, DownloadLaterPrefs) { TEST(DownloadPrefsTest, DownloadLaterPrefs) {
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/background_fetch/background_fetch_download_client.h" #include "chrome/browser/background_fetch/background_fetch_download_client.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_download_client.h" #include "chrome/browser/chromeos/plugin_vm/plugin_vm_image_download_client.h"
#include "chrome/browser/download/deferred_client_wrapper.h" #include "chrome/browser/download/deferred_client_wrapper.h"
...@@ -59,12 +60,12 @@ std::unique_ptr<download::Client> CreateBackgroundFetchDownloadClient( ...@@ -59,12 +60,12 @@ std::unique_ptr<download::Client> CreateBackgroundFetchDownloadClient(
return std::make_unique<BackgroundFetchDownloadClient>(profile); return std::make_unique<BackgroundFetchDownloadClient>(profile);
} }
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
std::unique_ptr<download::Client> CreatePluginVmImageDownloadClient( std::unique_ptr<download::Client> CreatePluginVmImageDownloadClient(
Profile* profile) { Profile* profile) {
return std::make_unique<plugin_vm::PluginVmImageDownloadClient>(profile); return std::make_unique<plugin_vm::PluginVmImageDownloadClient>(profile);
} }
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Called on profile created to retrieve the BlobStorageContextGetter. // Called on profile created to retrieve the BlobStorageContextGetter.
void DownloadOnProfileCreated(download::BlobContextGetterCallback callback, void DownloadOnProfileCreated(download::BlobContextGetterCallback callback,
...@@ -138,14 +139,14 @@ std::unique_ptr<KeyedService> DownloadServiceFactory::BuildServiceInstanceFor( ...@@ -138,14 +139,14 @@ std::unique_ptr<KeyedService> DownloadServiceFactory::BuildServiceInstanceFor(
std::make_unique<download::DeferredClientWrapper>( std::make_unique<download::DeferredClientWrapper>(
base::BindOnce(&CreateBackgroundFetchDownloadClient), key))); base::BindOnce(&CreateBackgroundFetchDownloadClient), key)));
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (!key->IsOffTheRecord()) { if (!key->IsOffTheRecord()) {
clients->insert(std::make_pair( clients->insert(std::make_pair(
download::DownloadClient::PLUGIN_VM_IMAGE, download::DownloadClient::PLUGIN_VM_IMAGE,
std::make_unique<download::DeferredClientWrapper>( std::make_unique<download::DeferredClientWrapper>(
base::BindOnce(&CreatePluginVmImageDownloadClient), key))); base::BindOnce(&CreatePluginVmImageDownloadClient), key)));
} }
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Build in memory download service for incognito profile. // Build in memory download service for incognito profile.
if (key->IsOffTheRecord() && if (key->IsOffTheRecord() &&
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
namespace { namespace {
...@@ -128,7 +129,7 @@ void DownloadStatusUpdater::OnDownloadUpdated(content::DownloadManager* manager, ...@@ -128,7 +129,7 @@ void DownloadStatusUpdater::OnDownloadUpdated(content::DownloadManager* manager,
UpdateAppIconDownloadProgress(item); UpdateAppIconDownloadProgress(item);
} }
#if defined(OS_ANDROID) || defined(OS_CHROMEOS) #if defined(OS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
void DownloadStatusUpdater::UpdateAppIconDownloadProgress( void DownloadStatusUpdater::UpdateAppIconDownloadProgress(
download::DownloadItem* download) { download::DownloadItem* download) {
// TODO(avi): Implement for Android? // TODO(avi): Implement for Android?
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/download_shelf.h"
...@@ -30,9 +31,9 @@ ...@@ -30,9 +31,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#endif #endif
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/download/notification/download_notification_manager.h" #include "chrome/browser/download/notification/download_notification_manager.h"
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
namespace { namespace {
...@@ -118,14 +119,14 @@ DownloadUIController::DownloadUIController(content::DownloadManager* manager, ...@@ -118,14 +119,14 @@ DownloadUIController::DownloadUIController(content::DownloadManager* manager,
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
if (!delegate_) if (!delegate_)
delegate_.reset(new AndroidUIControllerDelegate()); delegate_.reset(new AndroidUIControllerDelegate());
#elif defined(OS_CHROMEOS) #elif BUILDFLAG(IS_CHROMEOS_ASH)
if (!delegate_) { if (!delegate_) {
// The Profile is guaranteed to be valid since DownloadUIController is owned // The Profile is guaranteed to be valid since DownloadUIController is owned
// by DownloadService, which in turn is a profile keyed service. // by DownloadService, which in turn is a profile keyed service.
delegate_.reset(new DownloadNotificationManager( delegate_.reset(new DownloadNotificationManager(
Profile::FromBrowserContext(manager->GetBrowserContext()))); Profile::FromBrowserContext(manager->GetBrowserContext())));
} }
#else // defined(OS_CHROMEOS) #else // BUILDFLAG(IS_CHROMEOS_ASH)
if (!delegate_) { if (!delegate_) {
delegate_.reset(new DownloadShelfUIControllerDelegate( delegate_.reset(new DownloadShelfUIControllerDelegate(
Profile::FromBrowserContext(manager->GetBrowserContext()))); Profile::FromBrowserContext(manager->GetBrowserContext())));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/download_commands.h" #include "chrome/browser/download/download_commands.h"
#include "chrome/browser/download/offline_item_utils.h" #include "chrome/browser/download/offline_item_utils.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h" #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
...@@ -26,9 +27,9 @@ ...@@ -26,9 +27,9 @@
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#endif #endif
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/chromeos/note_taking_helper.h" #include "chrome/browser/chromeos/note_taking_helper.h"
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
using base::TimeDelta; using base::TimeDelta;
using download::DownloadItem; using download::DownloadItem;
...@@ -612,12 +613,12 @@ void DownloadUIModel::ExecuteCommand(DownloadCommands* download_commands, ...@@ -612,12 +613,12 @@ void DownloadUIModel::ExecuteCommand(DownloadCommands* download_commands,
download_commands->CopyFileAsImageToClipboard(); download_commands->CopyFileAsImageToClipboard();
break; break;
case DownloadCommands::ANNOTATE: case DownloadCommands::ANNOTATE:
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
if (HasSupportedImageMimeType()) { if (HasSupportedImageMimeType()) {
chromeos::NoteTakingHelper::Get()->LaunchAppForNewNote( chromeos::NoteTakingHelper::Get()->LaunchAppForNewNote(
profile(), GetTargetFilePath()); profile(), GetTargetFilePath());
} }
#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(IS_CHROMEOS_ASH)
break; break;
case DownloadCommands::DEEP_SCAN: case DownloadCommands::DEEP_SCAN:
break; break;
......
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_CHROMEOS)
#include "content/public/browser/download_item_utils.h"
#endif
void DragDownloadItem(const download::DownloadItem* download, void DragDownloadItem(const download::DownloadItem* download,
const gfx::Image* icon, const gfx::Image* icon,
gfx::NativeView view) { gfx::NativeView view) {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_prefs.h" #include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/platform_util.h" #include "chrome/browser/platform_util.h"
...@@ -85,7 +86,7 @@ void AddWebBundleFileFileTypeInfo( ...@@ -85,7 +86,7 @@ void AddWebBundleFileFileTypeInfo(
} }
// Chrome OS doesn't support HTML-Complete. crbug.com/154823 // Chrome OS doesn't support HTML-Complete. crbug.com/154823
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
// Adds "Webpage, Complete" type to FileTypeInfo. // Adds "Webpage, Complete" type to FileTypeInfo.
void AddCompleteFileTypeInfo( void AddCompleteFileTypeInfo(
ui::SelectFileDialog::FileTypeInfo* file_type_info, ui::SelectFileDialog::FileTypeInfo* file_type_info,
...@@ -100,7 +101,7 @@ void AddCompleteFileTypeInfo( ...@@ -100,7 +101,7 @@ void AddCompleteFileTypeInfo(
extensions.push_back(extra_extension); extensions.push_back(extra_extension);
file_type_info->extensions.push_back(extensions); file_type_info->extensions.push_back(extensions);
} }
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
// Checks whether this is a blocked page (e.g., when a child user is accessing // Checks whether this is a blocked page (e.g., when a child user is accessing
// a mature site). // a mature site).
...@@ -132,7 +133,7 @@ bool SavePackageFilePicker::ShouldSaveAsOnlyHTML( ...@@ -132,7 +133,7 @@ bool SavePackageFilePicker::ShouldSaveAsOnlyHTML(
} }
bool SavePackageFilePicker::ShouldSaveAsMHTML() const { bool SavePackageFilePicker::ShouldSaveAsMHTML() const {
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
if (!base::CommandLine::ForCurrentProcess()->HasSwitch( if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSavePageAsMHTML)) switches::kSavePageAsMHTML))
return false; return false;
...@@ -191,10 +192,10 @@ SavePackageFilePicker::SavePackageFilePicker( ...@@ -191,10 +192,10 @@ SavePackageFilePicker::SavePackageFilePicker(
} }
} }
#if !defined(OS_CHROMEOS) #if !BUILDFLAG(IS_CHROMEOS_ASH)
AddCompleteFileTypeInfo(&file_type_info, extra_extension); AddCompleteFileTypeInfo(&file_type_info, extra_extension);
save_types_.push_back(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); save_types_.push_back(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML);
#endif #endif // BUILDFLAG(IS_CHROMEOS_ASH)
file_type_info.include_all_files = false; file_type_info.include_all_files = false;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "base/test/test_file_util.h" #include "base/test/test_file_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_core_service.h" #include "chrome/browser/download/download_core_service.h"
...@@ -793,7 +794,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SavePageAsMHTML) { ...@@ -793,7 +794,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SavePageAsMHTML) {
} }
// On ChromeOS, the default should be MHTML. // On ChromeOS, the default should be MHTML.
#if defined(OS_CHROMEOS) #if BUILDFLAG(IS_CHROMEOS_ASH)
ASSERT_EQ("mhtml", ASSERT_EQ("mhtml",
select_file_dialog_factory->GetLastDialog()->default_extension()); select_file_dialog_factory->GetLastDialog()->default_extension());
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment