From 486ffb91127ce3ceb4eb0ae1ad80205f4ae5a0d6 Mon Sep 17 00:00:00 2001 From: Claudio DeSouza Date: Sat, 16 May 2026 19:38:39 +0100 Subject: [PATCH] [cr149] `kPdfSaveToDrive` disabled by default This feature has been broken in brave, and because of that it was disabled before with a build flag. In M149 that build flag doesn't produce a coherent build anymore, so we fall back to overriding the feature flag. Chromium changes: https://chromium.googlesource.com/chromium/src/+/dd6626cdd58e0ccd306599507de9a47e5a2573e9 commit dd6626cdd58e0ccd306599507de9a47e5a2573e9 Author: April Kallmeyer Date: Fri Apr 24 15:25:16 2026 -0700 [PDF Ink Signatures] Call the new pdfViewerPrivate.getTextInfo() API Pass the results of getTextInfo() to the backend on text annotation commit and cache which fonts were already loaded. Ink2Manager keeps track of the IDs previously sent and will not repeatedly send the same font data to the backend to load, and it will tell the getTextInfo() private API not to serialize the known fonts. The backend is expected to save and reuse the font data from the frontend. Bug: 408976049 Co-Authored-By: Lei Zhang Change-Id: Ifcfd99dcae3d05f5ce5d49f81130ccb9f0cdb731 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7728778 Commit-Queue: April Kallmeyer Reviewed-by: Demetrios Papadopoulos Reviewed-by: Lei Zhang Cr-Commit-Position: refs/heads/main@{#1620509} --- build/args/brave_defaults.gni | 3 --- chromium_src/pdf/pdf_features.cc | 17 +++++++++++++++++ .../content/browser/pdf_text_helper_unittest.cc | 5 +++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 chromium_src/pdf/pdf_features.cc diff --git a/build/args/brave_defaults.gni b/build/args/brave_defaults.gni index 3f89a602f2f..c5cab54e9c1 100644 --- a/build/args/brave_defaults.gni +++ b/build/args/brave_defaults.gni @@ -27,6 +27,3 @@ enable_pseudolocales = false # Our copy of signature_generator.py doesn't support --ignore_missing_cert: ignore_missing_widevine_signing_cert = false - -# Disabling this feature completely, as it is broken in Brave anyway. -enable_pdf_save_to_drive = false diff --git a/chromium_src/pdf/pdf_features.cc b/chromium_src/pdf/pdf_features.cc new file mode 100644 index 00000000000..dfd637a391d --- /dev/null +++ b/chromium_src/pdf/pdf_features.cc @@ -0,0 +1,17 @@ +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "base/feature_override.h" + +#include + +namespace chrome_pdf::features { + +OVERRIDE_FEATURE_DEFAULT_STATES({{ + {kPdfSaveToDrive, base::FEATURE_DISABLED_BY_DEFAULT}, + {kPdfSaveToDriveSurvey, base::FEATURE_DISABLED_BY_DEFAULT}, +}}); + +} // namespace chrome_pdf::features diff --git a/components/ai_chat/content/browser/pdf_text_helper_unittest.cc b/components/ai_chat/content/browser/pdf_text_helper_unittest.cc index 7ca7561f8d2..752ac25b5ed 100644 --- a/components/ai_chat/content/browser/pdf_text_helper_unittest.cc +++ b/components/ai_chat/content/browser/pdf_text_helper_unittest.cc @@ -39,6 +39,11 @@ class FakePdfListener : public pdf::mojom::PdfListener { GetMostVisiblePageIndex, (GetMostVisiblePageIndexCallback), (override)); + MOCK_METHOD(void, + GetSaveDataBufferHandlerForDrive, + (pdf::mojom::SaveRequestType, + GetSaveDataBufferHandlerForDriveCallback), + (override)); }; class TestPdfDocumentHelperClient : public pdf::PDFDocumentHelperClient {