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

Unified Diff: pdf/out_of_process_instance.cc

Issue 870453002: Make the scripting OOP PDF API easier to use (take 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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') | no next file » | 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 58b25a9f66c9a7980a7697d7b6077faa4a5db480..d6ad71adb6724a9ac7ac9a622c22e612de183aff 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -267,8 +267,7 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance)
recently_sent_find_update_(false),
received_viewport_message_(false),
did_call_start_loading_(false),
- stop_scrolling_(false),
- delay_print_(false) {
+ stop_scrolling_(false) {
loader_factory_.Initialize(this);
timer_factory_.Initialize(this);
form_factory_.Initialize(this);
@@ -970,11 +969,6 @@ void OutOfProcessInstance::Email(const std::string& to,
}
void OutOfProcessInstance::Print() {
- if (document_load_state_ == LOAD_STATE_LOADING) {
- delay_print_ = true;
- return;
- }
-
if (!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY) &&
!engine_->HasPermission(PDFEngine::PERMISSION_PRINT_HIGH_QUALITY)) {
return;
@@ -1102,25 +1096,23 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) {
progress_message.Set(pp::Var(kJSProgressPercentage), pp::Var(100));
PostMessage(progress_message);
- if (full_) {
- if (did_call_start_loading_) {
- pp::PDF::DidStopLoading(this);
- did_call_start_loading_ = false;
- }
+ if (!full_)
+ return;
- int content_restrictions =
- CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE;
- if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY))
- content_restrictions |= CONTENT_RESTRICTION_COPY;
+ if (did_call_start_loading_) {
+ pp::PDF::DidStopLoading(this);
+ did_call_start_loading_ = false;
+ }
- pp::PDF::SetContentRestriction(this, content_restrictions);
+ int content_restrictions =
+ CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE;
+ if (!engine_->HasPermission(PDFEngine::PERMISSION_COPY))
+ content_restrictions |= CONTENT_RESTRICTION_COPY;
- uma_.HistogramCustomCounts("PDF.PageCount", page_count,
- 1, 1000000, 50);
- }
+ pp::PDF::SetContentRestriction(this, content_restrictions);
- if (delay_print_)
- Print();
+ uma_.HistogramCustomCounts("PDF.PageCount", page_count,
+ 1, 1000000, 50);
}
void OutOfProcessInstance::RotateClockwise() {
« no previous file with comments | « pdf/out_of_process_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698