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

Side by Side Diff: webkit/renderer/media/crypto/proxy_decryptor.cc

Issue 17502007: Move webkit/renderer/media/android/ to content/renderer/media/android/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix shared lib 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 | Annotate | Revision Log
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 #include "webkit/renderer/media/crypto/proxy_decryptor.h" 5 #include "webkit/renderer/media/crypto/proxy_decryptor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/crypto/aes_decryptor.h" 10 #include "media/crypto/aes_decryptor.h"
11 #include "webkit/renderer/media/crypto/key_systems.h" 11 #include "webkit/renderer/media/crypto/key_systems.h"
12 12
13 #if defined(ENABLE_PEPPER_CDMS) 13 #if defined(ENABLE_PEPPER_CDMS)
14 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "third_party/WebKit/public/web/WebFrame.h" 15 #include "third_party/WebKit/public/web/WebFrame.h"
16 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" 16 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h"
17 #include "webkit/renderer/media/crypto/ppapi_decryptor.h" 17 #include "webkit/renderer/media/crypto/ppapi_decryptor.h"
18 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 18 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
19 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 19 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
20 #endif // defined(ENABLE_PEPPER_CDMS) 20 #endif // defined(ENABLE_PEPPER_CDMS)
21 21
22 #if defined(OS_ANDROID) && !defined(GOOGLE_TV)
23 #include "webkit/renderer/media/android/proxy_media_keys.h"
24 #include "webkit/renderer/media/android/webmediaplayer_proxy_android.h"
25 #endif // defined(OS_ANDROID) && !defined(GOOGLE_TV)
26
27 namespace webkit_media { 22 namespace webkit_media {
28 23
29 #if defined(ENABLE_PEPPER_CDMS) 24 #if defined(ENABLE_PEPPER_CDMS)
30 // Returns the PluginInstance associated with the Helper Plugin. 25 // Returns the PluginInstance associated with the Helper Plugin.
31 // If a non-NULL pointer is returned, the caller must call closeHelperPlugin() 26 // If a non-NULL pointer is returned, the caller must call closeHelperPlugin()
32 // when the Helper Plugin is no longer needed. 27 // when the Helper Plugin is no longer needed.
33 static scoped_refptr<webkit::ppapi::PluginInstance> CreateHelperPlugin( 28 static scoped_refptr<webkit::ppapi::PluginInstance> CreateHelperPlugin(
34 const std::string& plugin_type, 29 const std::string& plugin_type,
35 WebKit::WebMediaPlayerClient* web_media_player_client, 30 WebKit::WebMediaPlayerClient* web_media_player_client,
36 WebKit::WebFrame* web_frame) { 31 WebKit::WebFrame* web_frame) {
(...skipping 15 matching lines...) Expand all
52 void ProxyDecryptor::DestroyHelperPlugin() { 47 void ProxyDecryptor::DestroyHelperPlugin() {
53 web_media_player_client_->closeHelperPlugin(); 48 web_media_player_client_->closeHelperPlugin();
54 } 49 }
55 50
56 #endif // defined(ENABLE_PEPPER_CDMS) 51 #endif // defined(ENABLE_PEPPER_CDMS)
57 52
58 ProxyDecryptor::ProxyDecryptor( 53 ProxyDecryptor::ProxyDecryptor(
59 #if defined(ENABLE_PEPPER_CDMS) 54 #if defined(ENABLE_PEPPER_CDMS)
60 WebKit::WebMediaPlayerClient* web_media_player_client, 55 WebKit::WebMediaPlayerClient* web_media_player_client,
61 WebKit::WebFrame* web_frame, 56 WebKit::WebFrame* web_frame,
62 #endif // defined(ENABLE_PEPPER_CDMS) 57 #elif defined(OS_ANDROID) && !defined(GOOGLE_TV)
63 #if defined(OS_ANDROID) && !defined(GOOGLE_TV) 58 scoped_ptr<media::MediaKeys> media_keys,
64 WebMediaPlayerProxyAndroid* proxy, 59 #endif
65 int media_keys_id,
66 #endif // defined(OS_ANDROID) && !defined(GOOGLE_TV)
67 const media::KeyAddedCB& key_added_cb, 60 const media::KeyAddedCB& key_added_cb,
68 const media::KeyErrorCB& key_error_cb, 61 const media::KeyErrorCB& key_error_cb,
69 const media::KeyMessageCB& key_message_cb) 62 const media::KeyMessageCB& key_message_cb)
70 : weak_ptr_factory_(this), 63 : weak_ptr_factory_(this),
71 #if defined(ENABLE_PEPPER_CDMS) 64 #if defined(ENABLE_PEPPER_CDMS)
72 web_media_player_client_(web_media_player_client), 65 web_media_player_client_(web_media_player_client),
73 web_frame_(web_frame), 66 web_frame_(web_frame),
74 #endif // defined(ENABLE_PEPPER_CDMS) 67 #elif defined(OS_ANDROID) && !defined(GOOGLE_TV)
75 #if defined(OS_ANDROID) && !defined(GOOGLE_TV) 68 media_keys_(media_keys.Pass()),
76 proxy_(proxy), 69 #endif
77 media_keys_id_(media_keys_id),
78 #endif // defined(OS_ANDROID) && !defined(GOOGLE_TV)
79 key_added_cb_(key_added_cb), 70 key_added_cb_(key_added_cb),
80 key_error_cb_(key_error_cb), 71 key_error_cb_(key_error_cb),
81 key_message_cb_(key_message_cb) { 72 key_message_cb_(key_message_cb) {
82 } 73 }
83 74
84 ProxyDecryptor::~ProxyDecryptor() { 75 ProxyDecryptor::~ProxyDecryptor() {
85 // Destroy the decryptor explicitly before destroying the plugin. 76 // Destroy the decryptor explicitly before destroying the plugin.
86 { 77 {
87 base::AutoLock auto_lock(lock_); 78 base::AutoLock auto_lock(lock_);
88 media_keys_.reset(); 79 media_keys_.reset();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return scoped_ptr<media::MediaKeys>(new media::AesDecryptor( 186 return scoped_ptr<media::MediaKeys>(new media::AesDecryptor(
196 base::Bind(&ProxyDecryptor::KeyAdded, weak_ptr_factory_.GetWeakPtr()), 187 base::Bind(&ProxyDecryptor::KeyAdded, weak_ptr_factory_.GetWeakPtr()),
197 base::Bind(&ProxyDecryptor::KeyError, weak_ptr_factory_.GetWeakPtr()), 188 base::Bind(&ProxyDecryptor::KeyError, weak_ptr_factory_.GetWeakPtr()),
198 base::Bind(&ProxyDecryptor::KeyMessage, weak_ptr_factory_.GetWeakPtr()) 189 base::Bind(&ProxyDecryptor::KeyMessage, weak_ptr_factory_.GetWeakPtr())
199 )); 190 ));
200 } 191 }
201 192
202 #if defined(ENABLE_PEPPER_CDMS) 193 #if defined(ENABLE_PEPPER_CDMS)
203 return CreatePpapiDecryptor(key_system); 194 return CreatePpapiDecryptor(key_system);
204 #elif defined(OS_ANDROID) && !defined(GOOGLE_TV) 195 #elif defined(OS_ANDROID) && !defined(GOOGLE_TV)
205 return scoped_ptr<media::MediaKeys>( 196 return media_keys_.Pass();
206 new ProxyMediaKeys(proxy_, media_keys_id_));
207 #else 197 #else
208 return scoped_ptr<media::MediaKeys>(); 198 return scoped_ptr<media::MediaKeys>();
209 #endif 199 #endif
210 } 200 }
211 201
212 void ProxyDecryptor::KeyAdded(const std::string& session_id) { 202 void ProxyDecryptor::KeyAdded(const std::string& session_id) {
213 key_added_cb_.Run(session_id); 203 key_added_cb_.Run(session_id);
214 } 204 }
215 205
216 void ProxyDecryptor::KeyError(const std::string& session_id, 206 void ProxyDecryptor::KeyError(const std::string& session_id,
217 media::MediaKeys::KeyError error_code, 207 media::MediaKeys::KeyError error_code,
218 int system_code) { 208 int system_code) {
219 key_error_cb_.Run(session_id, error_code, system_code); 209 key_error_cb_.Run(session_id, error_code, system_code);
220 } 210 }
221 211
222 void ProxyDecryptor::KeyMessage(const std::string& session_id, 212 void ProxyDecryptor::KeyMessage(const std::string& session_id,
223 const std::string& message, 213 const std::string& message,
224 const std::string& default_url) { 214 const std::string& default_url) {
225 key_message_cb_.Run(session_id, message, default_url); 215 key_message_cb_.Run(session_id, message, default_url);
226 } 216 }
227 217
228 } // namespace webkit_media 218 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/renderer/media/crypto/proxy_decryptor.h ('k') | webkit/renderer/media/media_info_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698