Chromium Code Reviews| Index: components/offline_pages/background/connection_notifier.cc |
| diff --git a/components/offline_pages/background/connection_notifier.cc b/components/offline_pages/background/connection_notifier.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..82b90a88073397312996d94429bff2b08a355dbf |
| --- /dev/null |
| +++ b/components/offline_pages/background/connection_notifier.cc |
| @@ -0,0 +1,25 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/offline_pages/background/connection_notifier.h" |
| + |
| +namespace offline_pages { |
| + |
| +ConnectionNotifier::ConnectionNotifier( |
| + const ConnectionNotifier::ConnectedCallback& callback) |
| + : callback_(callback) { |
| + net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| +} |
| + |
| +ConnectionNotifier::~ConnectionNotifier() { |
| + net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| +} |
| + |
| +void ConnectionNotifier::OnConnectionTypeChanged( |
| + net::NetworkChangeNotifier::ConnectionType type) { |
| + if (type != net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) |
|
Pete Williamson
2016/12/01 01:34:08
Might the RC also want to know about going offline
dougarnett
2016/12/01 19:25:22
I don't have a use for that yet. One idea is to kn
|
| + callback_.Run(); |
| +} |
| + |
| +} // namespace offline_pages |