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

Side by Side Diff: media/base/media_keys.h

Issue 17289006: Separate CDM initialization from GenerateKeyRequest & remove key_system parameters. (Closed) Base URL: master
Patch Set: minor changes Created 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BASE_MEDIA_KEYS_H_ 5 #ifndef MEDIA_BASE_MEDIA_KEYS_H_
6 #define MEDIA_BASE_MEDIA_KEYS_H_ 6 #define MEDIA_BASE_MEDIA_KEYS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 18 matching lines...) Expand all
29 kServiceError, 29 kServiceError,
30 kOutputError, 30 kOutputError,
31 kHardwareChangeError, 31 kHardwareChangeError,
32 kDomainError, 32 kDomainError,
33 kMaxKeyError // Must be last and greater than any legit value. 33 kMaxKeyError // Must be last and greater than any legit value.
34 }; 34 };
35 35
36 MediaKeys(); 36 MediaKeys();
37 virtual ~MediaKeys(); 37 virtual ~MediaKeys();
38 38
39 // Generates a key request for the |key_system| with |type| and 39 // Generates a key request with the |type| and |init_data| provided.
40 // |init_data| provided.
41 // Returns true if generating key request succeeded, false otherwise. 40 // Returns true if generating key request succeeded, false otherwise.
42 // Note: AddKey() and CancelKeyRequest() should only be called after 41 // Note: AddKey() and CancelKeyRequest() should only be called after
43 // GenerateKeyRequest() returns true. 42 // GenerateKeyRequest() returns true.
44 virtual bool GenerateKeyRequest(const std::string& key_system, 43 virtual bool GenerateKeyRequest(const std::string& type,
45 const std::string& type,
46 const uint8* init_data, 44 const uint8* init_data,
47 int init_data_length) = 0; 45 int init_data_length) = 0;
48 46
49 // Adds a |key| to the |key_system|. The |key| is not limited to a decryption 47 // Adds a |key| to the session. The |key| is not limited to a decryption
50 // key. It can be any data that the key system accepts, such as a license. 48 // key. It can be any data that the key system accepts, such as a license.
51 // If multiple calls of this function set different keys for the same 49 // If multiple calls of this function set different keys for the same
52 // key ID, the older key will be replaced by the newer key. 50 // key ID, the older key will be replaced by the newer key.
53 virtual void AddKey(const std::string& key_system, 51 virtual void AddKey(const uint8* key, int key_length,
54 const uint8* key, int key_length,
55 const uint8* init_data, int init_data_length, 52 const uint8* init_data, int init_data_length,
56 const std::string& session_id) = 0; 53 const std::string& session_id) = 0;
57 54
58 // Cancels the key request specified by |session_id|. 55 // Cancels the key request specified by |session_id|.
59 virtual void CancelKeyRequest(const std::string& key_system, 56 virtual void CancelKeyRequest(const std::string& session_id) = 0;
60 const std::string& session_id) = 0;
61 57
62 private: 58 private:
63 DISALLOW_COPY_AND_ASSIGN(MediaKeys); 59 DISALLOW_COPY_AND_ASSIGN(MediaKeys);
64 }; 60 };
65 61
66 // Key event callbacks. See the spec for details: 62 // Key event callbacks. See the spec for details:
67 // http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted -media.html#event-summary 63 // http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted -media.html#event-summary
68 typedef base::Callback<void(const std::string& key_system, 64 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB;
69 const std::string& session_id)> KeyAddedCB;
70 65
71 typedef base::Callback<void(const std::string& key_system, 66 typedef base::Callback<void(const std::string& session_id,
72 const std::string& session_id,
73 media::MediaKeys::KeyError error_code, 67 media::MediaKeys::KeyError error_code,
74 int system_code)> KeyErrorCB; 68 int system_code)> KeyErrorCB;
75 69
76 typedef base::Callback<void(const std::string& key_system, 70 typedef base::Callback<void(const std::string& session_id,
77 const std::string& session_id,
78 const std::string& message, 71 const std::string& message,
79 const std::string& default_url)> KeyMessageCB; 72 const std::string& default_url)> KeyMessageCB;
80 73
81 typedef base::Callback<void(const std::string& key_system, 74 typedef base::Callback<void(const std::string& session_id,
82 const std::string& session_id,
83 const std::string& type, 75 const std::string& type,
84 scoped_ptr<uint8[]> init_data, 76 scoped_ptr<uint8[]> init_data,
85 int init_data_size)> NeedKeyCB; 77 int init_data_size)> NeedKeyCB;
86 78
87 } // namespace media 79 } // namespace media
88 80
89 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 81 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW
« no previous file with comments | « no previous file | media/crypto/aes_decryptor.h » ('j') | webkit/plugins/ppapi/content_decryptor_delegate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698