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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 } | 322 } |
323 | 323 |
324 void SetLinkUnderCursor(PP_Instance instance_id, const char* url) { | 324 void SetLinkUnderCursor(PP_Instance instance_id, const char* url) { |
325 content::PepperPluginInstance* instance = | 325 content::PepperPluginInstance* instance = |
326 content::PepperPluginInstance::Get(instance_id); | 326 content::PepperPluginInstance::Get(instance_id); |
327 if (!instance) | 327 if (!instance) |
328 return; | 328 return; |
329 instance->SetLinkUnderCursor(url); | 329 instance->SetLinkUnderCursor(url); |
330 } | 330 } |
331 | 331 |
332 #if !defined(OS_ANDROID) && defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
333 const char* GetV8NativesData(PP_Instance instance_id) { | |
rmcilroy
2014/11/04 21:58:12
Random drive-by comment: Could we just have a sing
raymes
2014/11/04 22:18:13
+1
baixo1
2014/11/07 21:35:34
Done.
| |
334 content::PepperPluginInstance* instance = | |
335 content::PepperPluginInstance::Get(instance_id); | |
336 if (!instance) | |
337 return NULL; | |
338 return instance->GetV8NativesData(); | |
339 } | |
340 | |
341 const char* GetV8SnapshotData(PP_Instance instance_id) { | |
342 content::PepperPluginInstance* instance = | |
343 content::PepperPluginInstance::Get(instance_id); | |
344 if (!instance) | |
345 return NULL; | |
346 return instance->GetV8SnapshotData(); | |
347 } | |
348 | |
349 int GetV8NativesSize(PP_Instance instance_id) { | |
350 content::PepperPluginInstance* instance = | |
351 content::PepperPluginInstance::Get(instance_id); | |
352 if (!instance) | |
353 return 0; | |
354 return instance->GetV8NativesSize(); | |
355 } | |
356 | |
357 int GetV8SnapshotSize(PP_Instance instance_id) { | |
358 content::PepperPluginInstance* instance = | |
359 content::PepperPluginInstance::Get(instance_id); | |
360 if (!instance) | |
361 return 0; | |
362 return instance->GetV8SnapshotSize(); | |
363 } | |
364 #endif // !defined(OS_ANDROID) && defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
365 | |
332 const PPB_PDF ppb_pdf = { // | 366 const PPB_PDF ppb_pdf = { // |
333 &GetLocalizedString, // | 367 &GetLocalizedString, // |
334 &GetResourceImage, // | 368 &GetResourceImage, // |
335 &GetFontFileWithFallback, // | 369 &GetFontFileWithFallback, // |
336 &GetFontTableForPrivateFontFile, // | 370 &GetFontTableForPrivateFontFile, // |
337 &SearchString, // | 371 &SearchString, // |
338 &DidStartLoading, // | 372 &DidStartLoading, // |
339 &DidStopLoading, // | 373 &DidStopLoading, // |
340 &SetContentRestriction, // | 374 &SetContentRestriction, // |
341 &HistogramPDFPageCount, // | 375 &HistogramPDFPageCount, // |
342 &UserMetricsRecordAction, // | 376 &UserMetricsRecordAction, // |
343 &HasUnsupportedFeature, // | 377 &HasUnsupportedFeature, // |
344 &SaveAs, // | 378 &SaveAs, // |
345 &Print, // | 379 &Print, // |
346 &IsFeatureEnabled, // | 380 &IsFeatureEnabled, // |
347 &GetResourceImageForScale, // | 381 &GetResourceImageForScale, // |
348 &ModalPromptForPassword, // | 382 &ModalPromptForPassword, // |
349 &IsOutOfProcess, // | 383 &IsOutOfProcess, // |
350 &SetSelectedText, // | 384 &SetSelectedText, // |
351 &SetLinkUnderCursor, // | 385 &SetLinkUnderCursor, // |
386 #if !defined(OS_ANDROID) && defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
387 &GetV8NativesData, // | |
388 &GetV8SnapshotData, // | |
389 &GetV8NativesSize, // | |
390 &GetV8SnapshotSize, // | |
391 #endif // !defined(OS_ANDROID) && defined(V8_USE_EXTERNAL_STARTUP_DATA) | |
352 }; | 392 }; |
353 | 393 |
354 } // namespace | 394 } // namespace |
355 | 395 |
356 // static | 396 // static |
357 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 397 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
358 return &ppb_pdf; | 398 return &ppb_pdf; |
359 } | 399 } |
360 | 400 |
361 // static | 401 // static |
362 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { | 402 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { |
363 return g_print_client ? g_print_client->Print(instance_id) : false; | 403 return g_print_client ? g_print_client->Print(instance_id) : false; |
364 } | 404 } |
365 | 405 |
366 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { | 406 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { |
367 CHECK(!g_print_client) << "There should only be a single PrintClient."; | 407 CHECK(!g_print_client) << "There should only be a single PrintClient."; |
368 g_print_client = client; | 408 g_print_client = client; |
369 } | 409 } |
370 | 410 |
371 } // namespace pdf | 411 } // namespace pdf |
OLD | NEW |