0

Remove PdfOcr feature and flag.

PdfOcr is launched on all desktop platforms and the flag and feature
are not needed anymore.

AX-Relnotes: n/a
Bug: 40064422
Change-Id: I856ed839fd13bd92c9816f789c4b80c6e2413281
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5934367
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: David Tseng <dtseng@chromium.org>
Auto-Submit: Ramin Halavati <rhalavati@chromium.org>
Commit-Queue: Mike West <mkwst@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1371316}
This commit is contained in:
Ramin Halavati
2024-10-21 12:37:15 +00:00
committed by Chromium LUCI CQ
parent 614db3f7a1
commit 8d0dfce04c
17 changed files with 17 additions and 94 deletions

@ -8945,11 +8945,6 @@ const FeatureEntry kFeatureEntries[] = {
#endif
#if BUILDFLAG(ENABLE_PDF)
{"pdf-ocr", flag_descriptions::kPdfOcrName,
flag_descriptions::kPdfOcrDescription,
kOsMac | kOsWin | kOsLinux | kOsCrOS | kOsLacros,
FEATURE_VALUE_TYPE(features::kPdfOcr)},
{"pdf-searchify", flag_descriptions::kPdfSearchifyName,
flag_descriptions::kPdfSearchifyDescription, kOsDesktop,
FEATURE_VALUE_TYPE(chrome_pdf::features::kPdfSearchify)},

@ -130,7 +130,6 @@ class PdfOcrControllerBrowserTest : public base::test::WithFeatureOverride,
std::vector<base::test::FeatureRefAndParams> GetEnabledFeatures()
const override {
auto enabled = PDFExtensionTestBase::GetEnabledFeatures();
enabled.push_back({features::kPdfOcr, {}});
#if BUILDFLAG(IS_CHROMEOS)
enabled.push_back({features::kAccessibilityPdfOcrForSelectToSpeak, {}});
#endif // BUILDFLAG(IS_CHROMEOS)

@ -6,7 +6,6 @@
#include "base/metrics/histogram_macros.h"
#include "chrome/browser/accessibility/accessibility_state_utils.h"
#include "ui/accessibility/accessibility_features.h"
namespace accessibility {
@ -14,7 +13,7 @@ void RecordPDFOpenedWithA11yFeatureWithPdfOcr() {
#if BUILDFLAG(IS_ANDROID)
bool is_pdf_ocr_on = false;
#else
bool is_pdf_ocr_on = features::IsPdfOcrEnabled();
bool is_pdf_ocr_on = true;
#endif
if (accessibility_state_utils::IsScreenReaderEnabled()) {

@ -951,10 +951,8 @@ void PopulateChromeFrameBinders(
base::BindRepeating(&web_app::SubAppsServiceImpl::CreateIfAllowed));
}
if (features::IsPdfOcrEnabled()) {
map->Add<screen_ai::mojom::ScreenAIAnnotator>(
base::BindRepeating(&BindScreenAIAnnotator));
}
map->Add<screen_ai::mojom::ScreenAIAnnotator>(
base::BindRepeating(&BindScreenAIAnnotator));
if (features::IsReadAnythingWithScreen2xEnabled()) {
map->Add<screen_ai::mojom::Screen2xMainContentExtractor>(

@ -6924,11 +6924,6 @@
"owners": [ "andyphan@chromium.org", "awscreen@chromium.org", "thestig@chromium.org" ],
"expiry_milestone": 134
},
{
"name": "pdf-ocr",
"owners": [ "rhalavati@chromium.org", "//ui/accessibility/OWNERS" ],
"expiry_milestone": 135
},
{
"name": "pdf-oopif",
"owners": [ "andyphan@chromium.org", "//pdf/OWNERS" ],

@ -2973,11 +2973,6 @@ const char kPasswordParsingOnSaveUsesPredictionsDescription[] =
"Take server prediction into account when parsing password forms "
"during saving.";
const char kPdfOcrName[] = "Performs OCR on inaccessible PDFs";
const char kPdfOcrDescription[] =
"Enables a feature whereby inaccessible (i.e. untagged) PDFs are made "
"accessible using an optical character recognition service.";
const char kPdfSearchifyName[] = "Make the text in PDF images interactable";
const char kPdfSearchifyDescription[] =
"Enables a feature which runs OCR on PDF images and makes the recognized "

@ -1697,9 +1697,6 @@ extern const char kPasswordManualFallbackAvailableDescription[];
extern const char kPasswordParsingOnSaveUsesPredictionsName[];
extern const char kPasswordParsingOnSaveUsesPredictionsDescription[];
extern const char kPdfOcrName[];
extern const char kPdfOcrDescription[];
extern const char kPdfSearchifyName[];
extern const char kPdfSearchifyDescription[];

@ -224,17 +224,6 @@ class PDFExtensionAccessibilityTest : public PDFExtensionTestBase {
~PDFExtensionAccessibilityTest() override = default;
protected:
std::vector<base::test::FeatureRef> GetDisabledFeatures() const override {
std::vector<base::test::FeatureRef> disabled =
PDFExtensionTestBase::GetDisabledFeatures();
// PDF OCR should not be enabled in `PDFExtensionAccessibilityTest`. If a
// new test class is derived from this class and needs to test PDF OCR,
// make sure that `GetDisabledFeatures()` is overridden to exclude
// `::features::kPdfOcr` from a list of disabled features.
disabled.push_back(::features::kPdfOcr);
return disabled;
}
ui::AXTreeUpdate GetAccessibilityTreeSnapshotForPdf(
content::WebContents* web_contents) {
content::FindAccessibilityNodeCriteria find_criteria;
@ -1205,7 +1194,6 @@ class PdfOcrUmaTest : public PDFExtensionAccessibilityTest,
const override {
std::vector<base::test::FeatureRefAndParams> enabled =
PDFExtensionAccessibilityTest::GetEnabledFeatures();
enabled.push_back({::features::kPdfOcr, {}});
if (UseOopif()) {
enabled.push_back({chrome_pdf::features::kPdfOopif, {}});
}
@ -1213,10 +1201,6 @@ class PdfOcrUmaTest : public PDFExtensionAccessibilityTest,
}
std::vector<base::test::FeatureRef> GetDisabledFeatures() const override {
// `PDFExtensionAccessibilityTest` has
// `::features::kPdfOcr` in a list of disabled features. Now that
// `::features::kPdfOcr` is used in this test, don't include it in the
// disabled list.
std::vector<base::test::FeatureRef> disabled;
if (!UseOopif()) {
disabled.push_back(chrome_pdf::features::kPdfOopif);
@ -1407,7 +1391,6 @@ class PdfOcrIntegrationTest
std::vector<base::test::FeatureRefAndParams> GetEnabledFeatures()
const override {
auto enabled = PDFExtensionAccessibilityTest::GetEnabledFeatures();
enabled.push_back({::features::kPdfOcr, {}});
enabled.push_back({::features::kScreenAITestMode, {}});
if (IsOcrServiceEnabled()) {
enabled.push_back({ax::mojom::features::kScreenAIOCREnabled, {}});
@ -1422,9 +1405,6 @@ class PdfOcrIntegrationTest
}
std::vector<base::test::FeatureRef> GetDisabledFeatures() const override {
// `PDFExtensionAccessibilityTest` has `::features::kPdfOcr` in a list of
// disabled features. Now that `::features::kPdfOcr` is used in this test,
// parent disabled features should not be used.
std::vector<base::test::FeatureRef> disabled;
if (!IsOcrServiceEnabled()) {
disabled.push_back(ax::mojom::features::kScreenAIOCREnabled);

@ -841,17 +841,15 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) {
#else
#if BUILDFLAG(ENABLE_PDF)
if (features::IsPdfOcrEnabled()) {
bool pcf_ocr_may_be_needed = true;
bool pcf_ocr_may_be_needed = true;
#if BUILDFLAG(IS_CHROMEOS)
// `PdfOcrControllerFactory` is not needed in the not-signed-in profile of
// ChromeOS as no user navigation to PDFs is possible there.
pcf_ocr_may_be_needed = IsSignedIn();
// `PdfOcrControllerFactory` is not needed in the not-signed-in profile of
// ChromeOS as no user navigation to PDFs is possible there.
pcf_ocr_may_be_needed = IsSignedIn();
#endif
// Create the PDF OCR controller so that it can self-activate as needed.
if (pcf_ocr_may_be_needed) {
screen_ai::PdfOcrControllerFactory::GetForProfile(this);
}
// Create the PDF OCR controller so that it can self-activate as needed.
if (pcf_ocr_may_be_needed) {
screen_ai::PdfOcrControllerFactory::GetForProfile(this);
}
#endif // BUILDFLAG(ENABLE_PDF)

@ -184,7 +184,6 @@ class ProfileKeyedServiceBrowserTest : public InProcessBrowserTest {
net::features::kTpcdTrialSettings,
net::features::kTopLevelTpcdTrialSettings,
features::kMainNodeAnnotations,
features::kPdfOcr,
features::kPersistentOriginTrials,
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
omnibox::kOnDeviceTailModel,

@ -34,7 +34,6 @@
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_plugin_container.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_enums.mojom-shared.h"
#include "ui/accessibility/ax_enums.mojom.h"
@ -248,8 +247,7 @@ gfx::Transform MakeTransformForImage(const gfx::RectF image_screen_size,
// PDFium by sending their images to the OCR service and adding the recognized
// text to the PDF. Hence they don't need extra work here.
bool PdfOcrInRenderer() {
return features::IsPdfOcrEnabled() &&
!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfSearchify);
return !base::FeatureList::IsEnabled(chrome_pdf::features::kPdfSearchify);
}
} // namespace

@ -2485,7 +2485,7 @@ class PdfOcrHelperTest : public PdfAccessibilityTreeTest,
/* is_ocr_helper_started_before_pdf_loads */ bool,
PdfOcrHelperTestBatchData>> {
public:
PdfOcrHelperTest() : feature_list_(::features::kPdfOcr) {}
PdfOcrHelperTest() = default;
PdfOcrHelperTest(const PdfOcrHelperTest&) = delete;
PdfOcrHelperTest& operator=(const PdfOcrHelperTest&) = delete;
~PdfOcrHelperTest() override = default;
@ -2578,9 +2578,6 @@ class PdfOcrHelperTest : public PdfAccessibilityTreeTest,
uint32_t GetExpectedBatchSize() const {
return std::get<1>(GetParam()).expected_batch_size;
}
private:
base::test::ScopedFeatureList feature_list_;
};
TEST_P(PdfOcrHelperTest, PageBatching) {
@ -2913,16 +2910,7 @@ INSTANTIATE_TEST_SUITE_P(
// TODO(crbug.com/40267312): Add test for end result on a non-synthetic
// multi-page PDF.
class PdfOcrTest : public PdfAccessibilityTreeTest {
public:
PdfOcrTest() : feature_list_(::features::kPdfOcr) {}
PdfOcrTest(const PdfOcrTest&) = delete;
PdfOcrTest& operator=(const PdfOcrTest&) = delete;
~PdfOcrTest() override = default;
private:
base::test::ScopedFeatureList feature_list_;
};
using PdfOcrTest = PdfAccessibilityTreeTest;
TEST_F(PdfOcrTest, CheckLiveRegionPoliteStatus) {
CreatePdfAccessibilityTree();

@ -8,8 +8,8 @@
#include "base/time/time.h"
#include "content/public/renderer/render_frame.h"
#include "pdf/pdf_accessibility_image_fetcher.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "ui/accessibility/accessibility_features.h"
namespace pdf {
@ -54,7 +54,8 @@ PdfOcrHelper::PdfOcrHelper(
remaining_page_count_(page_count),
root_node_id_(root_node_id),
on_ocr_data_received_callback_(std::move(callback)) {
CHECK(features::IsPdfOcrEnabled());
// When PDF searchify is enabled, PDF OCR is not needed.
CHECK(!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfSearchify));
}
PdfOcrHelper::~PdfOcrHelper() {

@ -17,7 +17,6 @@
#include "base/files/file_path.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_discardable_memory_allocator.h"
#include "build/build_config.h"
#include "pdf/accessibility_structs.h"
@ -33,7 +32,6 @@
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size_f.h"
@ -549,8 +547,7 @@ INSTANTIATE_TEST_SUITE_P(All, PDFiumPageImageTest, testing::Bool());
class PDFiumPageImageForOcrTest : public PDFiumPageImageTest {
public:
PDFiumPageImageForOcrTest() : enable_pdf_ocr_({features::kPdfOcr}) {}
PDFiumPageImageForOcrTest() = default;
PDFiumPageImageForOcrTest(const PDFiumPageImageForOcrTest&) = delete;
PDFiumPageImageForOcrTest& operator=(const PDFiumPageImageForOcrTest&) =
delete;
@ -568,7 +565,6 @@ class PDFiumPageImageForOcrTest : public PDFiumPageImageTest {
}
private:
base::test::ScopedFeatureList enable_pdf_ocr_;
base::TestDiscardableMemoryAllocator discardable_memory_allocator_;
};

@ -21287,7 +21287,6 @@ from previous Chrome versions.
<int value="482232604" label="PercentBasedScrolling:enabled"/>
<int value="482429100"
label="OmniboxClobberIsZeroSuggestEntrypoint:disabled"/>
<int value="482577697" label="PdfOcr:enabled"/>
<int value="483155358" label="GlobalMediaControlsForChromeOS:disabled"/>
<int value="483173979" label="SecurePaymentConfirmationExtensions:disabled"/>
<int value="483473934" label="HelpAppOnboardingRevamp:enabled"/>
@ -23936,7 +23935,6 @@ from previous Chrome versions.
<int value="1563267770"
label="FencedFramesReportingAttestationsChanges:disabled"/>
<int value="1565467134" label="AccessibilityShakeToLocate:enabled"/>
<int value="1566945988" label="PdfOcr:disabled"/>
<int value="1567695310" label="CrostiniBullseyeUpgrade:disabled"/>
<int value="1567839560"
label="ChromeHomePersonalizedOmniboxSuggestions:disabled"/>

@ -339,13 +339,6 @@ bool IsMainNodeAnnotationsEnabled() {
return base::FeatureList::IsEnabled(::features::kMainNodeAnnotations);
}
// This feature has a 10% holdback to measure memory impact.
BASE_FEATURE(kPdfOcr, "PdfOcr", base::FEATURE_ENABLED_BY_DEFAULT);
bool IsPdfOcrEnabled() {
return base::FeatureList::IsEnabled(::features::kPdfOcr);
}
BASE_FEATURE(kReadAnythingReadAloud,
"ReadAnythingReadAloud",
#if BUILDFLAG(IS_CHROMEOS_ASH)

@ -252,12 +252,6 @@ AX_BASE_EXPORT bool IsDataCollectionModeForScreen2xEnabled();
AX_BASE_EXPORT BASE_DECLARE_FEATURE(kMainNodeAnnotations);
AX_BASE_EXPORT bool IsMainNodeAnnotationsEnabled();
// Use OCR to make inaccessible (i.e. untagged) PDFs
// accessibility. (Note: Due to the size of the OCR component, this feature
// targets only desktop versions of Chrome for now.)
AX_BASE_EXPORT BASE_DECLARE_FEATURE(kPdfOcr);
AX_BASE_EXPORT bool IsPdfOcrEnabled();
// Show the Read Aloud feature in Read Anything.
AX_BASE_EXPORT BASE_DECLARE_FEATURE(kReadAnythingReadAloud);
AX_BASE_EXPORT bool IsReadAnythingReadAloudEnabled();