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

Side by Side Diff: media/blink/webencryptedmediaclient_impl.h

Issue 1023863002: Create an interface for KeySystems, migrate WebEncryptedMediaClientImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@robustness
Patch Set: Rebase. Created 5 years, 9 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_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
6 #define MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ 6 #define MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/scoped_ptr_hash_map.h" 10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "media/base/cdm_factory.h" 13 #include "media/base/cdm_factory.h"
14 #include "media/base/media_export.h" 14 #include "media/base/media_export.h"
15 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" 15 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
16 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h" 16 #include "third_party/WebKit/public/platform/WebEncryptedMediaClient.h"
17 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 17 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
18 18
19 namespace media { 19 namespace media {
20 20
21 class KeySystems;
21 class MediaPermission; 22 class MediaPermission;
22 23
23 class MEDIA_EXPORT WebEncryptedMediaClientImpl 24 class MEDIA_EXPORT WebEncryptedMediaClientImpl
24 : public blink::WebEncryptedMediaClient { 25 : public blink::WebEncryptedMediaClient {
25 public: 26 public:
26 WebEncryptedMediaClientImpl(scoped_ptr<CdmFactory> cdm_factory, 27 WebEncryptedMediaClientImpl(const KeySystems& key_systems,
28 scoped_ptr<CdmFactory> cdm_factory,
27 MediaPermission* media_permission); 29 MediaPermission* media_permission);
28 virtual ~WebEncryptedMediaClientImpl(); 30 virtual ~WebEncryptedMediaClientImpl();
29 31
30 // WebEncryptedMediaClient implementation. 32 // WebEncryptedMediaClient implementation.
31 virtual void requestMediaKeySystemAccess( 33 virtual void requestMediaKeySystemAccess(
32 blink::WebEncryptedMediaRequest request); 34 blink::WebEncryptedMediaRequest request);
33 35
34 // Create the CDM for |key_system| and |security_origin|. The caller owns 36 // Create the CDM for |key_system| and |security_origin|. The caller owns
35 // the created cdm (passed back using |result|). 37 // the created cdm (passed back using |result|).
36 void CreateCdm(const blink::WebString& key_system, 38 void CreateCdm(const blink::WebString& key_system,
37 bool allow_distinctive_identifier, 39 bool allow_distinctive_identifier,
38 bool allow_persistent_state, 40 bool allow_persistent_state,
39 const blink::WebSecurityOrigin& security_origin, 41 const blink::WebSecurityOrigin& security_origin,
40 blink::WebContentDecryptionModuleResult result); 42 blink::WebContentDecryptionModuleResult result);
41 43
42 private: 44 private:
43 // Pick a supported configuration if possible, and complete the request. This 45 // Pick a supported configuration if possible, and complete the request. This
44 // method may asynchronously invoke itself after prompting for permissions. 46 // method may asynchronously invoke itself after prompting for permissions.
45 void SelectSupportedConfiguration(blink::WebEncryptedMediaRequest request, 47 void SelectSupportedConfiguration(blink::WebEncryptedMediaRequest request,
ddorwin 2015/03/20 00:55:03 Most of the logic in this class and in the .cc fil
sandersd (OOO until July 31) 2015/03/20 22:53:20 Acknowledged.
46 bool was_permission_requested, 48 bool was_permission_requested,
47 bool is_permission_granted); 49 bool is_permission_granted);
48 50
49 // Report usage of key system to UMA. There are 2 different counts logged: 51 // Report usage of key system to UMA. There are 2 different counts logged:
50 // 1. The key system is requested. 52 // 1. The key system is requested.
51 // 2. The requested key system and options are supported. 53 // 2. The requested key system and options are supported.
52 // Each stat is only reported once per renderer frame per key system. 54 // Each stat is only reported once per renderer frame per key system.
53 class Reporter; 55 class Reporter;
54 56
55 // Gets the Reporter for |key_system|. If it doesn't already exist, 57 // Gets the Reporter for |key_system|. If it doesn't already exist,
56 // create one. 58 // create one.
57 Reporter* GetReporter(const std::string& key_system); 59 Reporter* GetReporter(const std::string& key_system);
58 60
59 // Key system <-> Reporter map. 61 // Key system <-> Reporter map.
60 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters; 62 typedef base::ScopedPtrHashMap<std::string, Reporter> Reporters;
61 Reporters reporters_; 63 Reporters reporters_;
62 64
65 const KeySystems& key_systems_;
63 scoped_ptr<CdmFactory> cdm_factory_; 66 scoped_ptr<CdmFactory> cdm_factory_;
64 MediaPermission* media_permission_; 67 MediaPermission* media_permission_;
65 68
66 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_; 69 base::WeakPtrFactory<WebEncryptedMediaClientImpl> weak_factory_;
67 }; 70 };
68 71
69 } // namespace media 72 } // namespace media
70 73
71 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_ 74 #endif // MEDIA_BLINK_WEBENCRYPTEDMEDIACLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698