| 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 "components/pdf/renderer/ppb_pdf_impl.h" | 5 #include "components/pdf/renderer/ppb_pdf_impl.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_file.h" | 7 #include "base/files/scoped_file.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 void SaveAs(PP_Instance instance_id) { | 235 void SaveAs(PP_Instance instance_id) { |
| 236 content::PepperPluginInstance* instance = | 236 content::PepperPluginInstance* instance = |
| 237 content::PepperPluginInstance::Get(instance_id); | 237 content::PepperPluginInstance::Get(instance_id); |
| 238 if (!instance) | 238 if (!instance) |
| 239 return; | 239 return; |
| 240 GURL url = instance->GetPluginURL(); | 240 GURL url = instance->GetPluginURL(); |
| 241 | 241 |
| 242 content::RenderView* render_view = instance->GetRenderView(); | 242 content::RenderView* render_view = instance->GetRenderView(); |
| 243 blink::WebLocalFrame* frame = | 243 blink::WebLocalFrame* frame = |
| 244 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); | 244 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); |
| 245 content::Referrer referrer(frame->document().url(), | 245 content::Referrer referrer = content::Referrer::SanitizeForRequest( |
| 246 frame->document().referrerPolicy()); | 246 url, content::Referrer(frame->document().url(), |
| 247 frame->document().referrerPolicy())); |
| 247 render_view->Send( | 248 render_view->Send( |
| 248 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); | 249 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); |
| 249 } | 250 } |
| 250 | 251 |
| 251 void Print(PP_Instance instance) { | 252 void Print(PP_Instance instance) { |
| 252 PPB_PDF_Impl::InvokePrintingForInstance(instance); | 253 PPB_PDF_Impl::InvokePrintingForInstance(instance); |
| 253 } | 254 } |
| 254 | 255 |
| 255 PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) { | 256 PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) { |
| 256 switch (feature) { | 257 switch (feature) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { | 374 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { |
| 374 return g_print_client ? g_print_client->Print(instance_id) : false; | 375 return g_print_client ? g_print_client->Print(instance_id) : false; |
| 375 } | 376 } |
| 376 | 377 |
| 377 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { | 378 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { |
| 378 CHECK(!g_print_client) << "There should only be a single PrintClient."; | 379 CHECK(!g_print_client) << "There should only be a single PrintClient."; |
| 379 g_print_client = client; | 380 g_print_client = client; |
| 380 } | 381 } |
| 381 | 382 |
| 382 } // namespace pdf | 383 } // namespace pdf |
| OLD | NEW |