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

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

Issue 9373039: Allow dbus clients to silence logging when a service is unavailable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This implementation of NetworkChangeNotifier's offline state detection 5 // This implementation of NetworkChangeNotifier's offline state detection
6 // depends on D-Bus and NetworkManager, and is known to work on at least 6 // depends on D-Bus and NetworkManager, and is known to work on at least
7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this 7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this
8 // implementation will always behave as if it is online. 8 // implementation will always behave as if it is online.
9 9
10 #include "net/base/network_change_notifier_linux.h" 10 #include "net/base/network_change_notifier_linux.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 helper_thread_id_ = base::PlatformThread::CurrentId(); 129 helper_thread_id_ = base::PlatformThread::CurrentId();
130 130
131 if (!system_bus_) { 131 if (!system_bus_) {
132 dbus::Bus::Options options; 132 dbus::Bus::Options options;
133 options.bus_type = dbus::Bus::SYSTEM; 133 options.bus_type = dbus::Bus::SYSTEM;
134 options.connection_type = dbus::Bus::PRIVATE; 134 options.connection_type = dbus::Bus::PRIVATE;
135 system_bus_ = new dbus::Bus(options); 135 system_bus_ = new dbus::Bus(options);
136 } 136 }
137 137
138 dbus::ObjectProxy* proxy = 138 dbus::ObjectProxy* proxy =
139 system_bus_->GetObjectProxy(kNetworkManagerServiceName, 139 system_bus_->GetObjectProxyIgnoreUnknownService(
satorux1 2012/02/10 08:12:52 Please add some comment why you do this. Having a
adamk 2012/02/10 17:57:16 Split out into another patch. Sorry, the lack of c
140 kNetworkManagerPath); 140 kNetworkManagerServiceName, kNetworkManagerPath);
141 141
142 // Get the initial state asynchronously. 142 // Get the initial state asynchronously.
143 dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, "Get"); 143 dbus::MethodCall method_call(DBUS_INTERFACE_PROPERTIES, "Get");
144 dbus::MessageWriter builder(&method_call); 144 dbus::MessageWriter builder(&method_call);
145 builder.AppendString(kNetworkManagerInterface); 145 builder.AppendString(kNetworkManagerInterface);
146 builder.AppendString("State"); 146 builder.AppendString("State");
147 proxy->CallMethod( 147 proxy->CallMethod(
148 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 148 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
149 base::Bind(&NetworkManagerApi::OnInitialResponse, 149 base::Bind(&NetworkManagerApi::OnInitialResponse,
150 ptr_factory_.GetWeakPtr())); 150 ptr_factory_.GetWeakPtr()));
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // Stopping from here allows us to sanity- check that the notifier 457 // Stopping from here allows us to sanity- check that the notifier
458 // thread shut down properly. 458 // thread shut down properly.
459 notifier_thread_->Stop(); 459 notifier_thread_->Stop();
460 } 460 }
461 461
462 bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const { 462 bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const {
463 return notifier_thread_->IsCurrentlyOffline(); 463 return notifier_thread_->IsCurrentlyOffline();
464 } 464 }
465 465
466 } // namespace net 466 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698