From b0aab7e1654f7097a2da45111a2a740473b257d7 Mon Sep 17 00:00:00 2001 From: dpapad Date: Thu, 21 Jan 2021 10:06:52 +0000 Subject: [PATCH] PDF Viewer: Stop respecting the PDFViewerUpdate flag. - 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 Reviewed-by: Daniel Hosseinian Reviewed-by: K. Moon Cr-Commit-Position: refs/heads/master@{#845578} --- chrome/browser/pdf/pdf_extension_util.cc | 5 ----- chrome/browser/resources/pdf/index.html | 2 +- pdf/out_of_process_instance.cc | 21 +++++++-------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc index 3256f23502945b..a4ece042d2a1d7 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc @@ -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))); diff --git a/chrome/browser/resources/pdf/index.html b/chrome/browser/resources/pdf/index.html index db453b53a9ce3c..638c16d0d0473f 100644 --- a/chrome/browser/resources/pdf/index.html +++ b/chrome/browser/resources/pdf/index.html @@ -1,6 +1,6 @@ + pdf-viewer-update-enabled> diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index e3fd60b5bbebd9..97630d11ab0d7e 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -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() { @@ -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; @@ -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; } @@ -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;