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

Side by Side Diff: content/browser/background_sync/background_sync_network_observer.cc

Issue 2954433002: BackgroundSync: Convert to base::BindOnce/OnceCallback/OnceClosure (Closed)
Patch Set: rename local variable Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "content/browser/background_sync/background_sync_network_observer.h" 5 #include "content/browser/background_sync/background_sync_network_observer.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 // static 14 // static
15 bool BackgroundSyncNetworkObserver::ignore_network_change_notifier_ = false; 15 bool BackgroundSyncNetworkObserver::ignore_network_change_notifier_ = false;
16 16
17 // static 17 // static
18 void BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests( 18 void BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests(
19 bool ignore) { 19 bool ignore) {
20 ignore_network_change_notifier_ = ignore; 20 ignore_network_change_notifier_ = ignore;
21 } 21 }
22 22
23 BackgroundSyncNetworkObserver::BackgroundSyncNetworkObserver( 23 BackgroundSyncNetworkObserver::BackgroundSyncNetworkObserver(
24 const base::Closure& network_changed_callback) 24 const base::RepeatingClosure& network_changed_callback)
25 : connection_type_(net::NetworkChangeNotifier::GetConnectionType()), 25 : connection_type_(net::NetworkChangeNotifier::GetConnectionType()),
26 network_changed_callback_(network_changed_callback) { 26 network_changed_callback_(network_changed_callback) {
27 DCHECK_CURRENTLY_ON(BrowserThread::IO); 27 DCHECK_CURRENTLY_ON(BrowserThread::IO);
28 28
29 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); 29 net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
30 } 30 }
31 31
32 BackgroundSyncNetworkObserver::~BackgroundSyncNetworkObserver() { 32 BackgroundSyncNetworkObserver::~BackgroundSyncNetworkObserver() {
33 DCHECK_CURRENTLY_ON(BrowserThread::IO); 33 DCHECK_CURRENTLY_ON(BrowserThread::IO);
34 34
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void BackgroundSyncNetworkObserver::NotifyNetworkChanged() { 83 void BackgroundSyncNetworkObserver::NotifyNetworkChanged() {
84 DCHECK_CURRENTLY_ON(BrowserThread::IO); 84 DCHECK_CURRENTLY_ON(BrowserThread::IO);
85 85
86 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 86 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
87 network_changed_callback_); 87 network_changed_callback_);
88 } 88 }
89 89
90 } // namespace content 90 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698