OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/tpm_token_loader.h" | 5 #include "chromeos/tpm_token_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool success) { | 43 bool success) { |
44 runner->PostTask(FROM_HERE, base::Bind(callback, success)); | 44 runner->PostTask(FROM_HERE, base::Bind(callback, success)); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 static TPMTokenLoader* g_tpm_token_loader = NULL; | 49 static TPMTokenLoader* g_tpm_token_loader = NULL; |
50 | 50 |
51 // static | 51 // static |
52 void TPMTokenLoader::Initialize() { | 52 void TPMTokenLoader::Initialize() { |
| 53 if (g_tpm_token_loader && g_tpm_token_loader->initialized_for_test_) |
| 54 return; |
53 CHECK(!g_tpm_token_loader); | 55 CHECK(!g_tpm_token_loader); |
54 g_tpm_token_loader = new TPMTokenLoader(false /*for_test*/); | 56 g_tpm_token_loader = new TPMTokenLoader(false /*for_test*/); |
55 } | 57 } |
56 | 58 |
57 // static | 59 // static |
58 void TPMTokenLoader::InitializeForTest() { | 60 void TPMTokenLoader::InitializeForTest() { |
59 CHECK(!g_tpm_token_loader); | 61 CHECK(!g_tpm_token_loader); |
60 g_tpm_token_loader = new TPMTokenLoader(true /*for_test*/); | 62 g_tpm_token_loader = new TPMTokenLoader(true /*for_test*/); |
61 } | 63 } |
62 | 64 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 296 } |
295 tpm_ready_callback_list_.clear(); | 297 tpm_ready_callback_list_.clear(); |
296 } | 298 } |
297 | 299 |
298 void TPMTokenLoader::LoggedInStateChanged() { | 300 void TPMTokenLoader::LoggedInStateChanged() { |
299 VLOG(1) << "LoggedInStateChanged"; | 301 VLOG(1) << "LoggedInStateChanged"; |
300 MaybeStartTokenInitialization(); | 302 MaybeStartTokenInitialization(); |
301 } | 303 } |
302 | 304 |
303 } // namespace chromeos | 305 } // namespace chromeos |
OLD | NEW |