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/cros_library.h" | 5 #include "chrome/browser/chromeos/cros/cros_library.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/burn_library.h" | 7 #include "chrome/browser/chromeos/cros/burn_library.h" |
8 #include "chrome/browser/chromeos/cros/cert_library.h" | 8 #include "chrome/browser/chromeos/cros/cert_library.h" |
9 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 9 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
10 #include "chrome/browser/chromeos/cros/library_loader.h" | 10 #include "chrome/browser/chromeos/cros/library_loader.h" |
11 #include "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
12 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | |
13 #include "third_party/cros/chromeos_cros_api.h" | 12 #include "third_party/cros/chromeos_cros_api.h" |
14 | 13 |
15 // Pass !libcros_loaded_ to GetDefaultImpl instead of use_stub_impl_ so that | 14 // Pass !libcros_loaded_ to GetDefaultImpl instead of use_stub_impl_ so that |
16 // we load the stub impl regardless of whether use_stub was specified or the | 15 // we load the stub impl regardless of whether use_stub was specified or the |
17 // library failed to load. | 16 // library failed to load. |
18 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \ | 17 #define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \ |
19 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \ | 18 class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \ |
20 return var_prefix##_lib_.GetDefaultImpl(!libcros_loaded_); \ | 19 return var_prefix##_lib_.GetDefaultImpl(!libcros_loaded_); \ |
21 } | 20 } |
22 | 21 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 72 |
74 // static | 73 // static |
75 CrosLibrary* CrosLibrary::Get() { | 74 CrosLibrary* CrosLibrary::Get() { |
76 return g_cros_library; | 75 return g_cros_library; |
77 } | 76 } |
78 | 77 |
79 DEFINE_GET_LIBRARY_METHOD(Burn, burn); | 78 DEFINE_GET_LIBRARY_METHOD(Burn, burn); |
80 DEFINE_GET_LIBRARY_METHOD(Cert, cert); | 79 DEFINE_GET_LIBRARY_METHOD(Cert, cert); |
81 DEFINE_GET_LIBRARY_METHOD(Cryptohome, crypto); | 80 DEFINE_GET_LIBRARY_METHOD(Cryptohome, crypto); |
82 DEFINE_GET_LIBRARY_METHOD(Network, network); | 81 DEFINE_GET_LIBRARY_METHOD(Network, network); |
83 DEFINE_GET_LIBRARY_METHOD(ScreenLock, screen_lock); | |
84 | 82 |
85 bool CrosLibrary::LoadLibcros() { | 83 bool CrosLibrary::LoadLibcros() { |
86 if (!libcros_loaded_ && !load_error_) { | 84 if (!libcros_loaded_ && !load_error_) { |
87 if (!library_loader_) { | 85 if (!library_loader_) { |
88 library_loader_ = LibraryLoader::GetImpl(); | 86 library_loader_ = LibraryLoader::GetImpl(); |
89 own_library_loader_ = true; | 87 own_library_loader_ = true; |
90 } | 88 } |
91 libcros_loaded_ = library_loader_->Load(&load_error_string_); | 89 libcros_loaded_ = library_loader_->Load(&load_error_string_); |
92 load_error_ = !libcros_loaded_; | 90 load_error_ = !libcros_loaded_; |
93 } | 91 } |
(...skipping 22 matching lines...) Expand all Loading... |
116 // Reset load flags when loader changes. Otherwise some tests are really not | 114 // Reset load flags when loader changes. Otherwise some tests are really not |
117 // going to be happy. | 115 // going to be happy. |
118 library_->libcros_loaded_ = false; | 116 library_->libcros_loaded_ = false; |
119 library_->load_error_ = false; | 117 library_->load_error_ = false; |
120 } | 118 } |
121 | 119 |
122 DEFINE_SET_LIBRARY_METHOD(Cert, cert); | 120 DEFINE_SET_LIBRARY_METHOD(Cert, cert); |
123 DEFINE_SET_LIBRARY_METHOD(Burn, burn); | 121 DEFINE_SET_LIBRARY_METHOD(Burn, burn); |
124 DEFINE_SET_LIBRARY_METHOD(Cryptohome, crypto); | 122 DEFINE_SET_LIBRARY_METHOD(Cryptohome, crypto); |
125 DEFINE_SET_LIBRARY_METHOD(Network, network); | 123 DEFINE_SET_LIBRARY_METHOD(Network, network); |
126 DEFINE_SET_LIBRARY_METHOD(ScreenLock, screen_lock); | |
127 | 124 |
128 } // namespace chromeos | 125 } // namespace chromeos |
OLD | NEW |