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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove code duplication Created 7 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
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 "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
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 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 } 2586 }
2588 2587
2589 const GURL& PepperPluginInstanceImpl::GetPluginURL() { 2588 const GURL& PepperPluginInstanceImpl::GetPluginURL() {
2590 return plugin_url_; 2589 return plugin_url_;
2591 } 2590 }
2592 2591
2593 base::FilePath PepperPluginInstanceImpl::GetModulePath() { 2592 base::FilePath PepperPluginInstanceImpl::GetModulePath() {
2594 return module_->path(); 2593 return module_->path();
2595 } 2594 }
2596 2595
2597 PP_Resource PepperPluginInstanceImpl::CreateExternalFileReference(
2598 const base::FilePath& external_file_path) {
2599 PPB_FileRef_Impl* ref = PPB_FileRef_Impl::CreateExternal(
2600 pp_instance(), external_file_path, "");
2601 return ref->GetReference();
2602 }
2603
2604 PP_Resource PepperPluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image, 2596 PP_Resource PepperPluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image,
2605 float scale) { 2597 float scale) {
2606 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale); 2598 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale);
2607 gfx::ImageSkiaRep image_skia_rep = source_image->GetRepresentation( 2599 gfx::ImageSkiaRep image_skia_rep = source_image->GetRepresentation(
2608 scale_factor); 2600 scale_factor);
2609 2601
2610 if (image_skia_rep.is_null() || image_skia_rep.scale_factor() != scale_factor) 2602 if (image_skia_rep.is_null() || image_skia_rep.scale_factor() != scale_factor)
2611 return 0; 2603 return 0;
2612 2604
2613 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl( 2605 scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 return PP_ERROR_FAILED; 2721 return PP_ERROR_FAILED;
2730 2722
2731 WebDocument document = container_->element().document(); 2723 WebDocument document = container_->element().document();
2732 WebFrame* frame = document.frame(); 2724 WebFrame* frame = document.frame();
2733 if (!frame) 2725 if (!frame)
2734 return PP_ERROR_FAILED; 2726 return PP_ERROR_FAILED;
2735 2727
2736 ::ppapi::URLRequestInfoData completed_request = request; 2728 ::ppapi::URLRequestInfoData completed_request = request;
2737 2729
2738 WebURLRequest web_request; 2730 WebURLRequest web_request;
2739 if (!CreateWebURLRequest(&completed_request, frame, &web_request)) 2731 if (!CreateWebURLRequest(pp_instance_,
2732 &completed_request,
2733 frame,
2734 &web_request)) {
2740 return PP_ERROR_FAILED; 2735 return PP_ERROR_FAILED;
2736 }
2741 web_request.setFirstPartyForCookies(document.firstPartyForCookies()); 2737 web_request.setFirstPartyForCookies(document.firstPartyForCookies());
2742 web_request.setHasUserGesture(from_user_action); 2738 web_request.setHasUserGesture(from_user_action);
2743 2739
2744 GURL gurl(web_request.url()); 2740 GURL gurl(web_request.url());
2745 if (gurl.SchemeIs("javascript")) { 2741 if (gurl.SchemeIs("javascript")) {
2746 // In imitation of the NPAPI implementation, only |target_frame == frame| is 2742 // In imitation of the NPAPI implementation, only |target_frame == frame| is
2747 // allowed for security reasons. 2743 // allowed for security reasons.
2748 WebFrame* target_frame = 2744 WebFrame* target_frame =
2749 frame->view()->findFrameByName(WebString::fromUTF8(target), frame); 2745 frame->view()->findFrameByName(WebString::fromUTF8(target), frame);
2750 if (target_frame != frame) 2746 if (target_frame != frame)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 // Running out-of-process. Initiate an IPC call to notify the plugin 2882 // Running out-of-process. Initiate an IPC call to notify the plugin
2887 // process. 2883 // process.
2888 ppapi::proxy::HostDispatcher* dispatcher = 2884 ppapi::proxy::HostDispatcher* dispatcher =
2889 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 2885 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
2890 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 2886 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
2891 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 2887 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
2892 } 2888 }
2893 } 2889 }
2894 2890
2895 } // namespace content 2891 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698