| 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const std::string& device_id); | 98 const std::string& device_id); |
| 99 | 99 |
| 100 // Removes the passed-in legacy cache directory. | 100 // Removes the passed-in legacy cache directory. |
| 101 static void RemoveLegacyCacheDir(const base::FilePath& dir); | 101 static void RemoveLegacyCacheDir(const base::FilePath& dir); |
| 102 | 102 |
| 103 // Invokes |callback| after reloading |policy_key_|. | 103 // Invokes |callback| after reloading |policy_key_|. |
| 104 void ReloadPolicyKey(const base::Closure& callback); | 104 void ReloadPolicyKey(const base::Closure& callback); |
| 105 | 105 |
| 106 // Reads the contents of |path| into |key|. | 106 // Reads the contents of |path| into |key|. |
| 107 static void LoadPolicyKey(const base::FilePath& path, | 107 static void LoadPolicyKey(const base::FilePath& path, |
| 108 std::vector<uint8>* key); | 108 std::string* key); |
| 109 | 109 |
| 110 // Callback for the key reloading. | 110 // Callback for the key reloading. |
| 111 void OnPolicyKeyReloaded(std::vector<uint8>* key, | 111 void OnPolicyKeyReloaded(std::string* key, |
| 112 const base::Closure& callback); | 112 const base::Closure& callback); |
| 113 | 113 |
| 114 // Invokes |callback| after creating |policy_key_|, if it hasn't been created | 114 // Invokes |callback| after creating |policy_key_|, if it hasn't been created |
| 115 // yet; otherwise invokes |callback| immediately. | 115 // yet; otherwise invokes |callback| immediately. |
| 116 void EnsurePolicyKeyLoaded(const base::Closure& callback); | 116 void EnsurePolicyKeyLoaded(const base::Closure& callback); |
| 117 | 117 |
| 118 // Callback for getting the sanitized username from |cryptohome_client_|. | 118 // Callback for getting the sanitized username from |cryptohome_client_|. |
| 119 void OnGetSanitizedUsername(const base::Closure& callback, | 119 void OnGetSanitizedUsername(const base::Closure& callback, |
| 120 chromeos::DBusMethodCallStatus call_status, | 120 chromeos::DBusMethodCallStatus call_status, |
| 121 const std::string& sanitized_username); | 121 const std::string& sanitized_username); |
| 122 | 122 |
| 123 chromeos::CryptohomeClient* cryptohome_client_; | 123 chromeos::CryptohomeClient* cryptohome_client_; |
| 124 chromeos::SessionManagerClient* session_manager_client_; | 124 chromeos::SessionManagerClient* session_manager_client_; |
| 125 const std::string username_; | 125 const std::string username_; |
| 126 base::FilePath user_policy_key_dir_; | 126 base::FilePath user_policy_key_dir_; |
| 127 | 127 |
| 128 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; | 128 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; |
| 129 | 129 |
| 130 // TODO(mnissler): Remove all the legacy policy support members below after | 130 // TODO(mnissler): Remove all the legacy policy support members below after |
| 131 // the number of pre-M20 clients drops back to zero. | 131 // the number of pre-M20 clients drops back to zero. |
| 132 base::FilePath legacy_cache_dir_; | 132 base::FilePath legacy_cache_dir_; |
| 133 scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_; | 133 scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_; |
| 134 bool legacy_caches_loaded_; | 134 bool legacy_caches_loaded_; |
| 135 | 135 |
| 136 bool policy_key_loaded_; | 136 bool policy_key_loaded_; |
| 137 base::FilePath policy_key_path_; | 137 base::FilePath policy_key_path_; |
| 138 std::vector<uint8> policy_key_; | 138 std::string policy_key_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); | 140 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 } // namespace policy | 143 } // namespace policy |
| 144 | 144 |
| 145 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 145 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| OLD | NEW |