| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chromeos/tether/tether_service.h" | 5 #include "chrome/browser/chromeos/tether/tether_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/chromeos/net/tether_notification_presenter.h" | 10 #include "chrome/browser/chromeos/net/tether_notification_presenter.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 auto notification_presenter = | 52 auto notification_presenter = |
| 53 base::MakeUnique<chromeos::tether::TetherNotificationPresenter>( | 53 base::MakeUnique<chromeos::tether::TetherNotificationPresenter>( |
| 54 message_center::MessageCenter::Get(), | 54 message_center::MessageCenter::Get(), |
| 55 chromeos::NetworkConnect::Get()); | 55 chromeos::NetworkConnect::Get()); |
| 56 chromeos::tether::Initializer::Init( | 56 chromeos::tether::Initializer::Init( |
| 57 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile_), | 57 ChromeCryptAuthServiceFactory::GetForBrowserContext(profile_), |
| 58 std::move(notification_presenter), profile_->GetPrefs(), | 58 std::move(notification_presenter), profile_->GetPrefs(), |
| 59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), | 59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), |
| 60 chromeos::NetworkHandler::Get()->network_state_handler(), | 60 chromeos::NetworkHandler::Get()->network_state_handler(), |
| 61 chromeos::NetworkHandler::Get()->managed_network_configuration_handler(), |
| 61 chromeos::NetworkConnect::Get()); | 62 chromeos::NetworkConnect::Get()); |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool TetherService::IsAllowed() const { | 65 bool TetherService::IsAllowed() const { |
| 65 if (shut_down_) | 66 if (shut_down_) |
| 66 return false; | 67 return false; |
| 67 | 68 |
| 68 return profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringAllowed); | 69 return profile_->GetPrefs()->GetBoolean(prefs::kInstantTetheringAllowed); |
| 69 } | 70 } |
| 70 | 71 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 void TetherService::OnPrefsChanged() { | 86 void TetherService::OnPrefsChanged() { |
| 86 if (IsAllowed() && IsEnabled()) { | 87 if (IsAllowed() && IsEnabled()) { |
| 87 StartTether(); | 88 StartTether(); |
| 88 return; | 89 return; |
| 89 } | 90 } |
| 90 | 91 |
| 91 chromeos::tether::Initializer::Shutdown(); | 92 chromeos::tether::Initializer::Shutdown(); |
| 92 } | 93 } |
| OLD | NEW |