diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 03:16:51 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 03:16:51 +0000 |
commit | 7a897450346de96ec4a67992b27df9c36a1f6680 (patch) | |
tree | 5e6966cadc363369b685c60a024db049d01eeaeb /chrome/browser/chromeos/cros/network_library.cc | |
parent | 3c5f0b34b61ce1e33646931bd148605b862ceed6 (diff) | |
download | chromium_src-7a897450346de96ec4a67992b27df9c36a1f6680.zip chromium_src-7a897450346de96ec4a67992b27df9c36a1f6680.tar.gz chromium_src-7a897450346de96ec4a67992b27df9c36a1f6680.tar.bz2 |
cros_library: Remove CrosLibrary
CrosLibray was just wrapping NetworkLibrary. This patch is essentially
a global replace of the following:
CrosLibrary::Get()->GetNetworkLibrary() -> NetworkLibrary::Get()
CrosLibrary::Initialize/Shutdown/etc are replaced with
NetworkLibrary::Initialize/Shutdown/etc.
BUG=126719
TEST=networking works as before on the chromebook
TBR=hashimoto@chromium.org
# for some non-chromeos files under chrome/browser
Review URL: https://codereview.chromium.org/19340002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211912 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/cros/network_library.cc')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 97448e9..2980a8b 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -11,7 +11,6 @@ #include "base/json/json_writer.h" // for debug output only. #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversion_utils.h" -#include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/native_network_constants.h" #include "chrome/browser/chromeos/cros/native_network_parser.h" #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" @@ -90,9 +89,10 @@ using content::BrowserThread; namespace chromeos { -// Local constants. namespace { +static NetworkLibrary* g_network_library = NULL; + // Default value of the SIM unlock retries count. It is updated to the real // retries count once cellular device with SIM card is initialized. // If cellular device doesn't have SIM card, then retries are never used. @@ -512,7 +512,7 @@ void Network::InitIPAddressCallback( const NetworkIPConfigVector& ip_configs, const std::string& hardware_address) { Network* network = - CrosLibrary::Get()->GetNetworkLibrary()->FindNetworkByPath(service_path); + NetworkLibrary::Get()->FindNetworkByPath(service_path); if (!network) return; for (size_t i = 0; i < ip_configs.size(); ++i) { @@ -1365,4 +1365,32 @@ NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { return impl; } +// static +void NetworkLibrary::Initialize(bool use_stub) { + CHECK(!g_network_library) + << "NetworkLibrary: Multiple calls to Initialize()."; + g_network_library = NetworkLibrary::GetImpl(use_stub); + VLOG_IF(1, use_stub) << "NetworkLibrary Initialized with Stub Impl."; +} + +// static +void NetworkLibrary::Shutdown() { + VLOG(1) << "NetworkLibrary Shutting down..."; + delete g_network_library; + g_network_library = NULL; + VLOG(1) << " NetworkLibrary Shutdown completed."; +} + +// static +NetworkLibrary* NetworkLibrary::Get() { + return g_network_library; +} + +// static +void NetworkLibrary::SetForTesting(NetworkLibrary* library) { + if (g_network_library) + delete g_network_library; + g_network_library = library; +} + } // namespace chromeos |