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

Side by Side Diff: net/base/network_change_notifier_linux.cc

Issue 1306653003: Add connection type to NCN::MaxBandwidthChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra space in comment Created 5 years, 3 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 | « net/base/network_change_notifier.cc ('k') | net/base/network_change_notifier_mac.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 "net/base/network_change_notifier_linux.h" 5 #include "net/base/network_change_notifier_linux.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "net/base/address_tracker_linux.h" 10 #include "net/base/address_tracker_linux.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 NetworkChangeNotifier::NotifyObserversOfIPAddressChange(); 75 NetworkChangeNotifier::NotifyObserversOfIPAddressChange();
76 // When the IP address of a network interface is added/deleted, the 76 // When the IP address of a network interface is added/deleted, the
77 // connection type may have changed. 77 // connection type may have changed.
78 OnLinkChanged(); 78 OnLinkChanged();
79 } 79 }
80 80
81 void NetworkChangeNotifierLinux::Thread::OnLinkChanged() { 81 void NetworkChangeNotifierLinux::Thread::OnLinkChanged() {
82 if (last_type_ != GetCurrentConnectionType()) { 82 if (last_type_ != GetCurrentConnectionType()) {
83 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange(); 83 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange();
84 last_type_ = GetCurrentConnectionType(); 84 last_type_ = GetCurrentConnectionType();
85 double max_bandwidth_mbps =
86 NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
87 last_type_ == CONNECTION_NONE ? SUBTYPE_NONE : SUBTYPE_UNKNOWN);
88 NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChange(
89 max_bandwidth_mbps, last_type_);
85 } 90 }
86 } 91 }
87 92
88 NetworkChangeNotifierLinux::NetworkChangeNotifierLinux( 93 NetworkChangeNotifierLinux::NetworkChangeNotifierLinux(
89 const base::hash_set<std::string>& ignored_interfaces) 94 const base::hash_set<std::string>& ignored_interfaces)
90 : NetworkChangeNotifier(NetworkChangeCalculatorParamsLinux()), 95 : NetworkChangeNotifier(NetworkChangeCalculatorParamsLinux()),
91 notifier_thread_(new Thread(ignored_interfaces)) { 96 notifier_thread_(new Thread(ignored_interfaces)) {
92 // We create this notifier thread because the notification implementation 97 // We create this notifier thread because the notification implementation
93 // needs a MessageLoopForIO, and there's no guarantee that 98 // needs a MessageLoopForIO, and there's no guarantee that
94 // MessageLoop::current() meets that criterion. 99 // MessageLoop::current() meets that criterion.
(...skipping 25 matching lines...) Expand all
120 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { 125 NetworkChangeNotifierLinux::GetCurrentConnectionType() const {
121 return notifier_thread_->GetCurrentConnectionType(); 126 return notifier_thread_->GetCurrentConnectionType();
122 } 127 }
123 128
124 const internal::AddressTrackerLinux* 129 const internal::AddressTrackerLinux*
125 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { 130 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const {
126 return notifier_thread_->address_tracker(); 131 return notifier_thread_->address_tracker();
127 } 132 }
128 133
129 } // namespace net 134 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | net/base/network_change_notifier_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698