Refactor Skia document type into an enum class

https://chromium-review.googlesource.com/619502
This commit is contained in:
Shelley Vohr 2017-11-23 14:33:38 +01:00 committed by Cheng Zhao
parent 412b9e9ad8
commit de576fa82e
5 changed files with 11 additions and 11 deletions

View file

@ -143,7 +143,7 @@ void PrintViewManagerBase::OnDidPrintPage(
}
std::unique_ptr<PdfMetafileSkia> metafile(
new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
new PdfMetafileSkia(SkiaDocumentType::PDF));
if (metafile_must_be_valid) {
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header";

View file

@ -1254,7 +1254,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
return false;
}
metafile_.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
metafile_.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
CHECK(metafile_->Init());
current_page_index_ = 0;

View file

@ -33,7 +33,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
initial_render_metafile = draft_metafile.get();
}
@ -50,7 +50,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
DCHECK(!draft_metafile.get());
draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
SkiaDocumentType::PDF);
}
return PreviewPageRendered(page_number, draft_metafile.get());
@ -58,7 +58,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
if (!metafile.Init())
return false;

View file

@ -22,7 +22,7 @@ using blink::WebLocalFrame;
void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params,
WebLocalFrame* frame) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
CHECK(metafile.Init());
int page_number = params.page_number;
@ -60,7 +60,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
is_print_ready_metafile_sent_;
if (render_to_draft) {
draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
CHECK(draft_metafile->Init());
initial_render_metafile = draft_metafile.get();
}
@ -80,7 +80,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
DCHECK(!draft_metafile.get());
draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
SkiaDocumentType::PDF);
}
}
return PreviewPageRendered(page_number, draft_metafile.get());

View file

@ -30,7 +30,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
initial_render_metafile = draft_metafile.get();
}
@ -49,14 +49,14 @@ bool PrintWebViewHelper::RenderPreviewPage(
DCHECK(!draft_metafile.get());
draft_metafile =
print_preview_context_.metafile()->GetMetafileForCurrentPage(
PDF_SKIA_DOCUMENT_TYPE);
SkiaDocumentType::PDF);
}
return PreviewPageRendered(page_number, draft_metafile.get());
}
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
if (!metafile.Init())
return false;