Chromium Code Reviews| Index: chrome/browser/ui/webui/help/help_utils_chromeos.cc |
| diff --git a/chrome/browser/ui/webui/help/help_utils_chromeos.cc b/chrome/browser/ui/webui/help/help_utils_chromeos.cc |
| index d370f936df302572958a5bc204edef742af6df69..b202105803f1fb136d69520a902c0f9231a7d3ab 100644 |
| --- a/chrome/browser/ui/webui/help/help_utils_chromeos.cc |
| +++ b/chrome/browser/ui/webui/help/help_utils_chromeos.cc |
| @@ -8,32 +8,35 @@ |
| #include <algorithm> |
| +#include "base/command_line.h" |
| #include "base/logging.h" |
| #include "base/values.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "chromeos/chromeos_switches.h" |
| #include "chromeos/network/network_type_pattern.h" |
| #include "chromeos/settings/cros_settings_names.h" |
| #include "third_party/cros_system_api/dbus/service_constants.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -namespace { |
| - |
| -const bool kDefaultUpdateOverCellularAllowed = false; |
| - |
| -} // namespace |
| - |
| namespace help_utils_chromeos { |
| bool IsUpdateOverCellularAllowed() { |
| + // If this is a Cellular First device, the default is to allow updates |
| + // over cellular. |
| + bool default_update_over_cellular_allowed = |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + chromeos::switches::kCellularFirst); |
|
xiyuan
2017/02/28 22:29:42
nit: use IsCellularFirstDevice() and get rid of #i
kumarniranjan
2017/02/28 22:52:21
Done.
|
| + |
| + // Device Policy overrides the defaults. |
| chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); |
| if (!settings) |
| - return kDefaultUpdateOverCellularAllowed; |
| + return default_update_over_cellular_allowed; |
| const base::Value* raw_types_value = |
| settings->GetPref(chromeos::kAllowedConnectionTypesForUpdate); |
| if (!raw_types_value) |
| - return kDefaultUpdateOverCellularAllowed; |
| + return default_update_over_cellular_allowed; |
| const base::ListValue* types_value; |
| CHECK(raw_types_value->GetAsList(&types_value)); |
| for (size_t i = 0; i < types_value->GetSize(); ++i) { |
| @@ -45,7 +48,7 @@ bool IsUpdateOverCellularAllowed() { |
| if (connection_type == 4) |
| return true; |
| } |
| - return kDefaultUpdateOverCellularAllowed; |
| + return default_update_over_cellular_allowed; |
| } |
| base::string16 GetConnectionTypeAsUTF16(const std::string& type) { |