[unseasoned-pdf] Remove PdfUnseasoned feature
Removes the PdfUnseasoned feature, and the "disabled" native code paths that depend on it. The feature has been launched. Fixed: 1300608 Change-Id: Id463fd9e28c09a9ecbd16375e33d5ce12d051124 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3416330 Reviewed-by: Lei Zhang <thestig@chromium.org> Auto-Submit: K. Moon <kmoon@chromium.org> Reviewed-by: Kevin McNee <mcnee@chromium.org> Commit-Queue: Kevin McNee <mcnee@chromium.org> Cr-Commit-Position: refs/heads/main@{#976267}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
bf35d429fc
commit
31987dc243
chrome
browser
renderer
components/pdf
browser
common
renderer
extensions/browser/guest_view/mime_handler_view
pdf
@ -552,7 +552,6 @@
|
||||
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
||||
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
|
||||
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
||||
@ -5914,8 +5913,7 @@ ChromeContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
mime_types.insert(pair.first);
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
if (pdf::IsInternalPluginExternallyHandled())
|
||||
mime_types.insert(pdf::kInternalPluginMimeType);
|
||||
mime_types.insert(pdf::kInternalPluginMimeType);
|
||||
#endif
|
||||
return mime_types;
|
||||
}
|
||||
@ -6284,8 +6282,7 @@ bool ChromeContentBrowserClient::IsFindInPageDisabledForOrigin(
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
// For PDF viewing with the PPAPI-free PDF Viewer, find-in-page should only
|
||||
// display results from the PDF content, and not from the UI.
|
||||
return base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned) &&
|
||||
IsPdfExtensionOrigin(origin);
|
||||
return IsPdfExtensionOrigin(origin);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -8,18 +8,13 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/check.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "chrome/common/pdf_util.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
|
||||
namespace pdf_frame_util {
|
||||
|
||||
content::RenderFrameHost* FindPdfChildFrame(content::RenderFrameHost* rfh) {
|
||||
if (!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned))
|
||||
return nullptr;
|
||||
|
||||
if (!IsPdfInternalPluginAllowedOrigin(rfh->GetLastCommittedOrigin()))
|
||||
return nullptr;
|
||||
|
||||
|
@ -327,7 +327,6 @@ static_library("renderer") {
|
||||
if (enable_basic_printing) {
|
||||
deps += [
|
||||
"//components/printing/renderer",
|
||||
"//pdf:features",
|
||||
"//printing",
|
||||
]
|
||||
sources += [
|
||||
|
@ -764,8 +764,7 @@ bool ChromeContentRendererClient::IsPluginHandledExternally(
|
||||
return false;
|
||||
}
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
if (plugin_info->actual_mime_type == pdf::kInternalPluginMimeType &&
|
||||
pdf::IsInternalPluginExternallyHandled()) {
|
||||
if (plugin_info->actual_mime_type == pdf::kInternalPluginMimeType) {
|
||||
// Only actually treat the internal PDF plugin as externally handled if
|
||||
// used within an origin allowed to create the internal PDF plugin;
|
||||
// otherwise, let Blink try to create the in-process PDF plugin.
|
||||
@ -1062,7 +1061,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
if (info.name ==
|
||||
ASCIIToUTF16(ChromeContentClient::kPDFInternalPluginName)) {
|
||||
return pdf::CreateInternalPlugin(
|
||||
info, std::move(params), render_frame,
|
||||
std::move(params), render_frame,
|
||||
std::make_unique<ChromePdfInternalPluginDelegate>());
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
@ -23,7 +22,6 @@
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
#include "chrome/common/pdf_util.h"
|
||||
#include "extensions/renderer/guest_view/mime_handler_view/post_message_support.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
|
||||
ChromePrintRenderFrameHelperDelegate::ChromePrintRenderFrameHelperDelegate() =
|
||||
@ -37,25 +35,8 @@ ChromePrintRenderFrameHelperDelegate::~ChromePrintRenderFrameHelperDelegate() =
|
||||
blink::WebElement ChromePrintRenderFrameHelperDelegate::GetPdfElement(
|
||||
blink::WebLocalFrame* frame) {
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
if (IsPdfInternalPluginAllowedOrigin(frame->GetSecurityOrigin())) {
|
||||
DCHECK(!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned));
|
||||
// <object> with id="plugin" is created in
|
||||
// chrome/browser/resources/pdf/pdf_viewer_base.js.
|
||||
auto viewer_element = frame->GetDocument().GetElementById("viewer");
|
||||
if (!viewer_element.IsNull() && !viewer_element.ShadowRoot().IsNull()) {
|
||||
auto plugin_element =
|
||||
viewer_element.ShadowRoot().QuerySelector("#plugin");
|
||||
if (!plugin_element.IsNull()) {
|
||||
return plugin_element;
|
||||
}
|
||||
}
|
||||
NOTREACHED();
|
||||
return blink::WebElement();
|
||||
}
|
||||
|
||||
if (frame->Parent() &&
|
||||
IsPdfInternalPluginAllowedOrigin(frame->Parent()->GetSecurityOrigin())) {
|
||||
DCHECK(base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned));
|
||||
auto plugin_element = frame->GetDocument().QuerySelector("embed");
|
||||
DCHECK(!plugin_element.IsNull());
|
||||
return plugin_element;
|
||||
|
@ -50,7 +50,6 @@ static_library("interceptors") {
|
||||
"//mojo/public/cpp/bindings",
|
||||
"//mojo/public/cpp/system",
|
||||
"//net",
|
||||
"//pdf:features",
|
||||
"//services/network/public/cpp:cpp_base",
|
||||
"//services/network/public/mojom",
|
||||
"//skia",
|
||||
|
@ -6,7 +6,6 @@ include_rules = [
|
||||
"+net/base/net_errors.h",
|
||||
"+net/http/http_response_headers.h",
|
||||
"+pdf/mojom/pdf.mojom.h",
|
||||
"+pdf/pdf_features.h",
|
||||
"+services/network/public/cpp",
|
||||
"+services/network/public/mojom",
|
||||
"+third_party/blink/public/common/associated_interfaces/associated_interface_provider.h",
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/check.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/location.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/threading/sequenced_task_runner_handle.h"
|
||||
@ -19,7 +18,6 @@
|
||||
#include "content/public/browser/navigation_throttle.h"
|
||||
#include "content/public/browser/page_navigator.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "url/gurl.h"
|
||||
@ -31,9 +29,6 @@ std::unique_ptr<content::NavigationThrottle>
|
||||
PdfNavigationThrottle::MaybeCreateThrottleFor(
|
||||
content::NavigationHandle* navigation_handle,
|
||||
std::unique_ptr<PdfStreamDelegate> stream_delegate) {
|
||||
if (!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned))
|
||||
return nullptr;
|
||||
|
||||
if (navigation_handle->IsInMainFrame())
|
||||
return nullptr;
|
||||
|
||||
|
@ -8,14 +8,12 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "components/pdf/browser/pdf_stream_delegate.h"
|
||||
#include "components/pdf/browser/plugin_response_writer.h"
|
||||
#include "content/public/browser/url_loader_request_interceptor.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
|
||||
#include "services/network/public/mojom/url_loader.mojom-forward.h"
|
||||
@ -50,9 +48,6 @@ std::unique_ptr<content::URLLoaderRequestInterceptor>
|
||||
PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
|
||||
int frame_tree_node_id,
|
||||
std::unique_ptr<PdfStreamDelegate> stream_delegate) {
|
||||
if (!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned))
|
||||
return nullptr;
|
||||
|
||||
return std::make_unique<PdfURLLoaderRequestInterceptor>(
|
||||
frame_tree_node_id, std::move(stream_delegate));
|
||||
}
|
||||
|
@ -11,9 +11,4 @@ static_library("common") {
|
||||
"internal_plugin_helpers.cc",
|
||||
"internal_plugin_helpers.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//pdf:features",
|
||||
]
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
include_rules = [
|
||||
"+pdf/pdf_features.h",
|
||||
]
|
@ -4,15 +4,8 @@
|
||||
|
||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
|
||||
namespace pdf {
|
||||
|
||||
const char kInternalPluginMimeType[] = "application/x-google-chrome-pdf";
|
||||
|
||||
bool IsInternalPluginExternallyHandled() {
|
||||
return base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned);
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
@ -10,14 +10,6 @@ namespace pdf {
|
||||
// MIME type of the internal PDF plugin.
|
||||
extern const char kInternalPluginMimeType[];
|
||||
|
||||
// Returns `true` if the internal PDF plugin may be used as an "externally
|
||||
// handled" plugin instance. Such plugin instances load the source URL in a
|
||||
// subframe, rather than creating a `blink::WebPlugin` object.
|
||||
//
|
||||
// Note that in the case of the internal PDF plugin, a second instance within
|
||||
// the subframe eventually does get loaded as a normal `blink::WebPlugin`.
|
||||
bool IsInternalPluginExternallyHandled();
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // COMPONENTS_PDF_COMMON_INTERNAL_PLUGIN_HELPERS_H_
|
||||
|
@ -9,14 +9,12 @@
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "components/pdf/renderer/pdf_internal_plugin_delegate.h"
|
||||
#include "components/pdf/renderer/pdf_view_web_plugin_client.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "mojo/public/cpp/bindings/associated_remote.h"
|
||||
#include "pdf/mojom/pdf.mojom.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
#include "pdf/pdf_view_web_plugin.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
#include "third_party/blink/public/platform/web_security_origin.h"
|
||||
@ -36,7 +34,6 @@ bool IsPdfRenderer() {
|
||||
}
|
||||
|
||||
blink::WebPlugin* CreateInternalPlugin(
|
||||
const content::WebPluginInfo& info,
|
||||
blink::WebPluginParams params,
|
||||
content::RenderFrame* render_frame,
|
||||
std::unique_ptr<PdfInternalPluginDelegate> delegate) {
|
||||
@ -50,11 +47,6 @@ blink::WebPlugin* CreateInternalPlugin(
|
||||
}
|
||||
}
|
||||
|
||||
if (!base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned)) {
|
||||
// Delegate Pepper plugin creation to `content::RenderFrame`.
|
||||
return render_frame->CreatePlugin(info, params);
|
||||
}
|
||||
|
||||
// The in-process plugin should only be created if the parent frame's origin
|
||||
// was allowed to (externally) embed the internal plugin.
|
||||
blink::WebFrame* frame = render_frame->GetWebFrame();
|
||||
|
@ -14,7 +14,6 @@ struct WebPluginParams;
|
||||
|
||||
namespace content {
|
||||
class RenderFrame;
|
||||
struct WebPluginInfo;
|
||||
} // namespace content
|
||||
|
||||
namespace pdf {
|
||||
@ -32,7 +31,6 @@ bool IsPdfRenderer();
|
||||
// Note that `blink::WebPlugin` has a special life cycle, so it's returned as a
|
||||
// raw pointer here.
|
||||
blink::WebPlugin* CreateInternalPlugin(
|
||||
const content::WebPluginInfo& info,
|
||||
blink::WebPluginParams params,
|
||||
content::RenderFrame* render_frame,
|
||||
std::unique_ptr<PdfInternalPluginDelegate> delegate);
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "components/guest_view/common/guest_view_constants.h"
|
||||
#include "content/public/browser/host_zoom_map.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
@ -38,10 +37,6 @@
|
||||
#include "third_party/blink/public/common/input/web_gesture_event.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
#include "pdf/pdf_features.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
|
||||
using content::WebContents;
|
||||
using guest_view::GuestViewBase;
|
||||
|
||||
@ -448,14 +443,12 @@ void MimeHandlerViewGuest::DocumentOnLoadCompletedInPrimaryMainFrame() {
|
||||
void MimeHandlerViewGuest::ReadyToCommitNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
#if BUILDFLAG(ENABLE_PDF)
|
||||
if (base::FeatureList::IsEnabled(chrome_pdf::features::kPdfUnseasoned)) {
|
||||
const GURL& url = navigation_handle->GetURL();
|
||||
if (url.SchemeIs(kExtensionScheme) &&
|
||||
url.host_piece() == extension_misc::kPdfExtensionId) {
|
||||
// The unseasoned PDF viewer will navigate to the stream URL (using
|
||||
// PdfNavigtionThrottle), rather than using it as a subresource.
|
||||
return;
|
||||
}
|
||||
const GURL& url = navigation_handle->GetURL();
|
||||
if (url.SchemeIs(kExtensionScheme) &&
|
||||
url.host_piece() == extension_misc::kPdfExtensionId) {
|
||||
// The unseasoned PDF viewer will navigate to the stream URL (using
|
||||
// PdfNavigtionThrottle), rather than using it as a subresource.
|
||||
return;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_PDF)
|
||||
|
||||
|
@ -20,10 +20,6 @@ const base::Feature kPdfIncrementalLoading = {
|
||||
const base::Feature kPdfPartialLoading = {"PdfPartialLoading",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// TODO(crbug.com/702993): Remove this once the PDF viewer is Pepper-free.
|
||||
const base::Feature kPdfUnseasoned = {"PdfUnseasoned",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT};
|
||||
|
||||
// Feature has no effect if Chrome is built with no XFA support.
|
||||
const base::Feature kPdfXfaSupport = {"PdfXfaSupport",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
@ -16,7 +16,6 @@ namespace features {
|
||||
extern const base::Feature kAccessiblePDFForm;
|
||||
extern const base::Feature kPdfIncrementalLoading;
|
||||
extern const base::Feature kPdfPartialLoading;
|
||||
extern const base::Feature kPdfUnseasoned;
|
||||
extern const base::Feature kPdfXfaSupport;
|
||||
extern const base::Feature kTabAcrossPDFAnnotations;
|
||||
|
||||
|
Reference in New Issue
Block a user