Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: media/cast/common/transport_encryption_handler.h

Issue 2910063002: Remove deprecated base::NonThreadSafe in media/cast. (Closed)
Patch Set: Remove NonThreadSafe, no replacement Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/cast/net/cast_transport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_ 5 #ifndef MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
6 #define MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_ 6 #define MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
7 7
8 // Helper class to handle encryption for the Cast Transport library. 8 // Helper class to handle encryption for the Cast Transport library.
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/threading/non_thread_safe.h"
18 #include "media/cast/common/frame_id.h" 17 #include "media/cast/common/frame_id.h"
19 18
20 namespace crypto { 19 namespace crypto {
21 class Encryptor; 20 class Encryptor;
22 class SymmetricKey; 21 class SymmetricKey;
23 } 22 }
24 23
25 namespace media { 24 namespace media {
26 namespace cast { 25 namespace cast {
27 26
28 class TransportEncryptionHandler : public base::NonThreadSafe { 27 class TransportEncryptionHandler {
29 public: 28 public:
30 TransportEncryptionHandler(); 29 TransportEncryptionHandler();
31 ~TransportEncryptionHandler(); 30 ~TransportEncryptionHandler();
32 31
33 bool Initialize(const std::string& aes_key, const std::string& aes_iv_mask); 32 bool Initialize(const std::string& aes_key, const std::string& aes_iv_mask);
34 33
35 bool Encrypt(FrameId frame_id, 34 bool Encrypt(FrameId frame_id,
36 const base::StringPiece& data, 35 const base::StringPiece& data,
37 std::string* encrypted_data); 36 std::string* encrypted_data);
38 37
39 bool Decrypt(FrameId frame_id, 38 bool Decrypt(FrameId frame_id,
40 const base::StringPiece& ciphertext, 39 const base::StringPiece& ciphertext,
41 std::string* plaintext); 40 std::string* plaintext);
42 41
43 bool is_activated() const { return is_activated_; } 42 bool is_activated() const { return is_activated_; }
44 43
45 private: 44 private:
46 std::unique_ptr<crypto::SymmetricKey> key_; 45 std::unique_ptr<crypto::SymmetricKey> key_;
47 std::unique_ptr<crypto::Encryptor> encryptor_; 46 std::unique_ptr<crypto::Encryptor> encryptor_;
48 std::string iv_mask_; 47 std::string iv_mask_;
49 bool is_activated_; 48 bool is_activated_;
50 49
51 DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler); 50 DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler);
52 }; 51 };
53 52
54 } // namespace cast 53 } // namespace cast
55 } // namespace media 54 } // namespace media
56 55
57 #endif // MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_ 56 #endif // MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/net/cast_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698