| OLD | NEW |
| 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 4860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4871 | 4871 |
| 4872 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { | 4872 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { |
| 4873 ip_configs_.push_back(ipconfig); | 4873 ip_configs_.push_back(ipconfig); |
| 4874 } | 4874 } |
| 4875 | 4875 |
| 4876 ///////////////////////////////////////////////////////////////////////////// | 4876 ///////////////////////////////////////////////////////////////////////////// |
| 4877 | 4877 |
| 4878 // static | 4878 // static |
| 4879 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { | 4879 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { |
| 4880 NetworkLibrary* impl; | 4880 NetworkLibrary* impl; |
| 4881 // If CrosLibrary failed to load, use the stub implementation, since the | |
| 4882 // cros implementation would crash on any libcros call. | |
| 4883 if (!CrosLibrary::Get()->libcros_loaded()) { | |
| 4884 LOG(WARNING) << "NetworkLibrary: falling back to stub impl."; | |
| 4885 stub = true; | |
| 4886 } | |
| 4887 if (stub) | 4881 if (stub) |
| 4888 impl = new NetworkLibraryImplStub(); | 4882 impl = new NetworkLibraryImplStub(); |
| 4889 else | 4883 else |
| 4890 impl = new NetworkLibraryImplCros(); | 4884 impl = new NetworkLibraryImplCros(); |
| 4891 impl->Init(); | 4885 impl->Init(); |
| 4892 | |
| 4893 return impl; | 4886 return impl; |
| 4894 } | 4887 } |
| 4895 | 4888 |
| 4896 ///////////////////////////////////////////////////////////////////////////// | 4889 ///////////////////////////////////////////////////////////////////////////// |
| 4897 | 4890 |
| 4898 } // namespace chromeos | 4891 } // namespace chromeos |
| 4899 | 4892 |
| 4900 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 4893 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 4901 // won't be deleted until its last InvokeLater is run. | 4894 // won't be deleted until its last InvokeLater is run. |
| 4902 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 4895 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
| OLD | NEW |