Chromium Code Reviews| 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 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
| 333 void GetV8ExternalSnapshotData(PP_Instance instance_id, | |
| 334 const char** natives_data_out, | |
| 335 int* natives_size_out, | |
| 336 const char** snapshot_data_out, | |
| 337 int* snapshot_size_out) { | |
| 338 content::PepperPluginInstance* instance = | |
| 339 content::PepperPluginInstance::Get(instance_id); | |
| 340 if (!instance) { | |
| 341 *natives_data_out = *snapshot_data_out = NULL; | |
| 342 *natives_size_out = *snapshot_size_out = 0; | |
|
raymes
2014/11/10 03:29:06
nit: I don't know if this style is common. I'd rat
baixo1
2014/11/10 15:59:47
Done.
| |
| 343 return; | |
| 344 } | |
| 345 instance->GetV8ExternalSnapshotData(natives_data_out, natives_size_out, | |
| 346 snapshot_data_out, snapshot_size_out); | |
| 347 } | |
| 348 #endif | |
| 349 | |
| 332 const PPB_PDF ppb_pdf = { // | 350 const PPB_PDF ppb_pdf = { // |
| 333 &GetLocalizedString, // | 351 &GetLocalizedString, // |
| 334 &GetResourceImage, // | 352 &GetResourceImage, // |
| 335 &GetFontFileWithFallback, // | 353 &GetFontFileWithFallback, // |
| 336 &GetFontTableForPrivateFontFile, // | 354 &GetFontTableForPrivateFontFile, // |
| 337 &SearchString, // | 355 &SearchString, // |
| 338 &DidStartLoading, // | 356 &DidStartLoading, // |
| 339 &DidStopLoading, // | 357 &DidStopLoading, // |
| 340 &SetContentRestriction, // | 358 &SetContentRestriction, // |
| 341 &HistogramPDFPageCount, // | 359 &HistogramPDFPageCount, // |
| 342 &UserMetricsRecordAction, // | 360 &UserMetricsRecordAction, // |
| 343 &HasUnsupportedFeature, // | 361 &HasUnsupportedFeature, // |
| 344 &SaveAs, // | 362 &SaveAs, // |
| 345 &Print, // | 363 &Print, // |
| 346 &IsFeatureEnabled, // | 364 &IsFeatureEnabled, // |
| 347 &GetResourceImageForScale, // | 365 &GetResourceImageForScale, // |
| 348 &ModalPromptForPassword, // | 366 &ModalPromptForPassword, // |
| 349 &IsOutOfProcess, // | 367 &IsOutOfProcess, // |
| 350 &SetSelectedText, // | 368 &SetSelectedText, // |
| 351 &SetLinkUnderCursor, // | 369 &SetLinkUnderCursor, // |
| 370 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | |
|
rmcilroy
2014/11/07 23:46:00
I don't think you need the ifdef here - it's fine
raymes
2014/11/10 03:29:06
+1 We can get rid of the #ifdef above too and bury
baixo1
2014/11/10 15:59:47
Removed both this and the other one above (functio
| |
| 371 &GetV8ExternalSnapshotData, // | |
| 372 #endif | |
| 352 }; | 373 }; |
| 353 | 374 |
| 354 } // namespace | 375 } // namespace |
| 355 | 376 |
| 356 // static | 377 // static |
| 357 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 378 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
| 358 return &ppb_pdf; | 379 return &ppb_pdf; |
| 359 } | 380 } |
| 360 | 381 |
| 361 // static | 382 // static |
| 362 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { | 383 bool PPB_PDF_Impl::InvokePrintingForInstance(PP_Instance instance_id) { |
| 363 return g_print_client ? g_print_client->Print(instance_id) : false; | 384 return g_print_client ? g_print_client->Print(instance_id) : false; |
| 364 } | 385 } |
| 365 | 386 |
| 366 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { | 387 void PPB_PDF_Impl::SetPrintClient(PPB_PDF_Impl::PrintClient* client) { |
| 367 CHECK(!g_print_client) << "There should only be a single PrintClient."; | 388 CHECK(!g_print_client) << "There should only be a single PrintClient."; |
| 368 g_print_client = client; | 389 g_print_client = client; |
| 369 } | 390 } |
| 370 | 391 |
| 371 } // namespace pdf | 392 } // namespace pdf |
| OLD | NEW |