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 e0dd94fb4b1fd24d64c816e0c5b27eda2f492663..797e978e9493975084f819dd189998e74be0db0e 100644 |
--- a/chrome/browser/chromeos/tether/tether_service.cc |
+++ b/chrome/browser/chromeos/tether/tether_service.cc |
@@ -26,7 +26,10 @@ |
// static |
TetherService* TetherService::Get(Profile* profile) { |
- return TetherServiceFactory::GetForBrowserContext(profile); |
+ if (IsFeatureFlagEnabled()) |
+ return TetherServiceFactory::GetForBrowserContext(profile); |
+ |
+ return nullptr; |
} |
// static |
@@ -36,6 +39,12 @@ void TetherService::RegisterProfilePrefs(PrefRegistrySimple* registry) { |
chromeos::tether::Initializer::RegisterProfilePrefs(registry); |
} |
+// static |
+bool TetherService::IsFeatureFlagEnabled() { |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableTether); |
+} |
+ |
TetherService::TetherService( |
Profile* profile, |
chromeos::PowerManagerClient* power_manager_client, |
@@ -176,6 +185,12 @@ void TetherService::OnPrefsChanged() { |
UpdateTetherTechnologyState(); |
} |
+bool TetherService::HasSyncedTetherHosts() const { |
+ return !cryptauth_service_->GetCryptAuthDeviceManager() |
+ ->GetTetherHosts() |
+ .empty(); |
+} |
+ |
void TetherService::UpdateTetherTechnologyState() { |
chromeos::NetworkStateHandler::TechnologyState tether_technology_state = |
GetTetherTechnologyState(); |
@@ -193,7 +208,7 @@ void TetherService::UpdateTetherTechnologyState() { |
chromeos::NetworkStateHandler::TechnologyState |
TetherService::GetTetherTechnologyState() { |
if (shut_down_ || suspended_ || session_manager_client_->IsScreenLocked() || |
- !IsFeatureFlagEnabled() || !HasSyncedTetherHosts()) { |
+ !HasSyncedTetherHosts()) { |
return chromeos::NetworkStateHandler::TechnologyState:: |
TECHNOLOGY_UNAVAILABLE; |
} else if (!IsAllowedByPolicy()) { |
@@ -220,17 +235,6 @@ void TetherService::OnBluetoothAdapterFetched( |
UpdateTetherTechnologyState(); |
} |
-bool TetherService::HasSyncedTetherHosts() const { |
- return !cryptauth_service_->GetCryptAuthDeviceManager() |
- ->GetTetherHosts() |
- .empty(); |
-} |
- |
-bool TetherService::IsFeatureFlagEnabled() const { |
- return base::CommandLine::ForCurrentProcess()->HasSwitch( |
- chromeos::switches::kEnableTether); |
-} |
- |
bool TetherService::IsBluetoothAvailable() const { |
return adapter_.get() && adapter_->IsPresent() && adapter_->IsPowered(); |
} |