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.
5 #include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
9 #include "base/logging.h"
10 #include "base/values.h"
11 #include "chrome/browser/chromeos/settings/cros_settings.h"
12 #include "chromeos/network/shill_property_util.h"
13 #include "chromeos/settings/cros_settings_names.h"
14 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h"
17 #include "ui/base/l10n/l10n_util.h"
21 const bool kDefaultUpdateOverCellularAllowed
= false;
25 namespace help_utils_chromeos
{
27 bool IsUpdateOverCellularAllowed() {
28 chromeos::CrosSettings
* settings
= chromeos::CrosSettings::Get();
30 return kDefaultUpdateOverCellularAllowed
;
32 const base::Value
* raw_types_value
=
33 settings
->GetPref(chromeos::kAllowedConnectionTypesForUpdate
);
35 return kDefaultUpdateOverCellularAllowed
;
36 const base::ListValue
* types_value
;
37 CHECK(raw_types_value
->GetAsList(&types_value
));
38 for (size_t i
= 0; i
< types_value
->GetSize(); ++i
) {
40 if (!types_value
->GetInteger(i
, &connection_type
)) {
41 LOG(WARNING
) << "Can't parse connection type #" << i
;
44 if (connection_type
== 4)
47 return kDefaultUpdateOverCellularAllowed
;
50 base::string16
GetConnectionTypeAsUTF16(const std::string
& type
) {
51 if (chromeos::NetworkTypePattern::Ethernet().MatchesType(type
))
52 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET
);
53 if (type
== shill::kTypeWifi
)
54 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIFI
);
55 if (type
== shill::kTypeWimax
)
56 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIMAX
);
57 if (type
== shill::kTypeBluetooth
)
58 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_BLUETOOTH
);
59 if (type
== shill::kTypeCellular
)
60 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_CELLULAR
);
61 if (type
== shill::kTypeVPN
)
62 return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_VPN
);
64 return base::string16();
67 } // namespace help_utils_chromeos