summaryrefslogtreecommitdiffstats
path: root/pdf/out_of_process_instance.cc
diff options
context:
space:
mode:
authorraymes <raymes@chromium.org>2015-02-08 18:36:13 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-09 02:36:36 +0000
commit8a9c0f30c6a73cc644da0a1a736f6bb0e6fd81b5 (patch)
treec17e6f8eb2fb851191f1d2e1180565170a183b50 /pdf/out_of_process_instance.cc
parent8533a5153222d72c6f5485581663db13f285bfaf (diff)
downloadchromium_src-8a9c0f30c6a73cc644da0a1a736f6bb0e6fd81b5.zip
chromium_src-8a9c0f30c6a73cc644da0a1a736f6bb0e6fd81b5.tar.gz
chromium_src-8a9c0f30c6a73cc644da0a1a736f6bb0e6fd81b5.tar.bz2
Make the PDF viewer background color a property of the instance.
This simplifies how the background color is set and makes it work for print preview. BUG= 456621 Review URL: https://codereview.chromium.org/874663006 Cr-Commit-Position: refs/heads/master@{#315256}
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r--pdf/out_of_process_instance.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index 0ccfa36..169a440 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -271,7 +271,8 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance)
recently_sent_find_update_(false),
received_viewport_message_(false),
did_call_start_loading_(false),
- stop_scrolling_(false) {
+ stop_scrolling_(false),
+ background_color_(kBackgroundColor) {
loader_factory_.Initialize(this);
timer_factory_.Initialize(this);
form_factory_.Initialize(this);
@@ -348,10 +349,9 @@ bool OutOfProcessInstance::Init(uint32_t argc,
}
if (is_material)
- engine_->SetBackgroundColor(kBackgroundColorMaterial);
+ background_color_ = kBackgroundColorMaterial;
else
- engine_->SetBackgroundColor(kBackgroundColor);
-
+ 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
@@ -675,7 +675,7 @@ void OutOfProcessInstance::OnPaint(
if (first_paint_) {
first_paint_ = false;
pp::Rect rect = pp::Rect(pp::Point(), image_data_.size());
- FillRect(rect, engine_->GetBackgroundColor());
+ FillRect(rect, background_color_);
ready->push_back(PaintManager::ReadyRect(rect, image_data_, true));
}
@@ -768,7 +768,7 @@ void OutOfProcessInstance::CalculateBackgroundParts() {
// horizontal centering.
BackgroundPart part = {
pp::Rect(0, 0, left_width, bottom),
- engine_->GetBackgroundColor()
+ background_color_
};
if (!part.location.IsEmpty())
background_parts_.push_back(part);
@@ -1347,6 +1347,10 @@ bool OutOfProcessInstance::IsPrintPreview() {
return IsPrintPreviewUrl(url_);
}
+uint32 OutOfProcessInstance::GetBackgroundColor() {
+ return background_color_;
+}
+
void OutOfProcessInstance::ProcessPreviewPageInfo(const std::string& url,
int dst_page_index) {
if (!IsPrintPreview())