Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: chrome/browser/ui/webui/help/version_updater_chromeos.cc

Issue 2919683002: Treat tethered networks as mobile networks (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/version_updater_chromeos.h" 5 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const bool kDefaultAutoUpdateDisabled = false; 48 const bool kDefaultAutoUpdateDisabled = false;
49 49
50 NetworkStatus GetNetworkStatus(bool interactive, 50 NetworkStatus GetNetworkStatus(bool interactive,
51 const chromeos::NetworkState* network) { 51 const chromeos::NetworkState* network) {
52 if (!network || !network->IsConnectedState()) // Offline state. 52 if (!network || !network->IsConnectedState()) // Offline state.
53 return NETWORK_STATUS_OFFLINE; 53 return NETWORK_STATUS_OFFLINE;
54 54
55 if (network->type() == shill::kTypeBluetooth) 55 if (network->type() == shill::kTypeBluetooth)
56 return NETWORK_STATUS_DISALLOWED; 56 return NETWORK_STATUS_DISALLOWED;
57 57
58 if (network->type() == shill::kTypeCellular && 58 // Treats tethered networks as cellular networks.
59 if ((network->type() == shill::kTypeCellular ||
60 network->tethering_state() == shill::kTetheringConfirmedState) &&
59 !help_utils_chromeos::IsUpdateOverCellularAllowed(interactive)) { 61 !help_utils_chromeos::IsUpdateOverCellularAllowed(interactive)) {
60 return NETWORK_STATUS_DISALLOWED; 62 return NETWORK_STATUS_DISALLOWED;
61 } 63 }
62 return NETWORK_STATUS_ALLOWED; 64 return NETWORK_STATUS_ALLOWED;
63 } 65 }
64 66
65 // Returns true if auto-update is disabled by the system administrator. 67 // Returns true if auto-update is disabled by the system administrator.
66 bool IsAutoUpdateDisabled() { 68 bool IsAutoUpdateDisabled() {
67 bool update_disabled = kDefaultAutoUpdateDisabled; 69 bool update_disabled = kDefaultAutoUpdateDisabled;
68 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); 70 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get();
(...skipping 23 matching lines...) Expand all
92 network_state_handler->DefaultNetwork(); 94 network_state_handler->DefaultNetwork();
93 95
94 // Don't allow an update if we're currently offline or connected 96 // Don't allow an update if we're currently offline or connected
95 // to a network for which updates are disallowed. 97 // to a network for which updates are disallowed.
96 NetworkStatus status = GetNetworkStatus(interactive, network); 98 NetworkStatus status = GetNetworkStatus(interactive, network);
97 if (status == NETWORK_STATUS_OFFLINE) { 99 if (status == NETWORK_STATUS_OFFLINE) {
98 callback.Run(VersionUpdater::FAILED_OFFLINE, 0, std::string(), 0, 100 callback.Run(VersionUpdater::FAILED_OFFLINE, 0, std::string(), 0,
99 l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE)); 101 l10n_util::GetStringUTF16(IDS_UPGRADE_OFFLINE));
100 return false; 102 return false;
101 } else if (status == NETWORK_STATUS_DISALLOWED) { 103 } else if (status == NETWORK_STATUS_DISALLOWED) {
102 base::string16 message = 104 base::string16 message = l10n_util::GetStringFUTF16(
103 l10n_util::GetStringFUTF16( 105 IDS_UPGRADE_DISALLOWED,
104 IDS_UPGRADE_DISALLOWED, 106 help_utils_chromeos::GetConnectionTypeAsUTF16(
105 help_utils_chromeos::GetConnectionTypeAsUTF16(network->type())); 107 network->tethering_state() == shill::kTetheringConfirmedState
108 ? shill::kTypeCellular
109 : network->type()));
106 callback.Run(VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED, 0, 110 callback.Run(VersionUpdater::FAILED_CONNECTION_TYPE_DISALLOWED, 0,
107 std::string(), 0, message); 111 std::string(), 0, message);
108 return false; 112 return false;
109 } 113 }
110 114
111 return true; 115 return true;
112 } 116 }
113 117
114 } // namespace 118 } // namespace
115 119
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 312 }
309 } 313 }
310 314
311 void VersionUpdaterCros::OnUpdateCheck( 315 void VersionUpdaterCros::OnUpdateCheck(
312 UpdateEngineClient::UpdateCheckResult result) { 316 UpdateEngineClient::UpdateCheckResult result) {
313 // If version updating is not implemented, this binary is the most up-to-date 317 // If version updating is not implemented, this binary is the most up-to-date
314 // possible with respect to automatic updating. 318 // possible with respect to automatic updating.
315 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) 319 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED)
316 callback_.Run(UPDATED, 0, std::string(), 0, base::string16()); 320 callback_.Run(UPDATED, 0, std::string(), 0, base::string16());
317 } 321 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/about_handler.cc » ('j') | chromeos/network/network_state.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698