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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 <string> 13 #include <string>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
18 18
19 namespace crypto { 19 namespace crypto {
20 class Encryptor; 20 class Encryptor;
21 class SymmetricKey; 21 class SymmetricKey;
22 } 22 }
23 23
24 namespace media { 24 namespace media {
25 namespace cast { 25 namespace cast {
26 26
27 class TransportEncryptionHandler : public base::NonThreadSafe { 27 class TransportEncryptionHandler : public base::NonThreadSafe {
28 public: 28 public:
29 TransportEncryptionHandler(); 29 TransportEncryptionHandler();
30 ~TransportEncryptionHandler(); 30 ~TransportEncryptionHandler();
31 31
32 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);
33 33
34 bool Encrypt(uint32_t frame_id, 34 bool Encrypt(uint32_t frame_id,
35 const base::StringPiece& data, 35 const base::StringPiece& data,
36 std::string* encrypted_data); 36 std::string* encrypted_data);
37 37
38 bool Decrypt(uint32_t frame_id, 38 bool Decrypt(uint32_t frame_id,
39 const base::StringPiece& ciphertext, 39 const base::StringPiece& ciphertext,
40 std::string* plaintext); 40 std::string* plaintext);
41 41
42 bool is_activated() const { return is_activated_; } 42 bool is_activated() const { return is_activated_; }
43 43
44 private: 44 private:
45 scoped_ptr<crypto::SymmetricKey> key_; 45 std::unique_ptr<crypto::SymmetricKey> key_;
46 scoped_ptr<crypto::Encryptor> encryptor_; 46 std::unique_ptr<crypto::Encryptor> encryptor_;
47 std::string iv_mask_; 47 std::string iv_mask_;
48 bool is_activated_; 48 bool is_activated_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler); 50 DISALLOW_COPY_AND_ASSIGN(TransportEncryptionHandler);
51 }; 51 };
52 52
53 } // namespace cast 53 } // namespace cast
54 } // namespace media 54 } // namespace media
55 55
56 #endif // MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_ 56 #endif // MEDIA_CAST_COMMON_TRANSPORT_ENCRYPTION_HANDLER_H_
OLDNEW
« no previous file with comments | « media/cast/cast_sender_impl.cc ('k') | media/cast/logging/encoding_event_subscriber_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698