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

Unified Diff: chrome/browser/chromeos/tether/tether_service.cc

Issue 2961733002: [CrOS Tether] Remove spammy log from Initializer. (Closed)
Patch Set: Simplified else statement. 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 side-by-side diff with in-line comments
Download patch
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 173b014d99a2b8041ff8411d3ae4f4712ee5d2d2..17c01d6d7324ac902ee54fc62bbf17e125383f3e 100644
--- a/chrome/browser/chromeos/tether/tether_service.cc
+++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -46,6 +46,28 @@ bool TetherService::IsFeatureFlagEnabled() {
return base::FeatureList::IsEnabled(features::kInstantTethering);
}
+void TetherService::TetherService::InitializerDelegate::InitializeTether(
Ryan Hansberry 2017/06/28 17:02:40 Sorry for the noob question here: why is the doubl
Kyle Horimoto 2017/06/28 21:57:48 Whoa, good catch. I didn't intend for this, and I
+ cryptauth::CryptAuthService* cryptauth_service,
+ std::unique_ptr<chromeos::tether::NotificationPresenter>
+ notification_presenter,
+ PrefService* pref_service,
+ ProfileOAuth2TokenService* token_service,
+ chromeos::NetworkStateHandler* network_state_handler,
+ chromeos::ManagedNetworkConfigurationHandler*
+ managed_network_configuration_handler,
+ chromeos::NetworkConnect* network_connect,
+ chromeos::NetworkConnectionHandler* network_connection_handler) {
+ chromeos::tether::Initializer::Init(
+ cryptauth_service, std::move(notification_presenter), pref_service,
+ token_service, network_state_handler,
+ managed_network_configuration_handler, network_connect,
+ network_connection_handler);
+}
+
+void TetherService::TetherService::InitializerDelegate::ShutdownTether() {
+ chromeos::tether::Initializer::Shutdown();
+}
+
TetherService::TetherService(
Profile* profile,
chromeos::PowerManagerClient* power_manager_client,
@@ -57,6 +79,7 @@ TetherService::TetherService(
session_manager_client_(session_manager_client),
cryptauth_service_(cryptauth_service),
network_state_handler_(network_state_handler),
+ initializer_delegate_(base::MakeUnique<InitializerDelegate>()),
weak_ptr_factory_(this) {
power_manager_client_->AddObserver(this);
session_manager_client_->AddObserver(this);
@@ -92,7 +115,7 @@ void TetherService::StartTetherIfEnabled() {
base::MakeUnique<chromeos::tether::TetherNotificationPresenter>(
profile_, message_center::MessageCenter::Get(),
chromeos::NetworkConnect::Get());
- chromeos::tether::Initializer::Init(
+ initializer_delegate_->InitializeTether(
cryptauth_service_, std::move(notification_presenter),
profile_->GetPrefs(),
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
@@ -103,7 +126,7 @@ void TetherService::StartTetherIfEnabled() {
}
void TetherService::StopTether() {
- chromeos::tether::Initializer::Shutdown();
+ initializer_delegate_->ShutdownTether();
}
void TetherService::Shutdown() {
@@ -198,12 +221,12 @@ bool TetherService::HasSyncedTetherHosts() const {
}
void TetherService::UpdateTetherTechnologyState() {
- chromeos::NetworkStateHandler::TechnologyState tether_technology_state =
+ chromeos::NetworkStateHandler::TechnologyState new_tether_technology_state =
GetTetherTechnologyState();
- network_state_handler_->SetTetherTechnologyState(tether_technology_state);
+ network_state_handler_->SetTetherTechnologyState(new_tether_technology_state);
- if (tether_technology_state ==
+ if (new_tether_technology_state ==
chromeos::NetworkStateHandler::TechnologyState::TECHNOLOGY_ENABLED) {
StartTetherIfEnabled();
} else {
@@ -264,3 +287,8 @@ bool TetherService::IsAllowedByPolicy() const {
bool TetherService::IsEnabledbyPreference() const {
return profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringEnabled);
}
+
+void TetherService::SetInitializerDelegateForTest(
+ std::unique_ptr<InitializerDelegate> initializer_delegate) {
+ initializer_delegate_ = std::move(initializer_delegate);
+}

Powered by Google App Engine
This is Rietveld 408576698