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

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 7891021: Use stub impl when libcros fails to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase with power library changes Created 9 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 | 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 #include "chrome/browser/chromeos/cros/network_library.h" 5 #include "chrome/browser/chromeos/cros/network_library.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <dbus/dbus-glib.h> 8 #include <dbus/dbus-glib.h>
9 #include <dbus/dbus-gtype-specialized.h> 9 #include <dbus/dbus-gtype-specialized.h>
10 #include <glib-object.h> 10 #include <glib-object.h>
(...skipping 4922 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 4933
4934 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { 4934 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) {
4935 ip_configs_.push_back(ipconfig); 4935 ip_configs_.push_back(ipconfig);
4936 } 4936 }
4937 4937
4938 ///////////////////////////////////////////////////////////////////////////// 4938 /////////////////////////////////////////////////////////////////////////////
4939 4939
4940 // static 4940 // static
4941 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { 4941 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) {
4942 NetworkLibrary* impl; 4942 NetworkLibrary* impl;
4943 // If CrosLibrary failed to load, use the stub implementation, since the
4944 // cros implementation would crash on any libcros call.
4945 if (!stub && !CrosLibrary::Get()->libcros_loaded()) {
4946 LOG(WARNING) << "NetworkLibrary: falling back to stub impl.";
4947 stub = true;
4948 }
4949 if (stub) 4943 if (stub)
4950 impl = new NetworkLibraryImplStub(); 4944 impl = new NetworkLibraryImplStub();
4951 else 4945 else
4952 impl = new NetworkLibraryImplCros(); 4946 impl = new NetworkLibraryImplCros();
4953 impl->Init(); 4947 impl->Init();
4954
4955 return impl; 4948 return impl;
4956 } 4949 }
4957 4950
4958 ///////////////////////////////////////////////////////////////////////////// 4951 /////////////////////////////////////////////////////////////////////////////
4959 4952
4960 } // namespace chromeos 4953 } // namespace chromeos
4961 4954
4962 // Allows InvokeLater without adding refcounting. This class is a Singleton and 4955 // Allows InvokeLater without adding refcounting. This class is a Singleton and
4963 // won't be deleted until its last InvokeLater is run. 4956 // won't be deleted until its last InvokeLater is run.
4964 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); 4957 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/mount_library.cc ('k') | chrome/browser/chromeos/cros/power_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698