Refactor Skia document type into an enum class
https://chromium-review.googlesource.com/619502
This commit is contained in:
parent
412b9e9ad8
commit
de576fa82e
5 changed files with 11 additions and 11 deletions
|
@ -143,7 +143,7 @@ void PrintViewManagerBase::OnDidPrintPage(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PdfMetafileSkia> metafile(
|
std::unique_ptr<PdfMetafileSkia> metafile(
|
||||||
new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
|
new PdfMetafileSkia(SkiaDocumentType::PDF));
|
||||||
if (metafile_must_be_valid) {
|
if (metafile_must_be_valid) {
|
||||||
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
|
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
|
||||||
NOTREACHED() << "Invalid metafile header";
|
NOTREACHED() << "Invalid metafile header";
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
metafile_.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
|
metafile_.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
|
||||||
CHECK(metafile_->Init());
|
CHECK(metafile_->Init());
|
||||||
|
|
||||||
current_page_index_ = 0;
|
current_page_index_ = 0;
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
std::unique_ptr<PdfMetafileSkia> draft_metafile;
|
std::unique_ptr<PdfMetafileSkia> draft_metafile;
|
||||||
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
|
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
|
||||||
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
|
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();
|
initial_render_metafile = draft_metafile.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
DCHECK(!draft_metafile.get());
|
DCHECK(!draft_metafile.get());
|
||||||
draft_metafile =
|
draft_metafile =
|
||||||
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
||||||
PDF_SKIA_DOCUMENT_TYPE);
|
SkiaDocumentType::PDF);
|
||||||
|
|
||||||
}
|
}
|
||||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||||
|
@ -58,7 +58,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
|
|
||||||
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
|
||||||
if (!metafile.Init())
|
if (!metafile.Init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ using blink::WebLocalFrame;
|
||||||
void PrintWebViewHelper::PrintPageInternal(
|
void PrintWebViewHelper::PrintPageInternal(
|
||||||
const PrintMsg_PrintPage_Params& params,
|
const PrintMsg_PrintPage_Params& params,
|
||||||
WebLocalFrame* frame) {
|
WebLocalFrame* frame) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
|
||||||
CHECK(metafile.Init());
|
CHECK(metafile.Init());
|
||||||
|
|
||||||
int page_number = params.page_number;
|
int page_number = params.page_number;
|
||||||
|
@ -60,7 +60,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
is_print_ready_metafile_sent_;
|
is_print_ready_metafile_sent_;
|
||||||
|
|
||||||
if (render_to_draft) {
|
if (render_to_draft) {
|
||||||
draft_metafile.reset(new PdfMetafileSkia(PDF_SKIA_DOCUMENT_TYPE));
|
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
|
||||||
CHECK(draft_metafile->Init());
|
CHECK(draft_metafile->Init());
|
||||||
initial_render_metafile = draft_metafile.get();
|
initial_render_metafile = draft_metafile.get();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
DCHECK(!draft_metafile.get());
|
DCHECK(!draft_metafile.get());
|
||||||
draft_metafile =
|
draft_metafile =
|
||||||
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
||||||
PDF_SKIA_DOCUMENT_TYPE);
|
SkiaDocumentType::PDF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||||
|
|
|
@ -30,7 +30,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
std::unique_ptr<PdfMetafileSkia> draft_metafile;
|
std::unique_ptr<PdfMetafileSkia> draft_metafile;
|
||||||
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
|
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
|
||||||
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
|
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();
|
initial_render_metafile = draft_metafile.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +49,14 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
||||||
DCHECK(!draft_metafile.get());
|
DCHECK(!draft_metafile.get());
|
||||||
draft_metafile =
|
draft_metafile =
|
||||||
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
||||||
PDF_SKIA_DOCUMENT_TYPE);
|
SkiaDocumentType::PDF);
|
||||||
}
|
}
|
||||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
||||||
int page_count) {
|
int page_count) {
|
||||||
PdfMetafileSkia metafile(PDF_SKIA_DOCUMENT_TYPE);
|
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
|
||||||
if (!metafile.Init())
|
if (!metafile.Init())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue