Skip to content

Commit

Permalink
PDF Viewer: Stop respecting the PDFViewerUpdate flag.
Browse files Browse the repository at this point in the history
 - In the frontend, hardcode the pdf-viewer-update-enabled attribute.
   Previously present/absent based on the state of the flag.
 - In the backend, remove checks for
   base::FeatureList::IsEnabled(features::kPDFViewerUpdate)

As a result of these changes --disable-features=PDFViewerUpdate no
longer works, in the sense that even if specified it will show the
new UI. Newly dead code (old UI) will be removed in follow up CLs.

Bug: 1164004
Change-Id: I0321f2f22e1358c69f6dc5d5c2662739e0b7ead7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638992
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: K. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845578}
  • Loading branch information
freshp86 authored and Chromium LUCI CQ committed Jan 21, 2021
1 parent cab1e31 commit b0aab7e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
5 changes: 0 additions & 5 deletions chrome/browser/pdf/pdf_extension_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ void AddAdditionalData(base::Value* dict) {
dict->SetKey("pdfFormSaveEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kSaveEditedPDFForm)));
dict->SetStringKey(
"pdfViewerUpdateEnabledAttribute",
base::FeatureList::IsEnabled(chrome_pdf::features::kPDFViewerUpdate)
? "pdf-viewer-update-enabled"
: "");
dict->SetKey("documentPropertiesEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPdfViewerDocumentProperties)));
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/resources/pdf/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}"
$i18n{pdfViewerUpdateEnabledAttribute}>
pdf-viewer-update-enabled>
<head>
<meta charset="utf-8">

Expand Down
21 changes: 7 additions & 14 deletions pdf/out_of_process_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -847,17 +847,13 @@ void OutOfProcessInstance::DidChangeView(const pp::View& view) {
OnGeometryChanged(zoom(), old_device_scale);
}

if (!is_print_preview_ &&
base::FeatureList::IsEnabled(features::kPDFViewerUpdate)) {
// Scrolling in the new PDF Viewer UI is already handled by
// HandleUpdateScrollMessage().
return;
}

if (!stop_scrolling_) {
if (is_print_preview_ && !stop_scrolling_) {
scroll_position_ = PointFromPPPoint(view.GetScrollOffset());
UpdateScroll();
}

// Scrolling in the main PDF Viewer UI is already handled by
// HandleUpdateScrollMessage().
}

void OutOfProcessInstance::UpdateScroll() {
Expand Down Expand Up @@ -1936,8 +1932,7 @@ void OutOfProcessInstance::HandleSaveMessage(const pp::VarDictionary& dict) {

void OutOfProcessInstance::HandleSetReadOnlyMessage(
const pp::VarDictionary& dict) {
if (!base::FeatureList::IsEnabled(features::kPDFViewerUpdate) ||
!base::FeatureList::IsEnabled(features::kPdfViewerPresentationMode) ||
if (!base::FeatureList::IsEnabled(features::kPdfViewerPresentationMode) ||
!dict.Get(pp::Var(kJSEnableReadOnly)).is_bool()) {
NOTREACHED();
return;
Expand All @@ -1948,8 +1943,7 @@ void OutOfProcessInstance::HandleSetReadOnlyMessage(

void OutOfProcessInstance::HandleSetTwoUpViewMessage(
const pp::VarDictionary& dict) {
if (!base::FeatureList::IsEnabled(features::kPDFViewerUpdate) ||
!dict.Get(pp::Var(kJSEnableTwoUpView)).is_bool()) {
if (!dict.Get(pp::Var(kJSEnableTwoUpView)).is_bool()) {
NOTREACHED();
return;
}
Expand All @@ -1959,8 +1953,7 @@ void OutOfProcessInstance::HandleSetTwoUpViewMessage(

void OutOfProcessInstance::HandleUpdateScrollMessage(
const pp::VarDictionary& dict) {
if (!base::FeatureList::IsEnabled(features::kPDFViewerUpdate) ||
!dict.Get(pp::Var(kJSUpdateScrollX)).is_number() ||
if (!dict.Get(pp::Var(kJSUpdateScrollX)).is_number() ||
!dict.Get(pp::Var(kJSUpdateScrollY)).is_number()) {
NOTREACHED();
return;
Expand Down

0 comments on commit b0aab7e

Please sign in to comment.