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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10854209: Modify the PPAPI CDM interface to pass more info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "base/utf_offset_string_conversions.h" 14 #include "base/utf_offset_string_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "ppapi/c/dev/ppb_find_dev.h" 16 #include "ppapi/c/dev/ppb_find_dev.h"
17 #include "ppapi/c/dev/ppb_zoom_dev.h" 17 #include "ppapi/c/dev/ppb_zoom_dev.h"
18 #include "ppapi/c/dev/ppp_find_dev.h" 18 #include "ppapi/c/dev/ppp_find_dev.h"
19 #include "ppapi/c/dev/ppp_selection_dev.h" 19 #include "ppapi/c/dev/ppp_selection_dev.h"
20 #include "ppapi/c/dev/ppp_text_input_dev.h" 20 #include "ppapi/c/dev/ppp_text_input_dev.h"
21 #include "ppapi/c/dev/ppp_zoom_dev.h" 21 #include "ppapi/c/dev/ppp_zoom_dev.h"
22 #include "ppapi/c/pp_rect.h" 22 #include "ppapi/c/pp_rect.h"
23 #include "ppapi/c/ppb_audio_config.h" 23 #include "ppapi/c/ppb_audio_config.h"
24 #include "ppapi/c/ppb_core.h" 24 #include "ppapi/c/ppb_core.h"
25 #include "ppapi/c/ppb_gamepad.h" 25 #include "ppapi/c/ppb_gamepad.h"
26 #include "ppapi/c/ppp_input_event.h" 26 #include "ppapi/c/ppp_input_event.h"
27 #include "ppapi/c/ppp_instance.h" 27 #include "ppapi/c/ppp_instance.h"
28 #include "ppapi/c/ppp_messaging.h" 28 #include "ppapi/c/ppp_messaging.h"
29 #include "ppapi/c/ppp_mouse_lock.h" 29 #include "ppapi/c/ppp_mouse_lock.h"
30 #include "ppapi/c/private/pp_content_decryptor.h"
30 #include "ppapi/c/private/ppp_instance_private.h" 31 #include "ppapi/c/private/ppp_instance_private.h"
31 #include "ppapi/shared_impl/ppb_input_event_shared.h" 32 #include "ppapi/shared_impl/ppb_input_event_shared.h"
32 #include "ppapi/shared_impl/ppb_url_util_shared.h" 33 #include "ppapi/shared_impl/ppb_url_util_shared.h"
33 #include "ppapi/shared_impl/ppb_view_shared.h" 34 #include "ppapi/shared_impl/ppb_view_shared.h"
34 #include "ppapi/shared_impl/ppp_instance_combined.h" 35 #include "ppapi/shared_impl/ppp_instance_combined.h"
35 #include "ppapi/shared_impl/resource.h" 36 #include "ppapi/shared_impl/resource.h"
36 #include "ppapi/shared_impl/scoped_pp_resource.h" 37 #include "ppapi/shared_impl/scoped_pp_resource.h"
37 #include "ppapi/shared_impl/time_conversion.h" 38 #include "ppapi/shared_impl/time_conversion.h"
38 #include "ppapi/shared_impl/var.h" 39 #include "ppapi/shared_impl/var.h"
39 #include "ppapi/thunk/enter.h" 40 #include "ppapi/thunk/enter.h"
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 1328 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
1328 init_data.size(), init_data.data()); 1329 init_data.size(), init_data.data());
1329 1330
1330 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest( 1331 return PP_ToBool(plugin_decryption_interface_->GenerateKeyRequest(
1331 pp_instance(), 1332 pp_instance(),
1332 StringVar::StringToPPVar(key_system), 1333 StringVar::StringToPPVar(key_system),
1333 init_data_array)); 1334 init_data_array));
1334 } 1335 }
1335 1336
1336 bool PluginInstance::AddKey(const std::string& session_id, 1337 bool PluginInstance::AddKey(const std::string& session_id,
1337 const std::string& key) { 1338 const std::string& key,
1339 const std::string& init_data) {
1338 if (!LoadContentDecryptorInterface()) 1340 if (!LoadContentDecryptorInterface())
1339 return false; 1341 return false;
1340 PP_Var key_array = 1342 PP_Var key_array =
1341 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(), 1343 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key.size(),
1342 key.data()); 1344 key.data());
1345 PP_Var init_data_array =
1346 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
1347 init_data.size(),
1348 init_data.data());
1343 1349
1344 return PP_ToBool(plugin_decryption_interface_->AddKey( 1350 return PP_ToBool(plugin_decryption_interface_->AddKey(
1345 pp_instance(), 1351 pp_instance(),
1346 StringVar::StringToPPVar(session_id), 1352 StringVar::StringToPPVar(session_id),
1347 key_array)); 1353 key_array,
1354 init_data_array));
1348 } 1355 }
1349 1356
1350 bool PluginInstance::CancelKeyRequest(const std::string& session_id) { 1357 bool PluginInstance::CancelKeyRequest(const std::string& session_id) {
1351 if (!LoadContentDecryptorInterface()) 1358 if (!LoadContentDecryptorInterface())
1352 return false; 1359 return false;
1353 1360
1354 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest( 1361 return PP_ToBool(plugin_decryption_interface_->CancelKeyRequest(
1355 pp_instance(), 1362 pp_instance(),
1356 StringVar::StringToPPVar(session_id))); 1363 StringVar::StringToPPVar(session_id)));
1357 } 1364 }
1358 1365
1359 bool PluginInstance::Decrypt(const base::StringPiece& encrypted_block, 1366 bool PluginInstance::Decrypt(const base::StringPiece& encrypted_block,
1360 const DecryptedDataCB& callback) { 1367 const DecryptedDataCB& callback) {
1361 if (!LoadContentDecryptorInterface()) 1368 if (!LoadContentDecryptorInterface())
1362 return false; 1369 return false;
1363 ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(), 1370 ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(),
1364 encrypted_block)); 1371 encrypted_block));
1365 if (!encrypted_resource.get()) 1372 if (!encrypted_resource.get())
1366 return false; 1373 return false;
1367 1374
1375 PP_EncryptedBlockInfo block_info;
1376
1368 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. 1377 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
1369 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(), 1378 return PP_ToBool(plugin_decryption_interface_->Decrypt(pp_instance(),
1370 encrypted_resource, 1379 encrypted_resource,
1371 0)); 1380 &block_info));
1372 } 1381 }
1373 1382
1374 bool PluginInstance::DecryptAndDecode(const base::StringPiece& encrypted_block, 1383 bool PluginInstance::DecryptAndDecode(const base::StringPiece& encrypted_block,
1375 const DecryptedDataCB& callback) { 1384 const DecryptedDataCB& callback) {
1376 if (!LoadContentDecryptorInterface()) 1385 if (!LoadContentDecryptorInterface())
1377 return false; 1386 return false;
1378 ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(), 1387 ScopedPPResource encrypted_resource(MakeBufferResource(pp_instance(),
1379 encrypted_block)); 1388 encrypted_block));
1380 if (!encrypted_resource.get()) 1389 if (!encrypted_resource.get())
1381 return false; 1390 return false;
1391
1392 PP_EncryptedBlockInfo block_info;
1393
1382 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor. 1394 // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
1383 return PP_ToBool(plugin_decryption_interface_->DecryptAndDecode( 1395 return PP_ToBool(plugin_decryption_interface_->DecryptAndDecode(
1384 pp_instance(), 1396 pp_instance(),
1385 encrypted_resource, 1397 encrypted_resource,
1386 0)); 1398 &block_info));
1387 } 1399 }
1388 1400
1389 bool PluginInstance::FlashIsFullscreenOrPending() { 1401 bool PluginInstance::FlashIsFullscreenOrPending() {
1390 return fullscreen_container_ != NULL; 1402 return fullscreen_container_ != NULL;
1391 } 1403 }
1392 1404
1393 bool PluginInstance::IsFullscreenOrPending() { 1405 bool PluginInstance::IsFullscreenOrPending() {
1394 return desired_fullscreen_state_; 1406 return desired_fullscreen_state_;
1395 } 1407 }
1396 1408
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 void PluginInstance::KeyError(PP_Instance instance, 2030 void PluginInstance::KeyError(PP_Instance instance,
2019 PP_Var key_system_var, 2031 PP_Var key_system_var,
2020 PP_Var session_id_var, 2032 PP_Var session_id_var,
2021 int32_t media_error, 2033 int32_t media_error,
2022 int32_t system_code) { 2034 int32_t system_code) {
2023 // TODO(tomfinegan): send the data to media stack. 2035 // TODO(tomfinegan): send the data to media stack.
2024 } 2036 }
2025 2037
2026 void PluginInstance::DeliverBlock(PP_Instance instance, 2038 void PluginInstance::DeliverBlock(PP_Instance instance,
2027 PP_Resource decrypted_block, 2039 PP_Resource decrypted_block,
2028 int32_t request_id) { 2040 const PP_DecryptedBlockInfo* block_info) {
2029 // TODO(xhwang): Pass the decrypted block back to media stack. 2041 // TODO(xhwang): Pass the decrypted block back to media stack.
2030 } 2042 }
2031 2043
2032 void PluginInstance::DeliverFrame(PP_Instance instance, 2044 void PluginInstance::DeliverFrame(PP_Instance instance,
2033 PP_Resource decrypted_frame, 2045 PP_Resource decrypted_frame,
2034 int32_t request_id) { 2046 const PP_DecryptedBlockInfo* block_info) {
2035 // TODO(tomfinegan): To be implemented after completion of v0.1 of the 2047 // TODO(tomfinegan): To be implemented after completion of v0.1 of the
2036 // EME/CDM work. 2048 // EME/CDM work.
2037 } 2049 }
2038 2050
2039 void PluginInstance::DeliverSamples(PP_Instance instance, 2051 void PluginInstance::DeliverSamples(PP_Instance instance,
2040 PP_Resource decrypted_samples, 2052 PP_Resource decrypted_samples,
2041 int32_t request_id) { 2053 const PP_DecryptedBlockInfo* block_info) {
2042 // TODO(tomfinegan): To be implemented after completion of v0.1 of the 2054 // TODO(tomfinegan): To be implemented after completion of v0.1 of the
2043 // EME/CDM work. 2055 // EME/CDM work.
2044 } 2056 }
2045 2057
2046 2058
2047 void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance, 2059 void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance,
2048 int32_t total, 2060 int32_t total,
2049 PP_Bool final_result) { 2061 PP_Bool final_result) {
2050 DCHECK_NE(find_identifier_, -1); 2062 DCHECK_NE(find_identifier_, -1);
2051 delegate_->NumberOfFindResultsChanged(find_identifier_, total, 2063 delegate_->NumberOfFindResultsChanged(find_identifier_, total,
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2412 screen_size_for_fullscreen_ = gfx::Size(); 2424 screen_size_for_fullscreen_ = gfx::Size();
2413 WebElement element = container_->element(); 2425 WebElement element = container_->element();
2414 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2426 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2415 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2427 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2416 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2428 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2417 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2429 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2418 } 2430 }
2419 2431
2420 } // namespace ppapi 2432 } // namespace ppapi
2421 } // namespace webkit 2433 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698