OLD | NEW |
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 #include "components/pdf/renderer/pepper_pdf_host.h" | 5 #include "components/pdf/renderer/pepper_pdf_host.h" |
6 | 6 |
7 #include "components/pdf/common/pdf_messages.h" | 7 #include "components/pdf/common/pdf_messages.h" |
8 #include "components/pdf/renderer/pdf_resource_util.h" | 8 #include "components/pdf/renderer/pdf_resource_util.h" |
9 #include "components/pdf/renderer/ppb_pdf_impl.h" | 9 #include "components/pdf/renderer/ppb_pdf_impl.h" |
10 #include "content/public/common/referrer.h" | 10 #include "content/public/common/referrer.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 int32_t PepperPDFHost::OnHostMsgSaveAs( | 146 int32_t PepperPDFHost::OnHostMsgSaveAs( |
147 ppapi::host::HostMessageContext* context) { | 147 ppapi::host::HostMessageContext* context) { |
148 content::PepperPluginInstance* instance = | 148 content::PepperPluginInstance* instance = |
149 host_->GetPluginInstance(pp_instance()); | 149 host_->GetPluginInstance(pp_instance()); |
150 if (!instance) | 150 if (!instance) |
151 return PP_ERROR_FAILED; | 151 return PP_ERROR_FAILED; |
152 GURL url = instance->GetPluginURL(); | 152 GURL url = instance->GetPluginURL(); |
153 content::RenderView* render_view = instance->GetRenderView(); | 153 content::RenderView* render_view = instance->GetRenderView(); |
154 blink::WebLocalFrame* frame = | 154 blink::WebLocalFrame* frame = |
155 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); | 155 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); |
156 content::Referrer referrer(frame->document().url(), | 156 content::Referrer referrer = content::Referrer::SanitizeForRequest( |
157 frame->document().referrerPolicy()); | 157 url, content::Referrer(frame->document().url(), |
| 158 frame->document().referrerPolicy())); |
158 render_view->Send( | 159 render_view->Send( |
159 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); | 160 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); |
160 return PP_OK; | 161 return PP_OK; |
161 } | 162 } |
162 | 163 |
163 int32_t PepperPDFHost::OnHostMsgGetResourceImage( | 164 int32_t PepperPDFHost::OnHostMsgGetResourceImage( |
164 ppapi::host::HostMessageContext* context, | 165 ppapi::host::HostMessageContext* context, |
165 PP_ResourceImage image_id, | 166 PP_ResourceImage image_id, |
166 float scale) { | 167 float scale) { |
167 gfx::ImageSkia* res_image_skia = GetImageResource(image_id); | 168 gfx::ImageSkia* res_image_skia = GetImageResource(image_id); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 pixels_to_write.copyPixelsTo( | 283 pixels_to_write.copyPixelsTo( |
283 bitmap->getPixels(), bitmap->getSize(), bitmap->rowBytes()); | 284 bitmap->getPixels(), bitmap->getSize(), bitmap->rowBytes()); |
284 | 285 |
285 if (needs_unmapping) | 286 if (needs_unmapping) |
286 image_data->Unmap(); | 287 image_data->Unmap(); |
287 | 288 |
288 return true; | 289 return true; |
289 } | 290 } |
290 | 291 |
291 } // namespace pdf | 292 } // namespace pdf |
OLD | NEW |