Commit 4e6ac1e9 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[iOS CBCM] Enable CBCM at 100% stable

Enables CBCM by default on Chrome branded build (the
--enable-chrome-browser-cloud-management command-line switch is still
needed for Chromium builds).

Because the logic for checking whether CBCM is enabled or not is now
back to being the same on all platforms, this change also removes the
IsEnabled delegate method and brings the check back to the core
CBCMController class. As a result, the command switch declaration was
moved to components so it can be shared between platforms.

Bug: 1111435, 1097161
Change-Id: I5f15f06885b4deb3974616667273706931df6ad4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522981
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826315}
parent f554bc80
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "components/enterprise/browser/controller/browser_dm_token_storage.h" #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h" #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
#include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h" #include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h"
#include "components/enterprise/browser/enterprise_switches.h"
#include "components/enterprise/browser/reporting/common_pref_names.h" #include "components/enterprise/browser/reporting/common_pref_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h" #include "chrome/test/base/testing_profile_manager.h"
#include "components/enterprise/browser/enterprise_switches.h"
#include "components/enterprise/common/proto/connectors.pb.h" #include "components/enterprise/common/proto/connectors.pb.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h" #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "components/policy/core/common/cloud/realtime_reporting_job_configuration.h" #include "components/policy/core/common/cloud/realtime_reporting_job_configuration.h"
......
...@@ -187,15 +187,6 @@ void ChromeBrowserCloudManagementControllerDesktop:: ...@@ -187,15 +187,6 @@ void ChromeBrowserCloudManagementControllerDesktop::
BrowserDMTokenStorage::SetDelegate(std::move(storage_delegate)); BrowserDMTokenStorage::SetDelegate(std::move(storage_delegate));
} }
bool ChromeBrowserCloudManagementControllerDesktop::IsEnabled() {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return true;
#else
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableChromeBrowserCloudManagement);
#endif
}
int ChromeBrowserCloudManagementControllerDesktop::GetUserDataDirKey() { int ChromeBrowserCloudManagementControllerDesktop::GetUserDataDirKey() {
return chrome::DIR_USER_DATA; return chrome::DIR_USER_DATA;
} }
......
...@@ -43,7 +43,6 @@ class ChromeBrowserCloudManagementControllerDesktop ...@@ -43,7 +43,6 @@ class ChromeBrowserCloudManagementControllerDesktop
// ChromeBrowserCloudManagementController::Delegate implementation. // ChromeBrowserCloudManagementController::Delegate implementation.
void SetDMTokenStorageDelegate() override; void SetDMTokenStorageDelegate() override;
bool IsEnabled() override;
int GetUserDataDirKey() override; int GetUserDataDirKey() override;
base::FilePath GetExternalPolicyPath() override; base::FilePath GetExternalPolicyPath() override;
NetworkConnectionTrackerGetter CreateNetworkConnectionTrackerGetter() NetworkConnectionTrackerGetter CreateNetworkConnectionTrackerGetter()
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "components/enterprise/browser/controller/browser_dm_token_storage.h" #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h" #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
#include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h" #include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h"
#include "components/enterprise/browser/enterprise_switches.h"
#include "components/policy/core/common/cloud/chrome_browser_cloud_management_metrics.h" #include "components/policy/core/common/cloud/chrome_browser_cloud_management_metrics.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/device_management_service.h" #include "components/policy/core/common/cloud/device_management_service.h"
......
...@@ -800,11 +800,6 @@ const char kGuest[] = "guest"; ...@@ -800,11 +800,6 @@ const char kGuest[] = "guest";
#endif #endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
// Enables Machine level user cloud policy on Chromium build. This policy is
// always enabled on the branded builds.
const char kEnableChromeBrowserCloudManagement[] =
"enable-chrome-browser-cloud-management";
// Uses the system default printer as the initially selected destination in // Uses the system default printer as the initially selected destination in
// print preview, instead of the most recently used destination. // print preview, instead of the most recently used destination.
const char kUseSystemDefaultPrinter[] = "use-system-default-printer"; const char kUseSystemDefaultPrinter[] = "use-system-default-printer";
......
...@@ -255,8 +255,6 @@ extern const char kGuest[]; ...@@ -255,8 +255,6 @@ extern const char kGuest[];
#endif #endif
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
// Only has an effect in branded builds.
extern const char kEnableChromeBrowserCloudManagement[];
extern const char kUseSystemDefaultPrinter[]; extern const char kUseSystemDefaultPrinter[];
#endif #endif
......
...@@ -8,6 +8,8 @@ static_library("enterprise") { ...@@ -8,6 +8,8 @@ static_library("enterprise") {
"browser/controller/browser_dm_token_storage.h", "browser/controller/browser_dm_token_storage.h",
"browser/controller/chrome_browser_cloud_management_helper.cc", "browser/controller/chrome_browser_cloud_management_helper.cc",
"browser/controller/chrome_browser_cloud_management_helper.h", "browser/controller/chrome_browser_cloud_management_helper.h",
"browser/enterprise_switches.cc",
"browser/enterprise_switches.h",
"browser/reporting/common_pref_names.cc", "browser/reporting/common_pref_names.cc",
"browser/reporting/common_pref_names.h", "browser/reporting/common_pref_names.h",
] ]
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/path_service.h" #include "base/path_service.h"
...@@ -17,6 +18,7 @@ ...@@ -17,6 +18,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "components/enterprise/browser/controller/browser_dm_token_storage.h" #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_helper.h" #include "components/enterprise/browser/controller/chrome_browser_cloud_management_helper.h"
#include "components/enterprise/browser/enterprise_switches.h"
#include "components/enterprise/browser/reporting/report_generator.h" #include "components/enterprise/browser/reporting/report_generator.h"
#include "components/enterprise/browser/reporting/report_scheduler.h" #include "components/enterprise/browser/reporting/report_scheduler.h"
#include "components/policy/core/browser/browser_policy_connector.h" #include "components/policy/core/browser/browser_policy_connector.h"
...@@ -67,7 +69,12 @@ const base::FilePath::CharType ...@@ -67,7 +69,12 @@ const base::FilePath::CharType
FILE_PATH_LITERAL("Policy"); FILE_PATH_LITERAL("Policy");
bool ChromeBrowserCloudManagementController::IsEnabled() { bool ChromeBrowserCloudManagementController::IsEnabled() {
return delegate_->IsEnabled(); #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return true;
#else
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableChromeBrowserCloudManagement);
#endif
} }
ChromeBrowserCloudManagementController::ChromeBrowserCloudManagementController( ChromeBrowserCloudManagementController::ChromeBrowserCloudManagementController(
...@@ -87,7 +94,7 @@ ChromeBrowserCloudManagementController:: ...@@ -87,7 +94,7 @@ ChromeBrowserCloudManagementController::
std::unique_ptr<MachineLevelUserCloudPolicyManager> std::unique_ptr<MachineLevelUserCloudPolicyManager>
ChromeBrowserCloudManagementController::CreatePolicyManager( ChromeBrowserCloudManagementController::CreatePolicyManager(
ConfigurationPolicyProvider* platform_provider) { ConfigurationPolicyProvider* platform_provider) {
if (!delegate_->IsEnabled()) if (!IsEnabled())
return nullptr; return nullptr;
std::string enrollment_token = std::string enrollment_token =
...@@ -148,7 +155,7 @@ ChromeBrowserCloudManagementController::CreatePolicyManager( ...@@ -148,7 +155,7 @@ ChromeBrowserCloudManagementController::CreatePolicyManager(
void ChromeBrowserCloudManagementController::Init( void ChromeBrowserCloudManagementController::Init(
PrefService* local_state, PrefService* local_state,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
if (!delegate_->IsEnabled()) if (!IsEnabled())
return; return;
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
......
...@@ -70,14 +70,6 @@ class ChromeBrowserCloudManagementController ...@@ -70,14 +70,6 @@ class ChromeBrowserCloudManagementController
// Sets the platform-specific DM token storage delegate; // Sets the platform-specific DM token storage delegate;
virtual void SetDMTokenStorageDelegate() = 0; virtual void SetDMTokenStorageDelegate() = 0;
// Platform-specific check whether Chrome browser cloud management is
// enabled.
// TODO(crbug.com/1111435): This needs to be an instance method because iOS
// needs custom logic to determine whether CBCM is enabled. After it is
// fully launched on iOS, however, this can be moved back to the base class
// as a static method.
virtual bool IsEnabled() = 0;
// Returns the platform-specific DIR_USER_DATA value to pass to the // Returns the platform-specific DIR_USER_DATA value to pass to the
// PathService. // PathService.
virtual int GetUserDataDirKey() = 0; virtual int GetUserDataDirKey() = 0;
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/enterprise/browser/enterprise_switches.h"
#include "build/build_config.h"
namespace switches {
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
// Enables the Chrome Browser Cloud Management integration on Chromium builds.
// CBCM is always enabled in branded builds.
const char kEnableChromeBrowserCloudManagement[] =
"enable-chrome-browser-cloud-management";
#endif
} // namespace switches
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Defines the enterprise-related command-line switches used on several
// platforms.
#ifndef COMPONENTS_ENTERPRISE_BROWSER_ENTERPRISE_SWITCHES_H_
#define COMPONENTS_ENTERPRISE_BROWSER_ENTERPRISE_SWITCHES_H_
#include "build/build_config.h"
namespace switches {
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
extern const char kEnableChromeBrowserCloudManagement[];
#endif
} // namespace switches
#endif // COMPONENTS_ENTERPRISE_BROWSER_ENTERPRISE_SWITCHES_H_
...@@ -24,10 +24,6 @@ const char kDisableIOSPasswordSuggestions[] = ...@@ -24,10 +24,6 @@ const char kDisableIOSPasswordSuggestions[] =
const char kDisableThirdPartyKeyboardWorkaround[] = const char kDisableThirdPartyKeyboardWorkaround[] =
"disable-third-party-keyboard-workaround"; "disable-third-party-keyboard-workaround";
// Enables Chrome Browser Cloud Management flow.
const char kEnableChromeBrowserCloudManagement[] =
"enable-chrome-browser-cloud-management";
// Enables enterprise policy support. // Enables enterprise policy support.
const char kEnableEnterprisePolicy[] = "enable-enterprise-policy"; const char kEnableEnterprisePolicy[] = "enable-enterprise-policy";
......
...@@ -13,7 +13,6 @@ extern const char kDisableEnterprisePolicy[]; ...@@ -13,7 +13,6 @@ extern const char kDisableEnterprisePolicy[];
extern const char kDisableIOSPasswordSuggestions[]; extern const char kDisableIOSPasswordSuggestions[];
extern const char kDisableThirdPartyKeyboardWorkaround[]; extern const char kDisableThirdPartyKeyboardWorkaround[];
extern const char kEnableChromeBrowserCloudManagement[];
extern const char kEnableEnterprisePolicy[]; extern const char kEnableEnterprisePolicy[];
extern const char kEnableIOSHandoffToOtherDevices[]; extern const char kEnableIOSHandoffToOtherDevices[];
extern const char kEnableSpotlightActions[]; extern const char kEnableSpotlightActions[];
......
...@@ -18,6 +18,7 @@ source_set("flags") { ...@@ -18,6 +18,7 @@ source_set("flags") {
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/autofill/ios/browser", "//components/autofill/ios/browser",
"//components/dom_distiller/core", "//components/dom_distiller/core",
"//components/enterprise",
"//components/feature_engagement/public", "//components/feature_engagement/public",
"//components/flags_ui", "//components/flags_ui",
"//components/flags_ui:switches", "//components/flags_ui:switches",
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "components/autofill/ios/browser/autofill_switches.h" #include "components/autofill/ios/browser/autofill_switches.h"
#include "components/content_settings/core/common/features.h" #include "components/content_settings/core/common/features.h"
#include "components/dom_distiller/core/dom_distiller_switches.h" #include "components/dom_distiller/core/dom_distiller_switches.h"
#include "components/enterprise/browser/enterprise_switches.h"
#include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/feature_list.h" #include "components/feature_engagement/public/feature_list.h"
#include "components/flags_ui/feature_entry.h" #include "components/flags_ui/feature_entry.h"
......
...@@ -181,6 +181,7 @@ source_set("eg2_tests") { ...@@ -181,6 +181,7 @@ source_set("eg2_tests") {
":test_resources", ":test_resources",
"//base", "//base",
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/enterprise",
"//components/password_manager/core/common", "//components/password_manager/core/common",
"//components/policy:generated", "//components/policy:generated",
"//components/policy/core/common:common_constants", "//components/policy/core/common:common_constants",
......
...@@ -25,7 +25,6 @@ class ChromeBrowserCloudManagementControllerIOS ...@@ -25,7 +25,6 @@ class ChromeBrowserCloudManagementControllerIOS
// ChromeBrowserCloudManagementController::Delegate implementation. // ChromeBrowserCloudManagementController::Delegate implementation.
void SetDMTokenStorageDelegate() override; void SetDMTokenStorageDelegate() override;
bool IsEnabled() override;
int GetUserDataDirKey() override; int GetUserDataDirKey() override;
base::FilePath GetExternalPolicyPath() override; base::FilePath GetExternalPolicyPath() override;
NetworkConnectionTrackerGetter CreateNetworkConnectionTrackerGetter() NetworkConnectionTrackerGetter CreateNetworkConnectionTrackerGetter()
......
...@@ -32,10 +32,6 @@ void ChromeBrowserCloudManagementControllerIOS::SetDMTokenStorageDelegate() { ...@@ -32,10 +32,6 @@ void ChromeBrowserCloudManagementControllerIOS::SetDMTokenStorageDelegate() {
std::make_unique<BrowserDMTokenStorageIOS>()); std::make_unique<BrowserDMTokenStorageIOS>());
} }
bool ChromeBrowserCloudManagementControllerIOS::IsEnabled() {
return IsChromeBrowserCloudManagementEnabled();
}
int ChromeBrowserCloudManagementControllerIOS::GetUserDataDirKey() { int ChromeBrowserCloudManagementControllerIOS::GetUserDataDirKey() {
return ios::DIR_USER_DATA; return ios::DIR_USER_DATA;
} }
......
...@@ -40,19 +40,6 @@ bool IsDisableEnterprisePolicySwitchPresent() { ...@@ -40,19 +40,6 @@ bool IsDisableEnterprisePolicySwitchPresent() {
} // namespace } // namespace
bool IsChromeBrowserCloudManagementEnabled() {
// This method is called very early during the launch sequence (inside
// IOSChromeMainParts::PreCreateThreads). At that point, the FeatureList API
// isn't ready yet, so neither Finch experiments nor first-run field trials
// can be used for progressive rollout. To ensure adequate coverage of both
// the "CBCM disabled" and "CBCM enabled" code paths, CBCM is enabled at 100%
// on Beta and 0% on all other channels (CBCM is disabled by default). This
// allows monitoring crashes for both code paths while allowing early adopters
// to use CBCM on the Beta channel.
return HasSwitch(switches::kEnableChromeBrowserCloudManagement) ||
GetChannel() == version_info::Channel::BETA;
}
bool IsEditBookmarksIOSEnabled() { bool IsEditBookmarksIOSEnabled() {
return base::FeatureList::IsEnabled(kEditBookmarksIOS); return base::FeatureList::IsEnabled(kEditBookmarksIOS);
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/json/json_string_value_serializer.h" #include "base/json/json_string_value_serializer.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/enterprise/browser/enterprise_switches.h"
#import "components/policy/core/common/policy_loader_ios_constants.h" #import "components/policy/core/common/policy_loader_ios_constants.h"
#include "components/policy/policy_constants.h" #include "components/policy/policy_constants.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
......
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