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

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

Issue 9540011: [net] Add DNS-related signals and NetLog to NetworkChangeNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved DNS watch to a separate IO thread on mac. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/network_change_notifier_linux.h » ('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.h" 5 #include "net/base/network_change_notifier.h"
6 #include "net/base/network_change_notifier_factory.h" 6 #include "net/base/network_change_notifier_factory.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include "net/base/network_change_notifier_win.h" 9 #include "net/base/network_change_notifier_win.h"
10 #elif defined(OS_LINUX) || defined(OS_ANDROID) 10 #elif defined(OS_LINUX) || defined(OS_ANDROID)
(...skipping 20 matching lines...) Expand all
31 virtual bool IsCurrentlyOffline() const { return false; } 31 virtual bool IsCurrentlyOffline() const { return false; }
32 }; 32 };
33 33
34 } // namespace 34 } // namespace
35 35
36 NetworkChangeNotifier::~NetworkChangeNotifier() { 36 NetworkChangeNotifier::~NetworkChangeNotifier() {
37 DCHECK_EQ(this, g_network_change_notifier); 37 DCHECK_EQ(this, g_network_change_notifier);
38 g_network_change_notifier = NULL; 38 g_network_change_notifier = NULL;
39 } 39 }
40 40
41 bool NetworkChangeNotifier::IsCurrentlyWatchingDNS() const {
42 return false;
43 }
44
41 // static 45 // static
42 void NetworkChangeNotifier::SetFactory( 46 void NetworkChangeNotifier::SetFactory(
43 NetworkChangeNotifierFactory* factory) { 47 NetworkChangeNotifierFactory* factory) {
44 CHECK(!g_network_change_notifier_factory); 48 CHECK(!g_network_change_notifier_factory);
45 g_network_change_notifier_factory = factory; 49 g_network_change_notifier_factory = factory;
46 } 50 }
47 51
48 // static 52 // static
49 NetworkChangeNotifier* NetworkChangeNotifier::Create() { 53 NetworkChangeNotifier* NetworkChangeNotifier::Create() {
50 if (g_network_change_notifier_factory) 54 if (g_network_change_notifier_factory)
(...skipping 18 matching lines...) Expand all
69 #endif 73 #endif
70 } 74 }
71 75
72 // static 76 // static
73 bool NetworkChangeNotifier::IsOffline() { 77 bool NetworkChangeNotifier::IsOffline() {
74 return g_network_change_notifier && 78 return g_network_change_notifier &&
75 g_network_change_notifier->IsCurrentlyOffline(); 79 g_network_change_notifier->IsCurrentlyOffline();
76 } 80 }
77 81
78 // static 82 // static
83 bool NetworkChangeNotifier::IsWatchingDNS() {
84 return g_network_change_notifier &&
85 g_network_change_notifier->IsCurrentlyWatchingDNS();
86 }
87
88 // static
79 NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() { 89 NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() {
80 return new MockNetworkChangeNotifier(); 90 return new MockNetworkChangeNotifier();
81 } 91 }
82 92
83 void NetworkChangeNotifier::AddIPAddressObserver(IPAddressObserver* observer) { 93 void NetworkChangeNotifier::AddIPAddressObserver(IPAddressObserver* observer) {
84 if (g_network_change_notifier) 94 if (g_network_change_notifier)
85 g_network_change_notifier->ip_address_observer_list_->AddObserver(observer); 95 g_network_change_notifier->ip_address_observer_list_->AddObserver(observer);
86 } 96 }
87 97
88 void NetworkChangeNotifier::AddOnlineStateObserver( 98 void NetworkChangeNotifier::AddOnlineStateObserver(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DCHECK(g_network_change_notifier); 173 DCHECK(g_network_change_notifier);
164 g_network_change_notifier = NULL; 174 g_network_change_notifier = NULL;
165 } 175 }
166 176
167 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 177 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
168 DCHECK(!g_network_change_notifier); 178 DCHECK(!g_network_change_notifier);
169 g_network_change_notifier = network_change_notifier_; 179 g_network_change_notifier = network_change_notifier_;
170 } 180 }
171 181
172 } // namespace net 182 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/network_change_notifier_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698