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_ENCRYPTION_PROVIDER_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 6 #define COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // avoid needing a blocking task runner for anything using GCMDriver. | 69 // avoid needing a blocking task runner for anything using GCMDriver. |
70 void Init( | 70 void Init( |
71 const base::FilePath& store_path, | 71 const base::FilePath& store_path, |
72 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 72 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
73 | 73 |
74 // Retrieves the public key and authentication secret associated with the | 74 // Retrieves the public key and authentication secret associated with the |
75 // |app_id|. If none have been associated yet, they will be created. | 75 // |app_id|. If none have been associated yet, they will be created. |
76 void GetEncryptionInfo(const std::string& app_id, | 76 void GetEncryptionInfo(const std::string& app_id, |
77 const EncryptionInfoCallback& callback); | 77 const EncryptionInfoCallback& callback); |
78 | 78 |
| 79 // Removes all encryption information associated with the |app_id|. Will |
| 80 // invoke the |callback| when this has finished. |
| 81 void RemoveEncryptionInfo(const std::string& app_id, |
| 82 const base::Closure& callback); |
| 83 |
79 // Determines whether |message| contains encrypted content. | 84 // Determines whether |message| contains encrypted content. |
80 bool IsEncryptedMessage(const IncomingMessage& message) const; | 85 bool IsEncryptedMessage(const IncomingMessage& message) const; |
81 | 86 |
82 // Asynchronously decrypts |message|. The |success_callback| will be invoked | 87 // Asynchronously decrypts |message|. The |success_callback| will be invoked |
83 // the message could be decrypted successfully, accompanied by the decrypted | 88 // the message could be decrypted successfully, accompanied by the decrypted |
84 // payload of the message. When decryption failed, the |failure_callback| will | 89 // payload of the message. When decryption failed, the |failure_callback| will |
85 // be invoked with the reason that encryption failed. | 90 // be invoked with the reason that encryption failed. |
86 void DecryptMessage(const std::string& app_id, | 91 void DecryptMessage(const std::string& app_id, |
87 const IncomingMessage& message, | 92 const IncomingMessage& message, |
88 const MessageDecryptedCallback& success_callback, | 93 const MessageDecryptedCallback& success_callback, |
(...skipping 23 matching lines...) Expand all Loading... |
112 scoped_ptr<GCMKeyStore> key_store_; | 117 scoped_ptr<GCMKeyStore> key_store_; |
113 | 118 |
114 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; | 119 base::WeakPtrFactory<GCMEncryptionProvider> weak_ptr_factory_; |
115 | 120 |
116 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); | 121 DISALLOW_COPY_AND_ASSIGN(GCMEncryptionProvider); |
117 }; | 122 }; |
118 | 123 |
119 } // namespace gcm | 124 } // namespace gcm |
120 | 125 |
121 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ | 126 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_GCM_ENCRYPTION_PROVIDER_H_ |
OLD | NEW |