OLD | NEW |
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 "chrome/browser/chromeos/cros/cros_library.h" | 5 #include "chrome/browser/chromeos/cros/cros_library.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/cert_library.h" | |
8 #include "chrome/browser/chromeos/cros/network_library.h" | 7 #include "chrome/browser/chromeos/cros/network_library.h" |
9 | 8 |
10 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \ | 9 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \ |
11 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \ | 10 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \ |
12 return var_prefix##_lib_.GetDefaultImpl(use_stub_impl_); \ | 11 return var_prefix##_lib_.GetDefaultImpl(use_stub_impl_); \ |
13 } | 12 } |
14 | 13 |
15 #define DEFINE_SET_LIBRARY_METHOD(class_prefix, var_prefix) \ | 14 #define DEFINE_SET_LIBRARY_METHOD(class_prefix, var_prefix) \ |
16 void CrosLibrary::TestApi::Set##class_prefix##Library( \ | 15 void CrosLibrary::TestApi::Set##class_prefix##Library( \ |
17 class_prefix##Library* library, bool own) { \ | 16 class_prefix##Library* library, bool own) { \ |
(...skipping 26 matching lines...) Expand all Loading... |
44 delete g_cros_library; | 43 delete g_cros_library; |
45 g_cros_library = NULL; | 44 g_cros_library = NULL; |
46 VLOG(1) << " CrosLibrary Shutdown completed."; | 45 VLOG(1) << " CrosLibrary Shutdown completed."; |
47 } | 46 } |
48 | 47 |
49 // static | 48 // static |
50 CrosLibrary* CrosLibrary::Get() { | 49 CrosLibrary* CrosLibrary::Get() { |
51 return g_cros_library; | 50 return g_cros_library; |
52 } | 51 } |
53 | 52 |
54 DEFINE_GET_LIBRARY_METHOD(Cert, cert); | |
55 DEFINE_GET_LIBRARY_METHOD(Network, network); | 53 DEFINE_GET_LIBRARY_METHOD(Network, network); |
56 | 54 |
57 CrosLibrary::TestApi* CrosLibrary::GetTestApi() { | 55 CrosLibrary::TestApi* CrosLibrary::GetTestApi() { |
58 if (!test_api_.get()) | 56 if (!test_api_.get()) |
59 test_api_.reset(new TestApi(this)); | 57 test_api_.reset(new TestApi(this)); |
60 return test_api_.get(); | 58 return test_api_.get(); |
61 } | 59 } |
62 | 60 |
63 DEFINE_SET_LIBRARY_METHOD(Cert, cert); | |
64 DEFINE_SET_LIBRARY_METHOD(Network, network); | 61 DEFINE_SET_LIBRARY_METHOD(Network, network); |
65 | 62 |
66 } // namespace chromeos | 63 } // namespace chromeos |
OLD | NEW |