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

Side by Side Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.cc

Issue 11360108: Start calculating new combined NetworkChangeNotifier signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address szym's first round of comments Created 8 years 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 | Annotate | Revision Log
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/chromeos/net/network_change_notifier_chromeos.h" 5 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 void OnNetworkChange() { 46 void OnNetworkChange() {
47 InvalidateConfig(); 47 InvalidateConfig();
48 InvalidateHosts(); 48 InvalidateHosts();
49 ReadNow(); 49 ReadNow();
50 } 50 }
51 }; 51 };
52 52
53 NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos() 53 NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos()
54 : has_active_network_(false), 54 : NetworkChangeNotifier(NetworkChangeCalculatorParamsChromeos()),
55 has_active_network_(false),
55 connection_state_(chromeos::STATE_UNKNOWN), 56 connection_state_(chromeos::STATE_UNKNOWN),
56 connection_type_(CONNECTION_NONE), 57 connection_type_(CONNECTION_NONE),
57 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 58 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
58 BrowserThread::PostDelayedTask( 59 BrowserThread::PostDelayedTask(
59 BrowserThread::UI, FROM_HERE, 60 BrowserThread::UI, FROM_HERE,
60 base::Bind( 61 base::Bind(
61 &NetworkChangeNotifierChromeos::UpdateInitialState, this), 62 &NetworkChangeNotifierChromeos::UpdateInitialState, this),
62 base::TimeDelta::FromMilliseconds(kInitialNotificationCheckDelayMS)); 63 base::TimeDelta::FromMilliseconds(kInitialNotificationCheckDelayMS));
63 } 64 }
64 65
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return CONNECTION_4G; 329 return CONNECTION_4G;
329 } 330 }
330 case chromeos::TYPE_BLUETOOTH: 331 case chromeos::TYPE_BLUETOOTH:
331 case chromeos::TYPE_VPN: 332 case chromeos::TYPE_VPN:
332 case chromeos::TYPE_UNKNOWN: 333 case chromeos::TYPE_UNKNOWN:
333 break; 334 break;
334 } 335 }
335 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN; 336 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN;
336 } 337 }
337 338
339 // static
340 net::NetworkChangeNotifier::NetworkChangeCalculatorParams
341 NetworkChangeNotifierChromeos::NetworkChangeCalculatorParamsChromeos() {
342 NetworkChangeCalculatorParams params;
343 // Delay values arrived at by simple experimentation and adjusted so as to
344 // produce a single signal when switching between network connections.
345 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000);
346 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000);
347 params.connection_type_offline_delay_ = base::TimeDelta::FromMilliseconds(0);
348 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(0);
349 return params;
350 }
351
338 } // namespace chromeos 352 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698