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

Side by Side Diff: components/pdf/renderer/ppb_pdf_impl.cc

Issue 554893002: [WORK_IN_PROGRESS] PDF::Save() fix for out-of-process-pdf. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better fix for constrained windows Created 6 years, 3 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
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 "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 "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (!instance->IsFullPagePlugin()) 223 if (!instance->IsFullPagePlugin())
224 return; 224 return;
225 225
226 blink::WebView* view = 226 blink::WebView* view =
227 instance->GetContainer()->element().document().frame()->view(); 227 instance->GetContainer()->element().document().frame()->view();
228 content::RenderView* render_view = content::RenderView::FromWebView(view); 228 content::RenderView* render_view = content::RenderView::FromWebView(view);
229 render_view->Send( 229 render_view->Send(
230 new PDFHostMsg_PDFHasUnsupportedFeature(render_view->GetRoutingID())); 230 new PDFHostMsg_PDFHasUnsupportedFeature(render_view->GetRoutingID()));
231 } 231 }
232 232
233 void SaveAs(PP_Instance instance_id) { 233 void SaveAs(PP_Instance instance_id, PP_Var provided_url) {
234 content::PepperPluginInstance* instance = 234 content::PepperPluginInstance* instance =
235 content::PepperPluginInstance::Get(instance_id); 235 content::PepperPluginInstance::Get(instance_id);
236 if (!instance) 236 if (!instance)
237 return; 237 return;
238 scoped_refptr<ppapi::StringVar> url_str(
239 ppapi::StringVar::FromPPVar(provided_url));
240 if (url_str.get())
241 printf("GOT url: %s\n", url_str->value().c_str());
242 else
243 printf("NO URL\n");
238 GURL url = instance->GetPluginURL(); 244 GURL url = instance->GetPluginURL();
239 245
240 content::RenderView* render_view = instance->GetRenderView(); 246 content::RenderView* render_view = instance->GetRenderView();
241 blink::WebLocalFrame* frame = 247 blink::WebLocalFrame* frame =
242 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); 248 render_view->GetWebView()->mainFrame()->toWebLocalFrame();
243 content::Referrer referrer(frame->document().url(), 249 content::Referrer referrer(frame->document().url(),
244 frame->document().referrerPolicy()); 250 frame->document().referrerPolicy());
245 render_view->Send( 251 render_view->Send(
246 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); 252 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer));
247 } 253 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { 359 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) {
354 return g_print_client ? g_print_client->Print(instance_id) : false; 360 return g_print_client ? g_print_client->Print(instance_id) : false;
355 } 361 }
356 362
357 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { 363 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) {
358 CHECK(!g_print_client) << "There should only be a single PrintClient."; 364 CHECK(!g_print_client) << "There should only be a single PrintClient.";
359 g_print_client = client; 365 g_print_client = client;
360 } 366 }
361 367
362 } // namespace pdf 368 } // namespace pdf
OLDNEW
« no previous file with comments | « components/pdf/renderer/pepper_pdf_host.cc ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698