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

Side by Side Diff: net/base/network_change_notifier.h

Issue 1327923002: Migrates QUIC sessions to a new network when old network is (about to be) disconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Naming fixes. Created 5 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
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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 SUBTYPE_WIFI_G, 94 SUBTYPE_WIFI_G,
95 SUBTYPE_WIFI_N, 95 SUBTYPE_WIFI_N,
96 SUBTYPE_WIFI_AC, 96 SUBTYPE_WIFI_AC,
97 SUBTYPE_WIFI_AD, 97 SUBTYPE_WIFI_AD,
98 SUBTYPE_UNKNOWN, 98 SUBTYPE_UNKNOWN,
99 SUBTYPE_NONE, 99 SUBTYPE_NONE,
100 SUBTYPE_OTHER, 100 SUBTYPE_OTHER,
101 SUBTYPE_LAST = SUBTYPE_OTHER 101 SUBTYPE_LAST = SUBTYPE_OTHER
102 }; 102 };
103 103
104 // Types of network changes specified to
105 // NotifyObserversOfSpecificNetworkChange.
106 enum NetworkChangeType {
107 CONNECTED,
108 DISCONNECTED,
109 SOON_TO_DISCONNECT,
110 MADE_DEFAULT
111 };
112
104 class NET_EXPORT IPAddressObserver { 113 class NET_EXPORT IPAddressObserver {
105 public: 114 public:
106 // Will be called when the IP address of the primary interface changes. 115 // Will be called when the IP address of the primary interface changes.
107 // This includes when the primary interface itself changes. 116 // This includes when the primary interface itself changes.
108 virtual void OnIPAddressChanged() = 0; 117 virtual void OnIPAddressChanged() = 0;
109 118
110 protected: 119 protected:
111 IPAddressObserver() {} 120 IPAddressObserver() {}
112 virtual ~IPAddressObserver() {} 121 virtual ~IPAddressObserver() {}
113 122
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 static void RemoveDNSObserver(DNSObserver* observer); 391 static void RemoveDNSObserver(DNSObserver* observer);
383 static void RemoveNetworkChangeObserver(NetworkChangeObserver* observer); 392 static void RemoveNetworkChangeObserver(NetworkChangeObserver* observer);
384 static void RemoveMaxBandwidthObserver(MaxBandwidthObserver* observer); 393 static void RemoveMaxBandwidthObserver(MaxBandwidthObserver* observer);
385 static void RemoveNetworkObserver(NetworkObserver* observer); 394 static void RemoveNetworkObserver(NetworkObserver* observer);
386 395
387 // Allow unit tests to trigger notifications. 396 // Allow unit tests to trigger notifications.
388 static void NotifyObserversOfIPAddressChangeForTests(); 397 static void NotifyObserversOfIPAddressChangeForTests();
389 static void NotifyObserversOfConnectionTypeChangeForTests( 398 static void NotifyObserversOfConnectionTypeChangeForTests(
390 ConnectionType type); 399 ConnectionType type);
391 static void NotifyObserversOfNetworkChangeForTests(ConnectionType type); 400 static void NotifyObserversOfNetworkChangeForTests(ConnectionType type);
401 static void NotifyObserversOfSpecificNetworkChangeForTests(
402 NetworkChangeType type,
403 NetworkHandle network);
392 static void NotifyObserversOfInitialDNSConfigReadForTests(); 404 static void NotifyObserversOfInitialDNSConfigReadForTests();
393 static void NotifyObserversOfMaxBandwidthChangeForTests( 405 static void NotifyObserversOfMaxBandwidthChangeForTests(
394 double max_bandwidth_mbps, 406 double max_bandwidth_mbps,
395 ConnectionType type); 407 ConnectionType type);
396 408
397 // Enable or disable notifications from the host. After setting to true, be 409 // Enable or disable notifications from the host. After setting to true, be
398 // sure to pump the RunLoop until idle to finish any preexisting 410 // sure to pump the RunLoop until idle to finish any preexisting
399 // notifications. To use this, it must must be called before a 411 // notifications. To use this, it must must be called before a
400 // NetworkChangeNotifier is created. 412 // NetworkChangeNotifier is created.
401 static void SetTestNotificationsOnly(bool test_only); 413 static void SetTestNotificationsOnly(bool test_only);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 public: 445 public:
434 DisableForTest(); 446 DisableForTest();
435 ~DisableForTest(); 447 ~DisableForTest();
436 448
437 private: 449 private:
438 // The original NetworkChangeNotifier to be restored on destruction. 450 // The original NetworkChangeNotifier to be restored on destruction.
439 NetworkChangeNotifier* network_change_notifier_; 451 NetworkChangeNotifier* network_change_notifier_;
440 }; 452 };
441 453
442 protected: 454 protected:
443 // Types of network changes specified to
444 // NotifyObserversOfSpecificNetworkChange.
445 enum NetworkChangeType {
446 CONNECTED,
447 DISCONNECTED,
448 SOON_TO_DISCONNECT,
449 MADE_DEFAULT
450 };
451
452 // NetworkChanged signal is calculated from the IPAddressChanged and 455 // NetworkChanged signal is calculated from the IPAddressChanged and
453 // ConnectionTypeChanged signals. Delay parameters control how long to delay 456 // ConnectionTypeChanged signals. Delay parameters control how long to delay
454 // producing NetworkChanged signal after particular input signals so as to 457 // producing NetworkChanged signal after particular input signals so as to
455 // combine duplicates. In other words if an input signal is repeated within 458 // combine duplicates. In other words if an input signal is repeated within
456 // the corresponding delay period, only one resulting NetworkChange signal is 459 // the corresponding delay period, only one resulting NetworkChange signal is
457 // produced. 460 // produced.
458 struct NET_EXPORT NetworkChangeCalculatorParams { 461 struct NET_EXPORT NetworkChangeCalculatorParams {
459 NetworkChangeCalculatorParams(); 462 NetworkChangeCalculatorParams();
460 // Controls delay after OnIPAddressChanged when transitioning from an 463 // Controls delay after OnIPAddressChanged when transitioning from an
461 // offline state. 464 // offline state.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 561
559 // Set true to disable non-test notifications (to prevent flakes in tests). 562 // Set true to disable non-test notifications (to prevent flakes in tests).
560 static bool test_notifications_only_; 563 static bool test_notifications_only_;
561 564
562 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 565 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
563 }; 566 };
564 567
565 } // namespace net 568 } // namespace net
566 569
567 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 570 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698