OLD | NEW |
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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "content/renderer/pepper/message_channel.h" | 28 #include "content/renderer/pepper/message_channel.h" |
29 #include "content/renderer/pepper/npapi_glue.h" | 29 #include "content/renderer/pepper/npapi_glue.h" |
30 #include "content/renderer/pepper/pepper_graphics_2d_host.h" | 30 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
31 #include "content/renderer/pepper/pepper_helper_impl.h" | 31 #include "content/renderer/pepper/pepper_helper_impl.h" |
32 #include "content/renderer/pepper/pepper_in_process_router.h" | 32 #include "content/renderer/pepper/pepper_in_process_router.h" |
33 #include "content/renderer/pepper/pepper_platform_context_3d.h" | 33 #include "content/renderer/pepper/pepper_platform_context_3d.h" |
34 #include "content/renderer/pepper/pepper_url_loader_host.h" | 34 #include "content/renderer/pepper/pepper_url_loader_host.h" |
35 #include "content/renderer/pepper/plugin_module.h" | 35 #include "content/renderer/pepper/plugin_module.h" |
36 #include "content/renderer/pepper/plugin_object.h" | 36 #include "content/renderer/pepper/plugin_object.h" |
37 #include "content/renderer/pepper/ppb_buffer_impl.h" | 37 #include "content/renderer/pepper/ppb_buffer_impl.h" |
38 #include "content/renderer/pepper/ppb_file_ref_impl.h" | |
39 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" | 38 #include "content/renderer/pepper/ppb_graphics_3d_impl.h" |
40 #include "content/renderer/pepper/ppb_image_data_impl.h" | 39 #include "content/renderer/pepper/ppb_image_data_impl.h" |
41 #include "content/renderer/pepper/ppp_pdf.h" | 40 #include "content/renderer/pepper/ppp_pdf.h" |
42 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 41 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
43 #include "content/renderer/pepper/url_request_info_util.h" | 42 #include "content/renderer/pepper/url_request_info_util.h" |
44 #include "content/renderer/pepper/url_response_info_util.h" | 43 #include "content/renderer/pepper/url_response_info_util.h" |
45 #include "content/renderer/render_thread_impl.h" | 44 #include "content/renderer/render_thread_impl.h" |
46 #include "content/renderer/render_view_impl.h" | 45 #include "content/renderer/render_view_impl.h" |
47 #include "content/renderer/render_widget_fullscreen_pepper.h" | 46 #include "content/renderer/render_widget_fullscreen_pepper.h" |
48 #include "media/base/audio_hardware_config.h" | 47 #include "media/base/audio_hardware_config.h" |
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 } | 2587 } |
2589 | 2588 |
2590 const GURL& PepperPluginInstanceImpl::GetPluginURL() { | 2589 const GURL& PepperPluginInstanceImpl::GetPluginURL() { |
2591 return plugin_url_; | 2590 return plugin_url_; |
2592 } | 2591 } |
2593 | 2592 |
2594 base::FilePath PepperPluginInstanceImpl::GetModulePath() { | 2593 base::FilePath PepperPluginInstanceImpl::GetModulePath() { |
2595 return module_->path(); | 2594 return module_->path(); |
2596 } | 2595 } |
2597 | 2596 |
2598 PP_Resource PepperPluginInstanceImpl::CreateExternalFileReference( | |
2599 const base::FilePath& external_file_path) { | |
2600 PPB_FileRef_Impl* ref = PPB_FileRef_Impl::CreateExternal( | |
2601 pp_instance(), external_file_path, ""); | |
2602 return ref->GetReference(); | |
2603 } | |
2604 | |
2605 PP_Resource PepperPluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image, | 2597 PP_Resource PepperPluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image, |
2606 float scale) { | 2598 float scale) { |
2607 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale); | 2599 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale); |
2608 gfx::ImageSkiaRep image_skia_rep = source_image->GetRepresentation( | 2600 gfx::ImageSkiaRep image_skia_rep = source_image->GetRepresentation( |
2609 scale_factor); | 2601 scale_factor); |
2610 | 2602 |
2611 if (image_skia_rep.is_null() || image_skia_rep.scale_factor() != scale_factor) | 2603 if (image_skia_rep.is_null() || image_skia_rep.scale_factor() != scale_factor) |
2612 return 0; | 2604 return 0; |
2613 | 2605 |
2614 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( | 2606 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 return PP_ERROR_FAILED; | 2722 return PP_ERROR_FAILED; |
2731 | 2723 |
2732 WebDocument document = container_->element().document(); | 2724 WebDocument document = container_->element().document(); |
2733 WebFrame* frame = document.frame(); | 2725 WebFrame* frame = document.frame(); |
2734 if (!frame) | 2726 if (!frame) |
2735 return PP_ERROR_FAILED; | 2727 return PP_ERROR_FAILED; |
2736 | 2728 |
2737 ::ppapi::URLRequestInfoData completed_request = request; | 2729 ::ppapi::URLRequestInfoData completed_request = request; |
2738 | 2730 |
2739 WebURLRequest web_request; | 2731 WebURLRequest web_request; |
2740 if (!CreateWebURLRequest(&completed_request, frame, &web_request)) | 2732 if (!CreateWebURLRequest(pp_instance_, |
| 2733 &completed_request, |
| 2734 frame, |
| 2735 &web_request)) { |
2741 return PP_ERROR_FAILED; | 2736 return PP_ERROR_FAILED; |
| 2737 } |
2742 web_request.setFirstPartyForCookies(document.firstPartyForCookies()); | 2738 web_request.setFirstPartyForCookies(document.firstPartyForCookies()); |
2743 web_request.setHasUserGesture(from_user_action); | 2739 web_request.setHasUserGesture(from_user_action); |
2744 | 2740 |
2745 GURL gurl(web_request.url()); | 2741 GURL gurl(web_request.url()); |
2746 if (gurl.SchemeIs("javascript")) { | 2742 if (gurl.SchemeIs("javascript")) { |
2747 // In imitation of the NPAPI implementation, only |target_frame == frame| is | 2743 // In imitation of the NPAPI implementation, only |target_frame == frame| is |
2748 // allowed for security reasons. | 2744 // allowed for security reasons. |
2749 WebFrame* target_frame = | 2745 WebFrame* target_frame = |
2750 frame->view()->findFrameByName(WebString::fromUTF8(target), frame); | 2746 frame->view()->findFrameByName(WebString::fromUTF8(target), frame); |
2751 if (target_frame != frame) | 2747 if (target_frame != frame) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 // Running out-of-process. Initiate an IPC call to notify the plugin | 2883 // Running out-of-process. Initiate an IPC call to notify the plugin |
2888 // process. | 2884 // process. |
2889 ppapi::proxy::HostDispatcher* dispatcher = | 2885 ppapi::proxy::HostDispatcher* dispatcher = |
2890 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 2886 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
2891 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 2887 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
2892 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 2888 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
2893 } | 2889 } |
2894 } | 2890 } |
2895 | 2891 |
2896 } // namespace content | 2892 } // namespace content |
OLD | NEW |