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

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

Issue 505243003: pdf: Move PepperPDFHost into the pdf component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pdf-component
Patch Set: tot-merge 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
« no previous file with comments | « components/pdf/renderer/ppb_pdf_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 content::RenderView* render_view = instance->GetRenderView(); 316 content::RenderView* render_view = instance->GetRenderView();
317 blink::WebLocalFrame* frame = 317 blink::WebLocalFrame* frame =
318 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); 318 render_view->GetWebView()->mainFrame()->toWebLocalFrame();
319 content::Referrer referrer(frame->document().url(), 319 content::Referrer referrer(frame->document().url(),
320 frame->document().referrerPolicy()); 320 frame->document().referrerPolicy());
321 render_view->Send( 321 render_view->Send(
322 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); 322 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer));
323 } 323 }
324 324
325 void Print(PP_Instance instance) {
326 PPB_PDF_Impl::InvokePrintingForInstance(instance);
327 }
328
325 PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) { 329 PP_Bool IsFeatureEnabled(PP_Instance instance, PP_PDFFeature feature) {
326 switch (feature) { 330 switch (feature) {
327 case PP_PDFFEATURE_HIDPI: 331 case PP_PDFFEATURE_HIDPI:
328 return PP_TRUE; 332 return PP_TRUE;
329 case PP_PDFFEATURE_PRINTING: 333 case PP_PDFFEATURE_PRINTING:
330 return (g_print_client && g_print_client->IsPrintingEnabled(instance)) 334 return (g_print_client && g_print_client->IsPrintingEnabled(instance))
331 ? PP_TRUE 335 ? PP_TRUE
332 : PP_FALSE; 336 : PP_FALSE;
333 } 337 }
334 return PP_FALSE; 338 return PP_FALSE;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 &GetFontFileWithFallback, // 413 &GetFontFileWithFallback, //
410 &GetFontTableForPrivateFontFile, // 414 &GetFontTableForPrivateFontFile, //
411 &SearchString, // 415 &SearchString, //
412 &DidStartLoading, // 416 &DidStartLoading, //
413 &DidStopLoading, // 417 &DidStopLoading, //
414 &SetContentRestriction, // 418 &SetContentRestriction, //
415 &HistogramPDFPageCount, // 419 &HistogramPDFPageCount, //
416 &UserMetricsRecordAction, // 420 &UserMetricsRecordAction, //
417 &HasUnsupportedFeature, // 421 &HasUnsupportedFeature, //
418 &SaveAs, // 422 &SaveAs, //
419 &PPB_PDF_Impl::InvokePrintingForInstance, // 423 &Print, //
420 &IsFeatureEnabled, // 424 &IsFeatureEnabled, //
421 &GetResourceImageForScale, // 425 &GetResourceImageForScale, //
422 &ModalPromptForPassword, // 426 &ModalPromptForPassword, //
423 &IsOutOfProcess, // 427 &IsOutOfProcess, //
424 &SetSelectedText, // 428 &SetSelectedText, //
425 &SetLinkUnderCursor, // 429 &SetLinkUnderCursor, //
426 }; 430 };
427 431
428 } // namespace 432 } // namespace
429 433
430 // static 434 // static
431 const PPB_PDF* PPB_PDF_Impl::GetInterface() { 435 const PPB_PDF* PPB_PDF_Impl::GetInterface() {
432 return &ppb_pdf; 436 return &ppb_pdf;
433 } 437 }
434 438
435 // static 439 // static
436 void PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { 440 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) {
437 if (g_print_client) 441 return g_print_client ? g_print_client->Print(instance_id) : false;
438 g_print_client->Print(instance_id);
439 } 442 }
440 443
441 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { 444 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) {
442 CHECK(!g_print_client) << "There should only be a single PrintClient."; 445 CHECK(!g_print_client) << "There should only be a single PrintClient.";
443 g_print_client = client; 446 g_print_client = client;
444 } 447 }
445 448
446 } // namespace pdf 449 } // namespace pdf
OLDNEW
« no previous file with comments | « components/pdf/renderer/ppb_pdf_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698