Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / browser / background_sync / background_sync_network_observer.h
blob7c81f738a92c01b799441e14a3366d71d4741f28
1 // Copyright 2015 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.
5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_
8 #include "base/bind.h"
9 #include "content/browser/background_sync/background_sync.pb.h"
10 #include "content/common/content_export.h"
11 #include "net/base/network_change_notifier.h"
13 namespace content {
15 class CONTENT_EXPORT BackgroundSyncNetworkObserver
16 : net::NetworkChangeNotifier::NetworkChangeObserver {
17 public:
18 // Creates a BackgroundSyncNetworkObserver. |network_changed_callback| is
19 // called when the network connection changes asynchronously via PostMessage.
20 BackgroundSyncNetworkObserver(const base::Closure& network_changed_callback);
22 ~BackgroundSyncNetworkObserver() override;
24 // Returns true if the state of the network meets the needs of
25 // |network_state|.
26 bool NetworkSufficient(SyncNetworkState network_state);
28 private:
29 void NotifyNetworkChanged();
31 // NetworkChangeObserver overrides
32 void OnNetworkChanged(
33 net::NetworkChangeNotifier::ConnectionType connection_type) override;
35 net::NetworkChangeNotifier::ConnectionType connection_type_;
37 // The callback to run when the network changes.
38 base::Closure network_changed_callback_;
40 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver);
43 } // namespace content
45 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_NETWORK_OBSERVER_H_