| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" | 5 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 data_roaming_setting_subscription_ = cros_settings->AddSettingsObserver( | 52 data_roaming_setting_subscription_ = cros_settings->AddSettingsObserver( |
| 53 chromeos::kSignedDataRoamingEnabled, | 53 chromeos::kSignedDataRoamingEnabled, |
| 54 base::Bind( | 54 base::Bind( |
| 55 &DeviceNetworkConfigurationUpdater::OnDataRoamingSettingChanged, | 55 &DeviceNetworkConfigurationUpdater::OnDataRoamingSettingChanged, |
| 56 base::Unretained(this))); | 56 base::Unretained(this))); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void DeviceNetworkConfigurationUpdater::Init() { | 59 void DeviceNetworkConfigurationUpdater::Init() { |
| 60 NetworkConfigurationUpdater::Init(); | 60 NetworkConfigurationUpdater::Init(); |
| 61 | 61 |
| 62 // TODO(xdai): kAllowDataRoamingByDefault is only used by Rialto devices for | |
| 63 // development/testing purpose. After Rialto migrates to use KIOSK app mode, | |
| 64 // remove this part of logic. | |
| 65 const policy::BrowserPolicyConnectorChromeOS* connector = | 62 const policy::BrowserPolicyConnectorChromeOS* connector = |
| 66 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 63 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 64 |
| 65 // The highest authority regarding whether cellular data roaming should be |
| 66 // allowed is the Device Policy. If there is no Device Policy, then |
| 67 // data roaming should be allowed if this is a Cellular First device. |
| 67 if (!connector->IsEnterpriseManaged() && | 68 if (!connector->IsEnterpriseManaged() && |
| 68 base::CommandLine::ForCurrentProcess()->HasSwitch( | 69 chromeos::switches::IsCellularFirstDevice()) { |
| 69 chromeos::switches::kAllowDataRoamingByDefault)) { | |
| 70 network_device_handler_->SetCellularAllowRoaming(true); | 70 network_device_handler_->SetCellularAllowRoaming(true); |
| 71 } else { | 71 } else { |
| 72 // Apply the roaming setting initially. | 72 // Apply the roaming setting initially. |
| 73 OnDataRoamingSettingChanged(); | 73 OnDataRoamingSettingChanged(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Set up MAC address randomization if we are not enterprise managed. | 76 // Set up MAC address randomization if we are not enterprise managed. |
| 77 |
| 77 network_device_handler_->SetMACAddressRandomizationEnabled( | 78 network_device_handler_->SetMACAddressRandomizationEnabled( |
| 78 !connector->IsEnterpriseManaged()); | 79 !connector->IsEnterpriseManaged()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void DeviceNetworkConfigurationUpdater::ImportCertificates( | 82 void DeviceNetworkConfigurationUpdater::ImportCertificates( |
| 82 const base::ListValue& certificates_onc) { | 83 const base::ListValue& certificates_onc) { |
| 83 // Importing CA and server certs from device policy is not allowed, while | 84 // Importing CA and server certs from device policy is not allowed, while |
| 84 // importing client is not yet supported (as a system-wide PKCS#11 token to | 85 // importing client is not yet supported (as a system-wide PKCS#11 token to |
| 85 // which they should be imported does not exists at the time). | 86 // which they should be imported does not exists at the time). |
| 86 } | 87 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 117 } else { | 118 } else { |
| 118 DCHECK_EQ(trusted_status, | 119 DCHECK_EQ(trusted_status, |
| 119 chromeos::CrosSettingsProvider::PERMANENTLY_UNTRUSTED); | 120 chromeos::CrosSettingsProvider::PERMANENTLY_UNTRUSTED); |
| 120 // Roaming is disabled as we can't determine the correct setting. | 121 // Roaming is disabled as we can't determine the correct setting. |
| 121 } | 122 } |
| 122 | 123 |
| 123 network_device_handler_->SetCellularAllowRoaming(data_roaming_setting); | 124 network_device_handler_->SetCellularAllowRoaming(data_roaming_setting); |
| 124 } | 125 } |
| 125 | 126 |
| 126 } // namespace policy | 127 } // namespace policy |
| OLD | NEW |