Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: pdf/out_of_process_instance.cc

Issue 1155963004: PDF: Cleanup more code now that it is completely out of process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 265c53ff473bebe789ffeb73c3a00aaeaa9937e1..b3bfd341e7379c3981b469d450c5821acd774338 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -343,9 +343,9 @@ bool OutOfProcessInstance::Init(uint32_t argc,
text_input_.reset(new pp::TextInput_Dev(this));
- const char* stream_url = NULL;
- const char* original_url = NULL;
- const char* headers = NULL;
+ const char* stream_url = nullptr;
+ const char* original_url = nullptr;
+ const char* headers = nullptr;
bool is_material = false;
for (uint32_t i = 0; i < argc; ++i) {
if (strcmp(argn[i], "src") == 0)
@@ -363,12 +363,6 @@ bool OutOfProcessInstance::Init(uint32_t argc,
else
background_color_ = kBackgroundColor;
- // TODO(raymes): This is a hack to ensure that if no headers are passed in
- // then we get the right MIME type. When the in process plugin is removed we
- // can fix the document loader properly and remove this hack.
- if (!headers || strcmp(headers, "") == 0)
- headers = "content-type: application/pdf";
-
if (!original_url)
return false;
@@ -444,7 +438,7 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) {
preview_engine_.reset();
engine_.reset(PDFEngine::Create(this));
engine_->SetGrayscale(dict.Get(pp::Var(kJSPrintPreviewGrayscale)).AsBool());
- engine_->New(url_.c_str());
+ engine_->New(url_.c_str(), nullptr /* empty header */);
print_preview_page_count_ =
std::max(dict.Get(pp::Var(kJSPrintPreviewPageCount)).AsInt(), 0);
@@ -915,7 +909,7 @@ void OutOfProcessInstance::UpdateCursor(PP_CursorType_Dev cursor) {
}
cursor_interface->SetCursor(
- pp_instance(), cursor_, pp::ImageData().pp_resource(), NULL);
+ pp_instance(), cursor_, pp::ImageData().pp_resource(), nullptr);
}
void OutOfProcessInstance::UpdateTickMarks(
@@ -1177,7 +1171,7 @@ void OutOfProcessInstance::PreviewDocumentLoadComplete() {
if (print_preview_page_count_ == 0)
return;
- if (preview_pages_info_.size())
+ if (!preview_pages_info_.empty())
LoadAvailablePreviewPage();
}
@@ -1210,7 +1204,7 @@ void OutOfProcessInstance::PreviewDocumentLoadFailed() {
preview_document_load_state_ = LOAD_STATE_FAILED;
preview_pages_info_.pop();
- if (preview_pages_info_.size())
+ if (!preview_pages_info_.empty())
LoadAvailablePreviewPage();
}
@@ -1360,7 +1354,7 @@ void OutOfProcessInstance::AppendBlankPrintPreviewPages() {
if (print_preview_page_count_ == 0)
return;
engine_->AppendBlankPages(print_preview_page_count_);
- if (preview_pages_info_.size() > 0)
+ if (!preview_pages_info_.empty())
LoadAvailablePreviewPage();
}
@@ -1393,7 +1387,7 @@ void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
}
void OutOfProcessInstance::LoadAvailablePreviewPage() {
- if (preview_pages_info_.size() <= 0 ||
+ if (preview_pages_info_.empty() ||
document_load_state_ != LOAD_STATE_COMPLETE) {
return;
}
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | pdf/pdf_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698