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

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

Issue 1454313002: Adding platform support check for NetworkObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Fixed typo. Created 5 years, 1 month 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.h ('k') | no next file » | 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.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 794 }
795 } 795 }
796 return result; 796 return result;
797 } 797 }
798 798
799 // static 799 // static
800 NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() { 800 NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() {
801 return new MockNetworkChangeNotifier(); 801 return new MockNetworkChangeNotifier();
802 } 802 }
803 803
804 bool NetworkChangeNotifier::IsNetworkObserverSupported() {
805 #if defined(OS_ANDROID)
806 // Notifications for NetworkObserver only implemented for Android
807 // versions >= L.
808 if (base::android::BuildInfo::GetInstance()->sdk_int() >=
809 base::android::SDK_VERSION_LOLLIPOP) {
810 return true;
Ryan Hamilton 2015/11/19 02:19:04 FWIW, you can just do: return base::android::Buil
Jana 2015/11/19 03:25:19 Done.
811 }
812 #endif
813 return false;
814 }
815
804 void NetworkChangeNotifier::AddIPAddressObserver(IPAddressObserver* observer) { 816 void NetworkChangeNotifier::AddIPAddressObserver(IPAddressObserver* observer) {
805 if (g_network_change_notifier) 817 if (g_network_change_notifier)
806 g_network_change_notifier->ip_address_observer_list_->AddObserver(observer); 818 g_network_change_notifier->ip_address_observer_list_->AddObserver(observer);
807 } 819 }
808 820
809 void NetworkChangeNotifier::AddConnectionTypeObserver( 821 void NetworkChangeNotifier::AddConnectionTypeObserver(
810 ConnectionTypeObserver* observer) { 822 ConnectionTypeObserver* observer) {
811 if (g_network_change_notifier) { 823 if (g_network_change_notifier) {
812 g_network_change_notifier->connection_type_observer_list_->AddObserver( 824 g_network_change_notifier->connection_type_observer_list_->AddObserver(
813 observer); 825 observer);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 1157
1146 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 1158 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
1147 DCHECK(!g_network_change_notifier); 1159 DCHECK(!g_network_change_notifier);
1148 g_network_change_notifier = network_change_notifier_; 1160 g_network_change_notifier = network_change_notifier_;
1149 } 1161 }
1150 1162
1151 void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() { 1163 void NetworkChangeNotifier::DNSObserver::OnInitialDNSConfigRead() {
1152 } 1164 }
1153 1165
1154 } // namespace net 1166 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698