summaryrefslogtreecommitdiffstats
path: root/pdf/out_of_process_instance.cc
diff options
context:
space:
mode:
authoralexandrec <alexandrec@chromium.org>2015-02-02 00:08:58 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-02 08:09:47 +0000
commit04594412237a169189b3bd2b2f35d51bab6a391d (patch)
treed5c5dffae92f6963f9034b1f5214d8f99f84768b /pdf/out_of_process_instance.cc
parentd4543dd10a297c4fb11c5a47d3e61701c7878918 (diff)
downloadchromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.zip
chromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.tar.gz
chromium_src-04594412237a169189b3bd2b2f35d51bab6a391d.tar.bz2
Switch the background color in PDF Viewer when using Material Design
BUG=110020 Review URL: https://codereview.chromium.org/871403005 Cr-Commit-Position: refs/heads/master@{#314108}
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r--pdf/out_of_process_instance.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index d6ad71a..0ccfa36 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -52,6 +52,10 @@ const char kAccessibleNumberOfPages[] = "numberOfPages";
const char kAccessibleLoaded[] = "loaded";
const char kAccessibleCopyable[] = "copyable";
+// PDF background colors.
+const uint32 kBackgroundColor = 0xFFCCCCCC;
+const uint32 kBackgroundColorMaterial = 0xFFEEEEEE;
+
// Constants used in handling postMessage() messages.
const char kType[] = "type";
// Viewport message arguments. (Page -> Plugin).
@@ -331,6 +335,7 @@ bool OutOfProcessInstance::Init(uint32_t argc,
const char* stream_url = NULL;
const char* original_url = NULL;
const char* headers = NULL;
+ bool is_material = false;
for (uint32_t i = 0; i < argc; ++i) {
if (strcmp(argn[i], "src") == 0)
original_url = argv[i];
@@ -338,8 +343,16 @@ bool OutOfProcessInstance::Init(uint32_t argc,
stream_url = argv[i];
else if (strcmp(argn[i], "headers") == 0)
headers = argv[i];
+ else if (strcmp(argn[i], "is-material") == 0)
+ is_material = true;
}
+ if (is_material)
+ engine_->SetBackgroundColor(kBackgroundColorMaterial);
+ else
+ engine_->SetBackgroundColor(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.
@@ -662,7 +675,7 @@ void OutOfProcessInstance::OnPaint(
if (first_paint_) {
first_paint_ = false;
pp::Rect rect = pp::Rect(pp::Point(), image_data_.size());
- FillRect(rect, kBackgroundColor);
+ FillRect(rect, engine_->GetBackgroundColor());
ready->push_back(PaintManager::ReadyRect(rect, image_data_, true));
}
@@ -755,7 +768,7 @@ void OutOfProcessInstance::CalculateBackgroundParts() {
// horizontal centering.
BackgroundPart part = {
pp::Rect(0, 0, left_width, bottom),
- kBackgroundColor
+ engine_->GetBackgroundColor()
};
if (!part.location.IsEmpty())
background_parts_.push_back(part);