[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" | ||||
6 | |||||
avi | 0f23343 | 2015-12-25 02:23:38 | [diff] [blame] | 7 | #include <stddef.h> |
8 | |||||
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 9 | #include <algorithm> |
10 | |||||
Henrique Ferreiro | f3fbcea2 | 2021-02-05 23:12:19 | [diff] [blame^] | 11 | #include "ash/constants/ash_switches.h" |
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 12 | #include "base/logging.h" |
13 | #include "base/values.h" | ||||
14 | #include "chrome/browser/chromeos/settings/cros_settings.h" | ||||
[email protected] | 833a6bf2 | 2013-10-10 21:59:26 | [diff] [blame] | 15 | #include "chromeos/settings/cros_settings_names.h" |
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 16 | |
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 17 | namespace help_utils_chromeos { |
18 | |||||
weidongg | a02f7da | 2017-05-23 17:12:11 | [diff] [blame] | 19 | bool IsUpdateOverCellularAllowed(bool interactive) { |
20 | // If this is a Cellular First device or the user actively checks for update, | ||||
21 | // the default is to allow updates over cellular. | ||||
kumarniranjan | b9afef6 | 2017-03-02 21:42:22 | [diff] [blame] | 22 | bool default_update_over_cellular_allowed = |
weidongg | a02f7da | 2017-05-23 17:12:11 | [diff] [blame] | 23 | interactive ? true : chromeos::switches::IsCellularFirstDevice(); |
kumarniranjan | b9afef6 | 2017-03-02 21:42:22 | [diff] [blame] | 24 | |
25 | // Device Policy overrides the defaults. | ||||
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 26 | chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); |
27 | if (!settings) | ||||
kumarniranjan | b9afef6 | 2017-03-02 21:42:22 | [diff] [blame] | 28 | return default_update_over_cellular_allowed; |
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [diff] [blame] | 29 | |
30 | const base::Value* raw_types_value = | ||||
31 | settings->GetPref(chromeos::kAllowedConnectionTypesForUpdate); | ||||
32 | if (!raw_types_value) | ||||
kumarniranjan | b9afef6 | 2017-03-02 21:42:22 | [diff] [blame] | 33 | return default_update_over_cellular_allowed; |
[email protected] | 7207a9c | 2013-06-08 00:18:09 | [ |