| 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/ui/webui/help/help_utils_chromeos.h" | 5 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/chromeos/settings/cros_settings.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 15 #include "chromeos/chromeos_switches.h" | 15 #include "chromeos/chromeos_switches.h" |
| 16 #include "chromeos/network/network_state.h" |
| 16 #include "chromeos/network/network_type_pattern.h" | 17 #include "chromeos/network/network_type_pattern.h" |
| 17 #include "chromeos/settings/cros_settings_names.h" | 18 #include "chromeos/settings/cros_settings_names.h" |
| 18 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 | 21 |
| 21 namespace help_utils_chromeos { | 22 namespace help_utils_chromeos { |
| 22 | 23 |
| 23 bool IsUpdateOverCellularAllowed(bool interactive) { | 24 bool IsUpdateOverCellularAllowed(bool interactive) { |
| 24 // If this is a Cellular First device or the user actively checks for update, | 25 // If this is a Cellular First device or the user actively checks for update, |
| 25 // the default is to allow updates over cellular. | 26 // the default is to allow updates over cellular. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 continue; | 45 continue; |
| 45 } | 46 } |
| 46 if (connection_type == 4) | 47 if (connection_type == 4) |
| 47 return true; | 48 return true; |
| 48 } | 49 } |
| 49 // Device policy does not allow updates over cellular, as cellular is not | 50 // Device policy does not allow updates over cellular, as cellular is not |
| 50 // included in allowed connection types for updates. | 51 // included in allowed connection types for updates. |
| 51 return false; | 52 return false; |
| 52 } | 53 } |
| 53 | 54 |
| 54 base::string16 GetConnectionTypeAsUTF16(const std::string& type) { | 55 base::string16 GetConnectionTypeAsUTF16(const chromeos::NetworkState* network) { |
| 56 const std::string type = |
| 57 network->IsUsingMobileData() ? shill::kTypeCellular : network->type(); |
| 55 if (chromeos::NetworkTypePattern::Ethernet().MatchesType(type)) | 58 if (chromeos::NetworkTypePattern::Ethernet().MatchesType(type)) |
| 56 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET); | 59 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET); |
| 57 if (type == shill::kTypeWifi) | 60 if (type == shill::kTypeWifi) |
| 58 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIFI); | 61 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIFI); |
| 59 if (type == shill::kTypeWimax) | 62 if (type == shill::kTypeWimax) |
| 60 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIMAX); | 63 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIMAX); |
| 61 if (type == shill::kTypeBluetooth) | 64 if (type == shill::kTypeBluetooth) |
| 62 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_BLUETOOTH); | 65 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_BLUETOOTH); |
| 63 if (type == shill::kTypeCellular) | 66 if (type == shill::kTypeCellular) |
| 64 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_CELLULAR); | 67 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_CELLULAR); |
| 65 if (type == shill::kTypeVPN) | 68 if (type == shill::kTypeVPN) |
| 66 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_VPN); | 69 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_VPN); |
| 67 NOTREACHED(); | 70 NOTREACHED(); |
| 68 return base::string16(); | 71 return base::string16(); |
| 69 } | 72 } |
| 70 | 73 |
| 71 } // namespace help_utils_chromeos | 74 } // namespace help_utils_chromeos |
| OLD | NEW |