Chromium Code Reviews| Index: chrome/browser/chromeos/tether/tether_service.cc |
| diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc |
| index 797e978e9493975084f819dd189998e74be0db0e..da52e78549fa90bc41605955742eac600120a9db 100644 |
| --- a/chrome/browser/chromeos/tether/tether_service.cc |
| +++ b/chrome/browser/chromeos/tether/tether_service.cc |
| @@ -177,8 +177,8 @@ void TetherService::DeviceListChanged() { |
| if (is_enabled != was_pref_enabled) { |
| profile_->GetPrefs()->SetBoolean(prefs::kInstantTetheringEnabled, |
| is_enabled); |
| - UpdateTetherTechnologyState(); |
| } |
| + UpdateTetherTechnologyState(); |
|
Ryan Hansberry
2017/05/27 00:16:22
This is incorrect. Given our offline discussion ea
lesliewatkins
2017/05/30 18:29:51
Let's continue this discussion offline. It seems t
Ryan Hansberry
2017/05/30 21:13:59
Oops, misread this. Looks good.
|
| } |
| void TetherService::OnPrefsChanged() { |
| @@ -214,7 +214,7 @@ TetherService::GetTetherTechnologyState() { |
| } else if (!IsAllowedByPolicy()) { |
| return chromeos::NetworkStateHandler::TechnologyState:: |
| TECHNOLOGY_PROHIBITED; |
| - } else if (!IsBluetoothAvailable()) { |
| + } else if (!IsBluetoothAvailable() || IsCellularAvailableButNotEnabled()) { |
| // TODO (hansberry): This unfortunately results in a weird UI state for |
| // Settings where the toggle is clickable but immediately becomes disabled |
| // after enabling it. Possible solution: grey out the toggle and tell the |
| @@ -239,6 +239,13 @@ bool TetherService::IsBluetoothAvailable() const { |
| return adapter_.get() && adapter_->IsPresent() && adapter_->IsPowered(); |
| } |
| +bool TetherService::IsCellularAvailableButNotEnabled() const { |
| + return (network_state_handler_->IsTechnologyAvailable( |
| + chromeos::NetworkTypePattern::Cellular()) && |
| + !network_state_handler_->IsTechnologyEnabled( |
| + chromeos::NetworkTypePattern::Cellular())); |
| +} |
| + |
| bool TetherService::IsAllowedByPolicy() const { |
| return profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringAllowed); |
| } |