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

Side by Side Diff: chrome/browser/intranet_redirect_detector.cc

Issue 2828663002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/{i,l,m,n,p,r}* (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/interstitials/chrome_controller_client.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/intranet_redirect_detector.h" 5 #include "chrome/browser/intranet_redirect_detector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 22 matching lines...) Expand all
33 in_sleep_(true), 33 in_sleep_(true),
34 weak_ptr_factory_(this) { 34 weak_ptr_factory_(this) {
35 // Because this function can be called during startup, when kicking off a URL 35 // Because this function can be called during startup, when kicking off a URL
36 // fetch can eat up 20 ms of time, we delay seven seconds, which is hopefully 36 // fetch can eat up 20 ms of time, we delay seven seconds, which is hopefully
37 // long enough to be after startup, but still get results back quickly. 37 // long enough to be after startup, but still get results back quickly.
38 // Ideally, instead of this timer, we'd do something like "check if the 38 // Ideally, instead of this timer, we'd do something like "check if the
39 // browser is starting up, and if so, come back later", but there is currently 39 // browser is starting up, and if so, come back later", but there is currently
40 // no function to do this. 40 // no function to do this.
41 static const int kStartFetchDelaySeconds = 7; 41 static const int kStartFetchDelaySeconds = 7;
42 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 42 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
43 FROM_HERE, base::Bind(&IntranetRedirectDetector::FinishSleep, 43 FROM_HERE,
44 weak_ptr_factory_.GetWeakPtr()), 44 base::BindOnce(&IntranetRedirectDetector::FinishSleep,
45 weak_ptr_factory_.GetWeakPtr()),
45 base::TimeDelta::FromSeconds(kStartFetchDelaySeconds)); 46 base::TimeDelta::FromSeconds(kStartFetchDelaySeconds));
46 47
47 net::NetworkChangeNotifier::AddIPAddressObserver(this); 48 net::NetworkChangeNotifier::AddIPAddressObserver(this);
48 } 49 }
49 50
50 IntranetRedirectDetector::~IntranetRedirectDetector() { 51 IntranetRedirectDetector::~IntranetRedirectDetector() {
51 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 52 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
52 } 53 }
53 54
54 // static 55 // static
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void IntranetRedirectDetector::OnIPAddressChanged() { 180 void IntranetRedirectDetector::OnIPAddressChanged() {
180 // If a request is already scheduled, do not scheduled yet another one. 181 // If a request is already scheduled, do not scheduled yet another one.
181 if (in_sleep_) 182 if (in_sleep_)
182 return; 183 return;
183 184
184 // Since presumably many programs open connections after network changes, 185 // Since presumably many programs open connections after network changes,
185 // delay this a little bit. 186 // delay this a little bit.
186 in_sleep_ = true; 187 in_sleep_ = true;
187 static const int kNetworkSwitchDelayMS = 1000; 188 static const int kNetworkSwitchDelayMS = 1000;
188 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 189 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
189 FROM_HERE, base::Bind(&IntranetRedirectDetector::FinishSleep, 190 FROM_HERE,
190 weak_ptr_factory_.GetWeakPtr()), 191 base::BindOnce(&IntranetRedirectDetector::FinishSleep,
192 weak_ptr_factory_.GetWeakPtr()),
191 base::TimeDelta::FromMilliseconds(kNetworkSwitchDelayMS)); 193 base::TimeDelta::FromMilliseconds(kNetworkSwitchDelayMS));
192 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/chrome_controller_client.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698