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" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "components/pdf/common/pdf_messages.h" | 12 #include "components/pdf/common/pdf_messages.h" |
13 #include "components/pdf/renderer/pdf_resource_util.h" | 13 #include "components/pdf/renderer/pdf_resource_util.h" |
14 #include "content/public/common/child_process_sandbox_support_linux.h" | 14 #include "content/public/common/child_process_sandbox_support_linux.h" |
15 #include "content/public/common/referrer.h" | 15 #include "content/public/common/referrer.h" |
16 #include "content/public/renderer/pepper_plugin_instance.h" | 16 #include "content/public/renderer/pepper_plugin_instance.h" |
17 #include "content/public/renderer/render_thread.h" | 17 #include "content/public/renderer/render_thread.h" |
18 #include "content/public/renderer/render_view.h" | 18 #include "content/public/renderer/render_view.h" |
| 19 #include "gin/public/isolate_holder.h" |
19 #include "ppapi/c/pp_resource.h" | 20 #include "ppapi/c/pp_resource.h" |
20 #include "ppapi/c/private/ppb_pdf.h" | 21 #include "ppapi/c/private/ppb_pdf.h" |
21 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" | 22 #include "ppapi/c/trusted/ppb_browser_font_trusted.h" |
22 #include "ppapi/shared_impl/ppapi_globals.h" | 23 #include "ppapi/shared_impl/ppapi_globals.h" |
23 #include "ppapi/shared_impl/resource.h" | 24 #include "ppapi/shared_impl/resource.h" |
24 #include "ppapi/shared_impl/resource_tracker.h" | 25 #include "ppapi/shared_impl/resource_tracker.h" |
25 #include "ppapi/shared_impl/var.h" | 26 #include "ppapi/shared_impl/var.h" |
26 #include "third_party/WebKit/public/web/WebDocument.h" | 27 #include "third_party/WebKit/public/web/WebDocument.h" |
27 #include "third_party/WebKit/public/web/WebElement.h" | 28 #include "third_party/WebKit/public/web/WebElement.h" |
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 29 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 323 } |
323 | 324 |
324 void SetLinkUnderCursor(PP_Instance instance_id, const char* url) { | 325 void SetLinkUnderCursor(PP_Instance instance_id, const char* url) { |
325 content::PepperPluginInstance* instance = | 326 content::PepperPluginInstance* instance = |
326 content::PepperPluginInstance::Get(instance_id); | 327 content::PepperPluginInstance::Get(instance_id); |
327 if (!instance) | 328 if (!instance) |
328 return; | 329 return; |
329 instance->SetLinkUnderCursor(url); | 330 instance->SetLinkUnderCursor(url); |
330 } | 331 } |
331 | 332 |
| 333 void GetV8ExternalSnapshotData(const char** natives_data_out, |
| 334 int* natives_size_out, |
| 335 const char** snapshot_data_out, |
| 336 int* snapshot_size_out) { |
| 337 gin::IsolateHolder::GetV8ExternalSnapshotData(natives_data_out, |
| 338 natives_size_out, snapshot_data_out, snapshot_size_out); |
| 339 } |
| 340 |
332 const PPB_PDF ppb_pdf = { // | 341 const PPB_PDF ppb_pdf = { // |
333 &GetLocalizedString, // | 342 &GetLocalizedString, // |
334 &GetResourceImage, // | 343 &GetResourceImage, // |
335 &GetFontFileWithFallback, // | 344 &GetFontFileWithFallback, // |
336 &GetFontTableForPrivateFontFile, // | 345 &GetFontTableForPrivateFontFile, // |
337 &SearchString, // | 346 &SearchString, // |
338 &DidStartLoading, // | 347 &DidStartLoading, // |
339 &DidStopLoading, // | 348 &DidStopLoading, // |
340 &SetContentRestriction, // | 349 &SetContentRestriction, // |
341 &HistogramPDFPageCount, // | 350 &HistogramPDFPageCount, // |
342 &UserMetricsRecordAction, // | 351 &UserMetricsRecordAction, // |
343 &HasUnsupportedFeature, // | 352 &HasUnsupportedFeature, // |
344 &SaveAs, // | 353 &SaveAs, // |
345 &Print, // | 354 &Print, // |
346 &IsFeatureEnabled, // | 355 &IsFeatureEnabled, // |
347 &GetResourceImageForScale, // | 356 &GetResourceImageForScale, // |
348 &ModalPromptForPassword, // | 357 &ModalPromptForPassword, // |
349 &IsOutOfProcess, // | 358 &IsOutOfProcess, // |
350 &SetSelectedText, // | 359 &SetSelectedText, // |
351 &SetLinkUnderCursor, // | 360 &SetLinkUnderCursor, // |
| 361 &GetV8ExternalSnapshotData, // |
352 }; | 362 }; |
353 | 363 |
354 } // namespace | 364 } // namespace |
355 | 365 |
356 // static | 366 // static |
357 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 367 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
358 return &ppb_pdf; | 368 return &ppb_pdf; |
359 } | 369 } |
360 | 370 |
361 // static | 371 // static |
362 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { | 372 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { |
363 return g_print_client ? g_print_client->Print(instance_id) : false; | 373 return g_print_client ? g_print_client->Print(instance_id) : false; |
364 } | 374 } |
365 | 375 |
366 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { | 376 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { |
367 CHECK(!g_print_client) << "There should only be a single PrintClient."; | 377 CHECK(!g_print_client) << "There should only be a single PrintClient."; |
368 g_print_client = client; | 378 g_print_client = client; |
369 } | 379 } |
370 | 380 |
371 } // namespace pdf | 381 } // namespace pdf |
OLD | NEW |