| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ | 6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void RemoveKeys(const std::string& app_id, const base::Closure& callback); | 59 void RemoveKeys(const std::string& app_id, const base::Closure& callback); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 // Initializes the database if necessary, and runs |done_closure| when done. | 62 // Initializes the database if necessary, and runs |done_closure| when done. |
| 63 void LazyInitialize(const base::Closure& done_closure); | 63 void LazyInitialize(const base::Closure& done_closure); |
| 64 | 64 |
| 65 void DidInitialize(bool success); | 65 void DidInitialize(bool success); |
| 66 void DidLoadKeys(bool success, | 66 void DidLoadKeys(bool success, |
| 67 std::unique_ptr<std::vector<EncryptionData>> entries); | 67 std::unique_ptr<std::vector<EncryptionData>> entries); |
| 68 | 68 |
| 69 void DidStoreKeys(const std::string& app_id, | 69 void DidStoreKeys(const KeyPair& pair, |
| 70 const KeyPair& pair, | |
| 71 const std::string& auth_secret, | 70 const std::string& auth_secret, |
| 72 const KeysCallback& callback, | 71 const KeysCallback& callback, |
| 73 bool success); | 72 bool success); |
| 74 | 73 |
| 75 void DidRemoveKeys(const std::string& app_id, | 74 void DidRemoveKeys(const base::Closure& callback, bool success); |
| 76 const base::Closure& callback, | |
| 77 bool success); | |
| 78 | 75 |
| 79 // Private implementations of the API that will be executed when the database | 76 // Private implementations of the API that will be executed when the database |
| 80 // has either been successfully loaded, or failed to load. | 77 // has either been successfully loaded, or failed to load. |
| 81 | 78 |
| 82 void GetKeysAfterInitialize(const std::string& app_id, | 79 void GetKeysAfterInitialize(const std::string& app_id, |
| 83 const KeysCallback& callback); | 80 const KeysCallback& callback); |
| 84 void CreateKeysAfterInitialize(const std::string& app_id, | 81 void CreateKeysAfterInitialize(const std::string& app_id, |
| 85 const KeysCallback& callback); | 82 const KeysCallback& callback); |
| 86 void RemoveKeysAfterInitialize(const std::string& app_id, | 83 void RemoveKeysAfterInitialize(const std::string& app_id, |
| 87 const base::Closure& callback); | 84 const base::Closure& callback); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 110 std::map<std::string, std::string> auth_secrets_; | 107 std::map<std::string, std::string> auth_secrets_; |
| 111 | 108 |
| 112 base::WeakPtrFactory<GCMKeyStore> weak_factory_; | 109 base::WeakPtrFactory<GCMKeyStore> weak_factory_; |
| 113 | 110 |
| 114 DISALLOW_COPY_AND_ASSIGN(GCMKeyStore); | 111 DISALLOW_COPY_AND_ASSIGN(GCMKeyStore); |
| 115 }; | 112 }; |
| 116 | 113 |
| 117 } // namespace gcm | 114 } // namespace gcm |
| 118 | 115 |
| 119 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ | 116 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_KEY_STORE_H_ |
| OLD | NEW |