summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxdai <xdai@chromium.org>2016-03-23 11:41:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-23 18:42:53 +0000
commit1384ef1a1e7fa82b951a69f5e6e1afc169420287 (patch)
treea7ba0016499f60f411cc57e82b86f033bd8b73fe
parent9aee43b6033fc4d563e0949aba6ef3a03afc0b41 (diff)
downloadchromium_src-1384ef1a1e7fa82b951a69f5e6e1afc169420287.zip
chromium_src-1384ef1a1e7fa82b951a69f5e6e1afc169420287.tar.gz
chromium_src-1384ef1a1e7fa82b951a69f5e6e1afc169420287.tar.bz2
Introduce a switch flag "--allow-data-roaming-by-default" to allow data roaming by default upon system start during OOBE.
This flag is used by Rialto device to obtain device policy and get enrolled automatically since the Rialto device has no display and only connects over cell. BUG=574932 Review URL: https://codereview.chromium.org/1782143004 Cr-Commit-Position: refs/heads/master@{#382888}
-rw-r--r--chrome/browser/chromeos/policy/device_network_configuration_updater.cc19
-rw-r--r--chromeos/chromeos_switches.cc7
-rw-r--r--chromeos/chromeos_switches.h5
3 files changed, 27 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/policy/device_network_configuration_updater.cc b/chrome/browser/chromeos/policy/device_network_configuration_updater.cc
index 6acddad..d2eedd7 100644
--- a/chrome/browser/chromeos/policy/device_network_configuration_updater.cc
+++ b/chrome/browser/chromeos/policy/device_network_configuration_updater.cc
@@ -6,7 +6,11 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chromeos/chromeos_switches.h"
#include "chromeos/network/managed_network_configuration_handler.h"
#include "chromeos/network/network_device_handler.h"
#include "chromeos/settings/cros_settings_names.h"
@@ -56,8 +60,19 @@ DeviceNetworkConfigurationUpdater::DeviceNetworkConfigurationUpdater(
void DeviceNetworkConfigurationUpdater::Init() {
NetworkConfigurationUpdater::Init();
- // Apply the roaming setting initially.
- OnDataRoamingSettingChanged();
+ // TODO(xdai): kAllowDataRoamingByDefault is only used by Rialto devices for
+ // development/testing purpose. After Rialto migrates to use KIOSK app mode,
+ // remove this part of logic.
+ const policy::BrowserPolicyConnectorChromeOS* connector =
+ g_browser_process->platform_part()->browser_policy_connector_chromeos();
+ if (!connector->IsEnterpriseManaged() &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ chromeos::switches::kAllowDataRoamingByDefault)) {
+ network_device_handler_->SetCellularAllowRoaming(true);
+ } else {
+ // Apply the roaming setting initially.
+ OnDataRoamingSettingChanged();
+ }
}
void DeviceNetworkConfigurationUpdater::ImportCertificates(
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index d3abe54..987984b 100644
--- a/chromeos/chromeos_switches.cc
+++ b/chromeos/chromeos_switches.cc
@@ -12,6 +12,13 @@
namespace chromeos {
namespace switches {
+
+// If this flag is set, enable data roaming in the cellular network by default
+// upon system start if it's an unmanaged device. This flag is used by Rialto
+// device to obtain device policy during OOBE since the Rialto device has no
+// display and and only connects over cell.
+const char kAllowDataRoamingByDefault[] = "allow-data-roaming-by-default";
+
// If this flag is passed, failed policy fetches will not cause profile
// initialization to fail. This is useful for tests because it means that
// tests don't have to mock out the policy infrastructure.
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h
index d1d9d54..fa61ba5 100644
--- a/chromeos/chromeos_switches.h
+++ b/chromeos/chromeos_switches.h
@@ -13,14 +13,15 @@ namespace switches {
// Switches that are used in src/chromeos must go here.
// Other switches that apply just to chromeos code should go here also (along
-// with any code that is specific to the chromeos system). ChromeOS specific UI
-// should be in src/ash.
+// with any code that is specific to the chromeos system). Chrome OS specific
+// UI should be in src/ash.
// Note: If you add a switch, consider if it needs to be copied to a subsequent
// command line if the process executes a new copy of itself. (For example,
// see chromeos::LoginUtil::GetOffTheRecordCommandLine().)
// Please keep alphabetized.
+CHROMEOS_EXPORT extern const char kAllowDataRoamingByDefault[];
CHROMEOS_EXPORT extern const char kAllowFailedPolicyFetchForTest[];
CHROMEOS_EXPORT extern const char kAllowRAInDevMode[];
CHROMEOS_EXPORT extern const char kAppOemManifestFile[];