OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 | 13 |
14 class PrefRegistrySimple; | 14 class PrefRegistrySimple; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 namespace policy { | 17 namespace policy { |
18 | 18 |
19 // Helper class to store/retrieve DM token to/from the local state. This is | 19 // Helper class to store/retrieve DM token to/from the local state. This is |
20 // needed for Active Directory management because AD devices lacks DM token in | 20 // needed for Active Directory management because AD devices lacks DM token in |
21 // the policies. DM token will be used in the future for ARC++ integration. | 21 // the policies. DM token will be used in the future for ARC integration. |
22 // | 22 // |
23 // Note that requests must be made from the UI thread because SystemSaltGetter | 23 // Note that requests must be made from the UI thread because SystemSaltGetter |
24 // calls CryptohomeClient which must be called from the UI thread. | 24 // calls CryptohomeClient which must be called from the UI thread. |
25 class DMTokenStorage { | 25 class DMTokenStorage { |
26 public: | 26 public: |
27 using StoreCallback = base::OnceCallback<void(bool success)>; | 27 using StoreCallback = base::OnceCallback<void(bool success)>; |
28 using RetrieveCallback = | 28 using RetrieveCallback = |
29 base::OnceCallback<void(const std::string& dm_token)>; | 29 base::OnceCallback<void(const std::string& dm_token)>; |
30 | 30 |
31 explicit DMTokenStorage(PrefService* local_state); | 31 explicit DMTokenStorage(PrefService* local_state); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Stored |dm_token| while waiting for system salt. | 78 // Stored |dm_token| while waiting for system salt. |
79 std::string dm_token_; | 79 std::string dm_token_; |
80 StoreCallback store_callback_; | 80 StoreCallback store_callback_; |
81 std::vector<RetrieveCallback> retrieve_callbacks_; | 81 std::vector<RetrieveCallback> retrieve_callbacks_; |
82 base::WeakPtrFactory<DMTokenStorage> weak_ptr_factory_; | 82 base::WeakPtrFactory<DMTokenStorage> weak_ptr_factory_; |
83 }; | 83 }; |
84 | 84 |
85 } // namespace policy | 85 } // namespace policy |
86 | 86 |
87 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ | 87 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DM_TOKEN_STORAGE_H_ |
OLD | NEW |