summaryrefslogtreecommitdiffstats
path: root/pdf/out_of_process_instance.cc
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 07:14:45 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 07:14:45 +0000
commit993c38816404ba88b532bbaef4aaf232cdcf1dea (patch)
treecd900262eadebf5fab3734d6a1bd3870d1d0678a /pdf/out_of_process_instance.cc
parent244722b1cbc6adbc2d662fbb9ff06c92d350241c (diff)
downloadchromium_src-993c38816404ba88b532bbaef4aaf232cdcf1dea.zip
chromium_src-993c38816404ba88b532bbaef4aaf232cdcf1dea.tar.gz
chromium_src-993c38816404ba88b532bbaef4aaf232cdcf1dea.tar.bz2
Merge DidStartLoading/DidStopLoading imbalance patch to OOP PDF
This merges this CL https://chromereviews.googleplex.com/32997013/ to OOP PDF and also corrects some minor differences that had arisen in document loading. BUG=303491 Review URL: https://codereview.chromium.org/333553003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r--pdf/out_of_process_instance.cc37
1 files changed, 23 insertions, 14 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 49b14ee..8a692c9 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -243,7 +243,8 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance)
print_preview_page_count_(0),
last_progress_sent_(0),
recently_sent_find_update_(false),
- received_viewport_message_(false) {
+ received_viewport_message_(false),
+ did_call_start_loading_(false) {
loader_factory_.Initialize(this);
timer_factory_.Initialize(this);
form_factory_.Initialize(this);
@@ -1002,6 +1003,19 @@ std::string OutOfProcessInstance::ShowFileSelectionDialog() {
}
pp::URLLoader OutOfProcessInstance::CreateURLLoader() {
+ if (full_) {
+ if (!did_call_start_loading_) {
+ did_call_start_loading_ = true;
+ pp::PDF::DidStartLoading(this);
+ }
+
+ // Disable save and print until the document is fully loaded, since they
+ // would generate an incomplete document. Need to do this each time we
+ // call DidStartLoading since that resets the content restrictions.
+ pp::PDF::SetContentRestriction(this, CONTENT_RESTRICTION_SAVE |
+ CONTENT_RESTRICTION_PRINT);
+ }
+
return CreateURLLoaderInternal();
}
@@ -1065,7 +1079,10 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) {
if (!full_)
return;
- pp::PDF::DidStopLoading(this);
+ if (did_call_start_loading_) {
+ pp::PDF::DidStopLoading(this);
+ did_call_start_loading_ = false;
+ }
int content_restrictions =
CONTENT_RESTRICTION_CUT | CONTENT_RESTRICTION_PASTE;
@@ -1119,10 +1136,12 @@ void OutOfProcessInstance::DocumentLoadFailed() {
DCHECK(document_load_state_ == LOAD_STATE_LOADING);
UserMetricsRecordAction("PDF.LoadFailure");
- if (full_)
+ if (did_call_start_loading_) {
pp::PDF::DidStopLoading(this);
- document_load_state_ = LOAD_STATE_FAILED;
+ did_call_start_loading_ = false;
+ }
+ document_load_state_ = LOAD_STATE_FAILED;
paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_));
// Send a progress value of -1 to indicate a failure.
@@ -1263,16 +1282,6 @@ void OutOfProcessInstance::LoadUrlInternal(
}
pp::URLLoader OutOfProcessInstance::CreateURLLoaderInternal() {
- if (full_) {
- pp::PDF::DidStartLoading(this);
-
- // Disable save and print until the document is fully loaded, since they
- // would generate an incomplete document. Need to do this each time we
- // call DidStartLoading since that resets the content restrictions.
- pp::PDF::SetContentRestriction(this, CONTENT_RESTRICTION_SAVE |
- CONTENT_RESTRICTION_PRINT);
- }
-
pp::URLLoader loader(this);
const PPB_URLLoaderTrusted* trusted_interface =