| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/offline_pages/background/connection_notifier.h" | |
| 6 | |
| 7 namespace offline_pages { | |
| 8 | |
| 9 ConnectionNotifier::ConnectionNotifier( | |
| 10 const ConnectionNotifier::ConnectedCallback& callback) | |
| 11 : callback_(callback) { | |
| 12 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); | |
| 13 } | |
| 14 | |
| 15 ConnectionNotifier::~ConnectionNotifier() { | |
| 16 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | |
| 17 } | |
| 18 | |
| 19 void ConnectionNotifier::OnConnectionTypeChanged( | |
| 20 net::NetworkChangeNotifier::ConnectionType type) { | |
| 21 if (type != net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) | |
| 22 callback_.Run(); | |
| 23 } | |
| 24 | |
| 25 } // namespace offline_pages | |
| OLD | NEW |