chore: bump chromium to 102.0.4961.0 (main) (#33091)
* chore: bump chromium in DEPS to 101.0.4911.0 * chore: bump chromium in DEPS to 101.0.4913.0 * chore: bump chromium in DEPS to 101.0.4915.0 * chore: bump chromium in DEPS to 101.0.4917.0 * chore: bump chromium in DEPS to 101.0.4919.0 * chore: bump chromium in DEPS to 101.0.4921.0 * chore: bump chromium in DEPS to 101.0.4923.0 * chore: bump chromium in DEPS to 101.0.4925.0 * chore: bump chromium in DEPS to 101.0.4927.0 * chore: bump chromium in DEPS to 101.0.4929.0 * chore: update patches * chore: bump chromium in DEPS to 101.0.4931.0 * chore: update patches * 3475388: Remove mojo::InterfacePtr<T> and mojo::InterfacePtrInfo<T> Ref:3475388
Actual fixes in 1824792: Migrate DisplayClient to the new Mojo types |1824792
* 3503874: Remove base::size(), base::empty(), and base::data(). Ref:3503874
* chore: reconcile patches with main rebase * chore: bump chromium in DEPS to 101.0.4933.0 * chore: update patches * 3329593: [Fenced Frame] Ensure to support external protocols in a fenced frame Ref:3329593
* 3503874: Remove base::size(), base::empty(), and base::data(). Ref:3503874
* 3446451: Use forward decl of ImageSkiaRep in //ui/gfx/image/image_skia.h Ref:3446451
* 3499818: partition_alloc: Rename AllocFlags to AllocWithFlags Ref:3499818
* chore: bump chromium in DEPS to 101.0.4935.0 * chore: update patches * 3463286: partition_alloc: Move PartitionAlloc into the own namespaces (15 of N) Ref:3463286
* 3506590: Reland "Support ChromeOS external protocol dialog for Fenced Frame navigations" Ref:3506590
* 3475388: Remove mojo::InterfacePtr<T> and mojo::InterfacePtrInfo<T> Ref:3475388
Actual fixes in 1880987: Convert URLLoaderReqeust from //content to new Mojo types |1880987
The change in the roll started causing the legacy types to fail * chore: missing SkRegion include * 3499600: Introduce blink::WebCssOrigin Ref:3499600
* fixup!: 3503874: Remove base::size(), base::empty(), and base::data(). Ref:3503874
* chore: bump chromium in DEPS to 101.0.4937.0 * chore: update patches * 3500826: [locales] Refactor locales for ios Ref:3500826
* 3509531: Make some public Blink media files private Ref:3509531
* 3497377: bluetooth: Add BluetoothDevice.forget() Ref:3497377
* chore: bump chromium in DEPS to 101.0.4939.0 * chore: bump chromium in DEPS to 101.0.4941.0 * 3514804: Deprecate all existing uses of mojo_base.mojom.{Dictionary,List}Value. Ref:3514804
* 3502592: Delete PPAPI init/shutdown code in //pdf. Ref:3502592
* chore: update patches * fixup! 3502592: Delete PPAPI init/shutdown code in //pdf. * chore: bump chromium in DEPS to 101.0.4943.0 * chore: fix lint, remove unneeded headers * fixup! 3475388: Remove mojo::InterfacePtr<T> and mojo::InterfacePtrInfo<T> * update mojo calls in offscreen patch * update hunspell filenames * chore: bump chromium in DEPS to 101.0.4945.0 * chore: update patches * fix offscreen patch again * chore: bump chromium in DEPS to 101.0.4947.0 * chore: update patches * chore: bump chromium in DEPS to 101.0.4949.0 * support unseasoned pdf * update patches * chore: update patches * chore: [IWYU] include missing skia headers * chore: bump chromium in DEPS to 101.0.4951.0 * chore: update patches * 3457645: media: Remove IsKeySystemsUpdateNeeded()3457645
* chore: bump chromium in DEPS to 102.0.4952.2 * chore: update patches * 3488672: Add documentId as a parameter in tabs.connect() and tabs.sendMessage(). Ref:3488672
* 3508375: Fix an issue dangerous dialog is not shown for some apk download Ref:3508375
* chore: bump chromium in DEPS to 102.0.4953.0 * chore: update patches * 3510189: Harden up drag and drop support across same-process boundaries. Ref:3510189
* 3526815: Remove hardcoded colors from chrome/browser/ui/views/overlay/. Ref:3526815
* chore: bump chromium in DEPS to 102.0.4955.0 * build: add af and ur locale to manifests 3498914 [locales] Add af and ur to desktop Ref:3498914
* fixup! build: add af and ur locale to manifests * chore: bump chromium in DEPS to 102.0.4957.0 * 3529090: gin: set JS flags before v8 initialization Xref:3529090
chore: fix code shear in chromium/gin_enable_disable_v8_platform.patch * chore: update patches * 3536433: [network] Rename data_path and http_cache_path from _path to _directory. Xref:3536433
* 3111565: Relocated Page.printToPDF implementation to //components Xref:3111565
refactor: inject E args to PrintRequestedPages() and ScriptedPrintCallback TODO: currently passes a placeholder for job_settings. We have other code paths that inject settings from electron_api_web_contents.cc. Should those be injected here as well? (CC @codebytere) * fixup! 3111565: Relocated Page.printToPDF implementation to //components * fixup! 3111565: Relocated Page.printToPDF implementation to //components * 3520025: Make "libcxx_abi_unstable" not a gn arg Xref:3520025
build: since it is no longer a gn arg, patch it in * chore: change usages of std::vector with const elements (#33373) * chore: bump chromium in DEPS to 102.0.4959.0 * chore: update patches * build: iwyu base/threading/platform_thread.h * 3525774: Add GPSForCurrentDocument() into PermissionControllerDelegate. Xref:3525774
refactor: copy upstream impl of GetPermissionStatusForCurrentDocument into +ElectronPermissionManager * use gclient_gn_args_from instead of hand-copying * checkout mac on mac * chore: update patches * Revert "checkout mac on mac" This reverts commit fe9ccf49ec6139868ccf2272c2016cefa3f32769. * fixup! 3525774: Add GPSForCurrentDocument() into PermissionControllerDelegate. * fixup! 3457645: media: Remove IsKeySystemsUpdateNeeded() add nogncheck * fix: set .eslintrc.json to root to avoid cascade to chromium eslintrc * Xref:6dfdf79b8c
Xref: https://reviews.llvm.org/D101458 Upstream added a CMakeLists.txt in an include dir ¯\_(ツ)_/¯ and so it must be enumerated in filenames.libcxxabi.gni * 3511268: Remove unused headers from cxx17_backports.h3511268
use std::size instead of base::size * iwyu: SkPaint 3488428: [includes] Fix transitive includes of SkImageEncoder * chore: [IWYU] include missing skia headers * fixup! 3511268: Remove unused headers from cxx17_backports.h * chore: bump chromium in DEPS to 102.0.4961.0 * chore: update patches * fixup! 3475388: Remove mojo::InterfacePtr<T> and mojo::InterfacePtrInfo<T> chore: remove unused #include * fixup! 3510189: Harden up drag and drop support across same-process boundaries. |3510189
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net> Co-authored-by: VerteDinde <keeleymhammond@gmail.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
This commit is contained in:
parent
92c5dedc76
commit
7e59d784a0
142 changed files with 998 additions and 754 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "content/public/common/content_switches.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "pdf/buildflags.h"
|
||||
#include "ppapi/buildflags/buildflags.h"
|
||||
#include "shell/common/electron_paths.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
|
@ -34,8 +35,8 @@
|
|||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#include "pdf/pdf.h" // nogncheck
|
||||
#include "pdf/pdf_ppapi.h" // nogncheck
|
||||
#include "components/pdf/renderer/internal_plugin_renderer_helpers.h"
|
||||
#include "pdf/pdf.h" // nogncheck
|
||||
#include "shell/common/electron_constants.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
|
@ -43,7 +44,8 @@
|
|||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
#include "ppapi/shared_impl/ppapi_switches.h" // nogncheck crbug.com/1125897
|
||||
#endif // BUILDFLAG(ENABLE_PLUGINS)
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -104,6 +106,8 @@ bool IsWidevineAvailable(
|
|||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
// TODO(upstream/thestig): Figure out how to make the PDF Viewer work without
|
||||
// this PPAPI plugin registration.
|
||||
content::PepperPluginInfo pdf_info;
|
||||
pdf_info.is_internal = true;
|
||||
pdf_info.is_out_of_process = true;
|
||||
|
@ -114,12 +118,6 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
|
|||
content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf",
|
||||
"Portable Document Format");
|
||||
pdf_info.mime_types.push_back(pdf_mime_type);
|
||||
pdf_info.internal_entry_points.get_interface = chrome_pdf::PPP_GetInterface;
|
||||
pdf_info.internal_entry_points.initialize_module =
|
||||
chrome_pdf::PPP_InitializeModule;
|
||||
pdf_info.internal_entry_points.shutdown_module =
|
||||
chrome_pdf::PPP_ShutdownModule;
|
||||
pdf_info.permissions = ppapi::PERMISSION_PDF | ppapi::PERMISSION_DEV;
|
||||
plugins->push_back(pdf_info);
|
||||
|
||||
// NB. in Chrome, this plugin isn't registered until the PDF extension is
|
||||
|
|
|
@ -234,7 +234,7 @@ ElectronMainDelegate::~ElectronMainDelegate() = default;
|
|||
const char* const ElectronMainDelegate::kNonWildcardDomainNonPortSchemes[] = {
|
||||
extensions::kExtensionScheme};
|
||||
const size_t ElectronMainDelegate::kNonWildcardDomainNonPortSchemesSize =
|
||||
base::size(kNonWildcardDomainNonPortSchemes);
|
||||
std::size(kNonWildcardDomainNonPortSchemes);
|
||||
|
||||
bool ElectronMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
|
|
|
@ -91,6 +91,12 @@ bool ElectronBluetoothDelegate::HasDevicePermission(
|
|||
return true;
|
||||
}
|
||||
|
||||
void ElectronBluetoothDelegate::RevokeDevicePermissionWebInitiated(
|
||||
RenderFrameHost* frame,
|
||||
const WebBluetoothDeviceId& device_id) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ElectronBluetoothDelegate::IsAllowedToAccessService(
|
||||
RenderFrameHost* frame,
|
||||
const WebBluetoothDeviceId& device_id,
|
||||
|
|
|
@ -71,6 +71,9 @@ class ElectronBluetoothDelegate : public content::BluetoothDelegate {
|
|||
bool HasDevicePermission(
|
||||
content::RenderFrameHost* frame,
|
||||
const blink::WebBluetoothDeviceId& device_id) override;
|
||||
void RevokeDevicePermissionWebInitiated(
|
||||
content::RenderFrameHost* frame,
|
||||
const blink::WebBluetoothDeviceId& device_id) override;
|
||||
bool IsAllowedToAccessService(content::RenderFrameHost* frame,
|
||||
const blink::WebBluetoothDeviceId& device_id,
|
||||
const device::BluetoothUUID& service) override;
|
||||
|
|
|
@ -40,7 +40,9 @@
|
|||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/skia_util.h"
|
||||
#include "skia/ext/legacy_display_globals.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkFont.h"
|
||||
#include "third_party/skia/include/core/SkPaint.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/events/keycodes/keyboard_code_conversion_win.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
|
@ -97,7 +99,7 @@ std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) {
|
|||
return std::wstring();
|
||||
|
||||
wchar_t out_buffer[1024];
|
||||
DWORD buffer_size = base::size(out_buffer);
|
||||
DWORD buffer_size = std::size(out_buffer);
|
||||
HRESULT hr =
|
||||
AssocQueryString(ASSOCF_IS_PROTOCOL, assoc_str, url_scheme.c_str(), NULL,
|
||||
out_buffer, &buffer_size);
|
||||
|
|
|
@ -27,11 +27,16 @@
|
|||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/pdf/chrome_pdf_stream_delegate.h"
|
||||
#include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/chrome_version.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/network_hints/common/network_hints.mojom.h"
|
||||
#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 "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
|
||||
#include "content/browser/site_instance_impl.h" // nogncheck
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
|
@ -620,7 +625,7 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
|
|||
switches::kServiceWorkerSchemes, switches::kStreamingSchemes};
|
||||
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
||||
kCommonSwitchNames,
|
||||
base::size(kCommonSwitchNames));
|
||||
std::size(kCommonSwitchNames));
|
||||
if (process_type == ::switches::kUtilityProcess ||
|
||||
content::RenderProcessHost::FromID(process_id)) {
|
||||
MaybeAppendSecureOriginsAllowlistSwitch(command_line);
|
||||
|
@ -1042,10 +1047,10 @@ void HandleExternalProtocolInUI(
|
|||
bool ElectronBrowserClient::HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int child_id,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
|
@ -1070,6 +1075,18 @@ ElectronBrowserClient::CreateThrottlesForNavigation(
|
|||
std::make_unique<extensions::ExtensionNavigationThrottle>(handle));
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
std::unique_ptr<content::NavigationThrottle> pdf_iframe_throttle =
|
||||
PDFIFrameNavigationThrottle::MaybeCreateThrottleFor(handle);
|
||||
if (pdf_iframe_throttle)
|
||||
throttles.push_back(std::move(pdf_iframe_throttle));
|
||||
std::unique_ptr<content::NavigationThrottle> pdf_throttle =
|
||||
pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(
|
||||
handle, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_throttle)
|
||||
throttles.push_back(std::move(pdf_throttle));
|
||||
#endif
|
||||
|
||||
return throttles;
|
||||
}
|
||||
|
||||
|
@ -1474,6 +1491,26 @@ bool ElectronBrowserClient::WillCreateURLLoaderFactory(
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
|
||||
ElectronBrowserClient::WillCreateURLLoaderRequestInterceptors(
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
const scoped_refptr<network::SharedURLLoaderFactory>&
|
||||
network_loader_factory) {
|
||||
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
|
||||
interceptors;
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
{
|
||||
std::unique_ptr<content::URLLoaderRequestInterceptor> pdf_interceptor =
|
||||
pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
|
||||
frame_tree_node_id, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_interceptor)
|
||||
interceptors.push_back(std::move(pdf_interceptor));
|
||||
}
|
||||
#endif
|
||||
return interceptors;
|
||||
}
|
||||
|
||||
void ElectronBrowserClient::OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
|
@ -1747,6 +1784,9 @@ ElectronBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
|||
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context);
|
||||
for (const auto& pair : map)
|
||||
mime_types.insert(pair.first);
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
mime_types.insert(pdf::kInternalPluginMimeType);
|
||||
#endif
|
||||
return mime_types;
|
||||
}
|
||||
|
|
|
@ -227,6 +227,12 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
||||
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
|
||||
WillCreateURLLoaderRequestInterceptors(
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
const scoped_refptr<network::SharedURLLoaderFactory>&
|
||||
network_loader_factory) override;
|
||||
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
||||
base::StringPiece scheme,
|
||||
bool is_embedded_origin_secure) override;
|
||||
|
@ -247,10 +253,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
bool HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int child_id,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "base/debug/leak_annotations.h"
|
||||
#include "base/posix/eintr_wrapper.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "shell/browser/browser.h"
|
||||
|
|
|
@ -141,11 +141,11 @@ void ElectronDownloadManagerDelegate::OnDownloadPathGenerated(
|
|||
std::ignore = dialog_promise.Then(std::move(dialog_callback));
|
||||
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
|
||||
} else {
|
||||
std::move(callback).Run(path,
|
||||
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
item->GetMixedContentStatus(), path, absl::nullopt,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
std::move(callback).Run(
|
||||
path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
item->GetMixedContentStatus(), path, base::FilePath(), absl::nullopt,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ void ElectronDownloadManagerDelegate::OnDownloadSaveDialogDone(
|
|||
std::move(download_callback)
|
||||
.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
item->GetMixedContentStatus(), path, absl::nullopt,
|
||||
item->GetMixedContentStatus(), path, base::FilePath(), absl::nullopt,
|
||||
interrupt_reason);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ bool ElectronDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
download->GetForcedFilePath(), absl::nullopt,
|
||||
download->GetForcedFilePath(), base::FilePath(), absl::nullopt,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
@ -217,7 +217,8 @@ bool ElectronDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
save_path, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN, save_path,
|
||||
absl::nullopt, download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
base::FilePath(), absl::nullopt,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "base/values.h"
|
||||
#include "content/browser/permissions/permission_util.h" // nogncheck
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/permission_controller.h"
|
||||
|
@ -398,4 +399,13 @@ ElectronPermissionManager::GetPermissionStatusForFrame(
|
|||
: blink::mojom::PermissionStatus::DENIED;
|
||||
}
|
||||
|
||||
blink::mojom::PermissionStatus
|
||||
ElectronPermissionManager::GetPermissionStatusForCurrentDocument(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
return GetPermissionStatus(
|
||||
permission, render_frame_host->GetLastCommittedOrigin().GetURL(),
|
||||
content::PermissionUtil::GetLastCommittedOriginAsURL(render_frame_host));
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -85,6 +85,9 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
|
|||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin) override;
|
||||
blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
|
||||
bool CheckPermissionWithDetails(content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
|
|
|
@ -40,7 +40,7 @@ ElectronExtensionMessageFilter::ElectronExtensionMessageFilter(
|
|||
int render_process_id,
|
||||
content::BrowserContext* browser_context)
|
||||
: BrowserMessageFilter(kExtensionFilteredMessageClasses,
|
||||
base::size(kExtensionFilteredMessageClasses)),
|
||||
std::size(kExtensionFilteredMessageClasses)),
|
||||
render_process_id_(render_process_id),
|
||||
browser_context_(browser_context) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
|
|
@ -75,13 +75,40 @@ std::unique_ptr<MessagePort> ElectronMessagingDelegate::CreateReceiverForTab(
|
|||
const std::string& extension_id,
|
||||
const PortId& receiver_port_id,
|
||||
content::WebContents* receiver_contents,
|
||||
int receiver_frame_id) {
|
||||
int receiver_frame_id,
|
||||
const std::string& receiver_document_id) {
|
||||
// Frame ID -1 is every frame in the tab.
|
||||
bool include_child_frames = receiver_frame_id == -1;
|
||||
content::RenderFrameHost* receiver_rfh =
|
||||
include_child_frames ? receiver_contents->GetMainFrame()
|
||||
: ExtensionApiFrameIdMap::GetRenderFrameHostById(
|
||||
receiver_contents, receiver_frame_id);
|
||||
bool include_child_frames =
|
||||
receiver_frame_id == -1 && receiver_document_id.empty();
|
||||
|
||||
content::RenderFrameHost* receiver_rfh = nullptr;
|
||||
if (include_child_frames) {
|
||||
// The target is the active outermost main frame of the WebContents.
|
||||
receiver_rfh = receiver_contents->GetMainFrame();
|
||||
} else if (!receiver_document_id.empty()) {
|
||||
ExtensionApiFrameIdMap::DocumentId document_id =
|
||||
ExtensionApiFrameIdMap::DocumentIdFromString(receiver_document_id);
|
||||
|
||||
// Return early for invalid documentIds.
|
||||
if (!document_id)
|
||||
return nullptr;
|
||||
|
||||
receiver_rfh =
|
||||
ExtensionApiFrameIdMap::Get()->GetRenderFrameHostByDocumentId(
|
||||
document_id);
|
||||
|
||||
// If both |document_id| and |receiver_frame_id| are provided they
|
||||
// should find the same RenderFrameHost, if not return early.
|
||||
if (receiver_frame_id != -1 &&
|
||||
ExtensionApiFrameIdMap::GetRenderFrameHostById(
|
||||
receiver_contents, receiver_frame_id) != receiver_rfh) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
DCHECK_GT(receiver_frame_id, -1);
|
||||
receiver_rfh = ExtensionApiFrameIdMap::GetRenderFrameHostById(
|
||||
receiver_contents, receiver_frame_id);
|
||||
}
|
||||
if (!receiver_rfh)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ class ElectronMessagingDelegate : public MessagingDelegate {
|
|||
const std::string& extension_id,
|
||||
const PortId& receiver_port_id,
|
||||
content::WebContents* receiver_contents,
|
||||
int receiver_frame_id) override;
|
||||
int receiver_frame_id,
|
||||
const std::string& receiver_document_id) override;
|
||||
std::unique_ptr<MessagePort> CreateReceiverForNativeApp(
|
||||
content::BrowserContext* browser_context,
|
||||
base::WeakPtr<MessagePort::ChannelDelegate> channel_delegate,
|
||||
|
|
|
@ -103,7 +103,7 @@ const FontDefault kFontDefaults[] = {
|
|||
IDS_FIXED_FONT_FAMILY_TRADITIONAL_HAN},
|
||||
#endif
|
||||
};
|
||||
const size_t kFontDefaultsLength = base::size(kFontDefaults);
|
||||
const size_t kFontDefaultsLength = std::size(kFontDefaults);
|
||||
|
||||
// ^^^^^ DO NOT EDIT ^^^^^
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
|||
private:
|
||||
static void* AllocateMemoryOrNull(size_t size, InitializationPolicy policy) {
|
||||
return AllocateMemoryWithFlags(size, policy,
|
||||
base::PartitionAllocReturnNull);
|
||||
partition_alloc::AllocFlags::kReturnNull);
|
||||
}
|
||||
|
||||
static void* AllocateMemoryWithFlags(size_t size,
|
||||
|
@ -131,9 +131,9 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
|||
}
|
||||
|
||||
if (policy == kZeroInitialize) {
|
||||
flags |= base::PartitionAllocZeroFill;
|
||||
flags |= partition_alloc::AllocFlags::kZeroFill;
|
||||
}
|
||||
void* data = allocator_->root()->AllocFlags(flags, size, "Electron");
|
||||
void* data = allocator_->root()->AllocWithFlags(flags, size, "Electron");
|
||||
if (base::kAlignment < 16) {
|
||||
char* ptr = reinterpret_cast<char*>(data);
|
||||
DCHECK_EQ(base::bits::AlignUp(ptr, 16), ptr)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "shell/common/api/api.mojom.h"
|
||||
#include "third_party/skia/include/core/SkRegion.h"
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
|
|
@ -63,7 +63,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
|||
public:
|
||||
static void CreateAndStart(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
|
||||
// Owns itself. Will live as long as its URLLoader and URLLoaderClientPtr
|
||||
|
@ -390,7 +390,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
|||
|
||||
void CreateAsarURLLoader(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
|
||||
auto task_runner = base::ThreadPool::CreateSequencedTaskRunner(
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace asar {
|
|||
|
||||
void CreateAsarURLLoader(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
scoped_refptr<net::HttpResponseHeaders> extra_response_headers);
|
||||
|
||||
|
|
|
@ -80,14 +80,14 @@ void NetworkContextService::ConfigureNetworkContextParams(
|
|||
// Configure on-disk storage for persistent sessions.
|
||||
if (!in_memory) {
|
||||
// Configure the HTTP cache path and size.
|
||||
network_context_params->http_cache_path =
|
||||
network_context_params->http_cache_directory =
|
||||
path.Append(chrome::kCacheDirname);
|
||||
network_context_params->http_cache_max_size =
|
||||
browser_context_->GetMaxCacheSize();
|
||||
|
||||
network_context_params->file_paths =
|
||||
network::mojom::NetworkContextFilePaths::New();
|
||||
network_context_params->file_paths->data_path =
|
||||
network_context_params->file_paths->data_directory =
|
||||
path.Append(chrome::kNetworkDataDirname);
|
||||
network_context_params->file_paths->unsandboxed_data_path = path;
|
||||
network_context_params->file_paths->trigger_migration =
|
||||
|
|
|
@ -523,8 +523,9 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToStartRequest(
|
|||
if (has_any_extra_headers_listeners_)
|
||||
options |= network::mojom::kURLLoadOptionUseHeaderClient;
|
||||
factory_->target_factory_->CreateLoaderAndStart(
|
||||
mojo::MakeRequest(&target_loader_), network_service_request_id_,
|
||||
options, request_, proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
||||
target_loader_.BindNewPipeAndPassReceiver(),
|
||||
network_service_request_id_, options, request_,
|
||||
proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
||||
traffic_annotation_);
|
||||
}
|
||||
|
||||
|
@ -760,7 +761,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
uint64_t* request_id_generator,
|
||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
network::mojom::URLLoaderFactoryRequest loader_request,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
header_client_receiver,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "services/network/url_loader_factory.h"
|
||||
#include "shell/browser/net/electron_url_loader_factory.h"
|
||||
#include "shell/browser/net/web_request_api_interface.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
@ -146,7 +147,7 @@ class ProxyingURLLoaderFactory
|
|||
|
||||
mojo::Receiver<network::mojom::URLLoaderClient> proxied_client_receiver_{
|
||||
this};
|
||||
network::mojom::URLLoaderPtr target_loader_;
|
||||
mojo::Remote<network::mojom::URLLoader> target_loader_;
|
||||
|
||||
network::mojom::URLResponseHeadPtr current_response_;
|
||||
mojo::ScopedDataPipeConsumerHandle current_body_;
|
||||
|
@ -198,7 +199,7 @@ class ProxyingURLLoaderFactory
|
|||
uint64_t* request_id_generator,
|
||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
network::mojom::URLLoaderFactoryRequest loader_request,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
target_factory_remote,
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "base/scoped_observation.h"
|
||||
#include "shell/browser/native_window_views.h"
|
||||
#include "shell/browser/ui/views/client_frame_view_linux.h"
|
||||
#include "third_party/skia/include/core/SkRRect.h"
|
||||
#include "ui/native_theme/native_theme_observer.h"
|
||||
#include "ui/views/linux_ui/device_scale_factor_observer.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
|
||||
|
|
|
@ -206,7 +206,7 @@ bool ShowOpenDialogSync(const DialogSettings& settings,
|
|||
|
||||
wchar_t file_name[MAX_PATH];
|
||||
hr = GetFileNameFromShellItem(item, SIGDN_FILESYSPATH, file_name,
|
||||
base::size(file_name));
|
||||
std::size(file_name));
|
||||
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "base/files/file_path.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/nix/xdg_util.h"
|
||||
#include "third_party/skia/include/core/SkImage.h"
|
||||
#include "ui/base/glib/glib_signal.h"
|
||||
#include "ui/views/linux_ui/status_icon_linux.h"
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
|
|||
|
||||
double GetNextZoomLevel(double level, bool out) {
|
||||
double factor = blink::PageZoomLevelToZoomFactor(level);
|
||||
size_t size = base::size(kPresetZoomFactors);
|
||||
size_t size = std::size(kPresetZoomFactors);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (!blink::PageZoomValuesEqual(kPresetZoomFactors[i], factor))
|
||||
continue;
|
||||
|
|
|
@ -93,7 +93,7 @@ bool ConvertShellLinkToJumpListItem(IShellLink* shell_link,
|
|||
|
||||
item->type = JumpListItem::Type::kTask;
|
||||
wchar_t path[MAX_PATH];
|
||||
if (FAILED(shell_link->GetPath(path, base::size(path), nullptr, 0)))
|
||||
if (FAILED(shell_link->GetPath(path, std::size(path), nullptr, 0)))
|
||||
return false;
|
||||
|
||||
item->path = base::FilePath(path);
|
||||
|
@ -111,18 +111,18 @@ bool ConvertShellLinkToJumpListItem(IShellLink* shell_link,
|
|||
item->title = prop.get().pwszVal;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(shell_link->GetWorkingDirectory(path, base::size(path))))
|
||||
if (SUCCEEDED(shell_link->GetWorkingDirectory(path, std::size(path))))
|
||||
item->working_dir = base::FilePath(path);
|
||||
|
||||
int icon_index;
|
||||
if (SUCCEEDED(
|
||||
shell_link->GetIconLocation(path, base::size(path), &icon_index))) {
|
||||
shell_link->GetIconLocation(path, std::size(path), &icon_index))) {
|
||||
item->icon_path = base::FilePath(path);
|
||||
item->icon_index = icon_index;
|
||||
}
|
||||
|
||||
wchar_t item_desc[INFOTIPSIZE];
|
||||
if (SUCCEEDED(shell_link->GetDescription(item_desc, base::size(item_desc))))
|
||||
if (SUCCEEDED(shell_link->GetDescription(item_desc, std::size(item_desc))))
|
||||
item->description = item_desc;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "gin/wrappable.h"
|
||||
#include "shell/common/gin_helper/error_thrower.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia_rep.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "base/files/file_path.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "shell/common/gin_converters/image_converter.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/gfx/image/image_skia_operations.h"
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ v8::Local<v8::Value> BindFunctionWith(v8::Isolate* isolate,
|
|||
CHECK(!bind.IsEmpty());
|
||||
v8::Local<v8::Function> bind_func = bind.ToLocalChecked().As<v8::Function>();
|
||||
v8::Local<v8::Value> converted[] = {func, arg1, arg2};
|
||||
return bind_func->Call(context, func, base::size(converted), converted)
|
||||
return bind_func->Call(context, func, std::size(converted), converted)
|
||||
.ToLocalChecked();
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ void ShowItemInFolderOnWorkerThread(const base::FilePath& full_path) {
|
|||
return;
|
||||
|
||||
const ITEMIDLIST* highlight[] = {file_item};
|
||||
hr = SHOpenFolderAndSelectItems(dir_item, base::size(highlight), highlight,
|
||||
hr = SHOpenFolderAndSelectItems(dir_item, std::size(highlight), highlight,
|
||||
NULL);
|
||||
if (FAILED(hr)) {
|
||||
// On some systems, the above call mysteriously fails with "file not
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/gfx/image/image_skia_operations.h"
|
||||
#include "ui/gfx/image/image_skia_rep.h"
|
||||
#include "ui/gfx/image/image_util.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_COMMON_V8_VALUE_SERIALIZER_H_
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "ui/gfx/image/image_skia_rep.h"
|
||||
|
||||
namespace v8 {
|
||||
class Isolate;
|
||||
|
|
|
@ -79,17 +79,17 @@ struct Converter<blink::WebLocalFrame::ScriptExecutionType> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct Converter<blink::WebDocument::CSSOrigin> {
|
||||
struct Converter<blink::WebCssOrigin> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
blink::WebDocument::CSSOrigin* out) {
|
||||
blink::WebCssOrigin* out) {
|
||||
std::string css_origin;
|
||||
if (!ConvertFromV8(isolate, val, &css_origin))
|
||||
return false;
|
||||
if (css_origin == "user") {
|
||||
*out = blink::WebDocument::CSSOrigin::kUserOrigin;
|
||||
*out = blink::WebCssOrigin::kUser;
|
||||
} else if (css_origin == "author") {
|
||||
*out = blink::WebDocument::CSSOrigin::kAuthorOrigin;
|
||||
*out = blink::WebCssOrigin::kAuthor;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -613,8 +613,7 @@ class WebFrameRenderer : public gin::Wrappable<WebFrameRenderer>,
|
|||
std::u16string InsertCSS(v8::Isolate* isolate,
|
||||
const std::string& css,
|
||||
gin::Arguments* args) {
|
||||
blink::WebDocument::CSSOrigin css_origin =
|
||||
blink::WebDocument::CSSOrigin::kAuthorOrigin;
|
||||
blink::WebCssOrigin css_origin = blink::WebCssOrigin::kAuthor;
|
||||
|
||||
gin_helper::Dictionary options;
|
||||
if (args->GetNext(&options))
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include "base/command_line.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chrome/common/pdf_util.h"
|
||||
#include "components/network_hints/renderer/web_prescient_networking_impl.h"
|
||||
#include "components/pdf/renderer/pdf_internal_plugin_delegate.h"
|
||||
#include "content/common/buildflags.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
@ -37,7 +39,6 @@
|
|||
#include "shell/renderer/electron_autofill_agent.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
||||
#include "third_party/blink/public/platform/media/multi_buffer_data_source.h"
|
||||
#include "third_party/blink/public/web/blink.h"
|
||||
#include "third_party/blink/public/web/web_custom_element.h" // NOLINT(build/include_alpha)
|
||||
#include "third_party/blink/public/web/web_frame_widget.h"
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include "third_party/blink/public/web/web_script_source.h"
|
||||
#include "third_party/blink/public/web/web_security_policy.h"
|
||||
#include "third_party/blink/public/web/web_view.h"
|
||||
#include "third_party/blink/renderer/platform/media/multi_buffer_data_source.h" // nogncheck
|
||||
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" // nogncheck
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
|
@ -56,6 +58,10 @@
|
|||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
#include "chrome/renderer/media/chrome_key_systems.h" // nogncheck
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
#include "components/spellcheck/renderer/spellcheck.h"
|
||||
#include "components/spellcheck/renderer/spellcheck_provider.h"
|
||||
|
@ -186,12 +192,6 @@ void RendererClientBase::RenderThreadStarted() {
|
|||
thread->AddObserver(extensions_renderer_client_->GetDispatcher());
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
// Enables printing from Chrome PDF viewer.
|
||||
pdf_print_client_ = std::make_unique<ChromePDFPrintClient>();
|
||||
pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get());
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
spellcheck_ = std::make_unique<SpellCheck>(this);
|
||||
#endif
|
||||
|
@ -311,14 +311,38 @@ void RendererClientBase::DidClearWindowObject(
|
|||
render_frame->GetWebFrame()->ExecuteScript(blink::WebScriptSource("void 0"));
|
||||
}
|
||||
|
||||
class ChromePdfInternalPluginDelegate final
|
||||
: public pdf::PdfInternalPluginDelegate {
|
||||
public:
|
||||
ChromePdfInternalPluginDelegate() = default;
|
||||
ChromePdfInternalPluginDelegate(const ChromePdfInternalPluginDelegate&) =
|
||||
delete;
|
||||
ChromePdfInternalPluginDelegate& operator=(
|
||||
const ChromePdfInternalPluginDelegate&) = delete;
|
||||
~ChromePdfInternalPluginDelegate() override = default;
|
||||
|
||||
// `pdf::PdfInternalPluginDelegate`:
|
||||
bool IsAllowedOrigin(const url::Origin& origin) const override {
|
||||
return origin.scheme() == extensions::kExtensionScheme &&
|
||||
origin.host() == extension_misc::kPdfExtensionId;
|
||||
}
|
||||
};
|
||||
|
||||
bool RendererClientBase::OverrideCreatePlugin(
|
||||
content::RenderFrame* render_frame,
|
||||
const blink::WebPluginParams& params,
|
||||
blink::WebPlugin** plugin) {
|
||||
if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
params.mime_type.Utf8() == kPdfPluginMimeType ||
|
||||
if (params.mime_type.Utf8() == kPdfPluginMimeType) {
|
||||
*plugin = pdf::CreateInternalPlugin(
|
||||
std::move(params), render_frame,
|
||||
std::make_unique<ChromePdfInternalPluginDelegate>());
|
||||
return true;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
if (params.mime_type.Utf8() == content::kBrowserPluginMimeType ||
|
||||
params.mime_type.Utf8() == kPdfPluginMimeType ||
|
||||
render_frame->GetBlinkPreferences().enable_plugins)
|
||||
return false;
|
||||
|
||||
|
@ -329,15 +353,7 @@ bool RendererClientBase::OverrideCreatePlugin(
|
|||
void RendererClientBase::GetSupportedKeySystems(
|
||||
media::GetSupportedKeySystemsCB cb) {
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
key_systems_provider_.GetSupportedKeySystems(std::move(cb));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RendererClientBase::IsKeySystemsUpdateNeeded() {
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
return key_systems_provider_.IsKeySystemsUpdateNeeded();
|
||||
#else
|
||||
return false;
|
||||
GetChromeKeySystems(std::move(cb));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -355,6 +371,27 @@ bool RendererClientBase::IsPluginHandledExternally(
|
|||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
DCHECK(plugin_element.HasHTMLTagName("object") ||
|
||||
plugin_element.HasHTMLTagName("embed"));
|
||||
if (mime_type == "application/x-google-chrome-pdf") {
|
||||
if (IsPdfInternalPluginAllowedOrigin(
|
||||
render_frame->GetWebFrame()->GetSecurityOrigin())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
content::WebPluginInfo info;
|
||||
info.type = content::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS;
|
||||
const char16_t kPDFExtensionPluginName[] = u"Chromium PDF Viewer";
|
||||
info.name = kPDFExtensionPluginName;
|
||||
info.path = base::FilePath::FromUTF8Unsafe("internal-pdf-viewer");
|
||||
info.background_color = content::WebPluginInfo::kDefaultBackgroundColor;
|
||||
info.mime_types.emplace_back("application/x-google-chrome-pdf", "pdf",
|
||||
"Portable Document Format");
|
||||
return extensions::MimeHandlerViewContainerManager::Get(
|
||||
content::RenderFrame::FromWebFrame(
|
||||
plugin_element.GetDocument().GetFrame()),
|
||||
true /* create_if_does_not_exist */)
|
||||
->CreateFrameContainer(plugin_element, original_url, mime_type, info);
|
||||
}
|
||||
|
||||
// TODO(nornagon): this info should be shared with the data in
|
||||
// electron_content_client.cc / ComputeBuiltInPlugins.
|
||||
content::WebPluginInfo info;
|
||||
|
@ -375,10 +412,19 @@ bool RendererClientBase::IsPluginHandledExternally(
|
|||
#endif
|
||||
}
|
||||
|
||||
bool RendererClientBase::IsOriginIsolatedPepperPlugin(
|
||||
const base::FilePath& plugin_path) {
|
||||
// Isolate all Pepper plugins, including the PDF plugin.
|
||||
return true;
|
||||
v8::Local<v8::Object> RendererClientBase::GetScriptableObject(
|
||||
const blink::WebElement& plugin_element,
|
||||
v8::Isolate* isolate) {
|
||||
// If there is a MimeHandlerView that can provide the scriptable object then
|
||||
// MaybeCreateMimeHandlerView must have been called before and a container
|
||||
// manager should exist.
|
||||
auto* container_manager = extensions::MimeHandlerViewContainerManager::Get(
|
||||
content::RenderFrame::FromWebFrame(
|
||||
plugin_element.GetDocument().GetFrame()),
|
||||
false /* create_if_does_not_exist */);
|
||||
if (container_manager)
|
||||
return container_manager->GetScriptableObject(plugin_element, isolate);
|
||||
return v8::Local<v8::Object>();
|
||||
}
|
||||
|
||||
std::unique_ptr<blink::WebPrescientNetworking>
|
||||
|
|
|
@ -16,12 +16,8 @@
|
|||
// In SHARED_INTERMEDIATE_DIR.
|
||||
#include "widevine_cdm_version.h" // NOLINT(build/include_directory)
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
#include "chrome/renderer/media/chrome_key_systems_provider.h" // nogncheck
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h" // nogncheck
|
||||
#include "components/pdf/renderer/internal_plugin_renderer_helpers.h"
|
||||
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
|
||||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
|
@ -105,13 +101,14 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
const blink::WebPluginParams& params,
|
||||
blink::WebPlugin** plugin) override;
|
||||
void GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb) override;
|
||||
bool IsKeySystemsUpdateNeeded() override;
|
||||
void DidSetUserAgent(const std::string& user_agent) override;
|
||||
bool IsPluginHandledExternally(content::RenderFrame* render_frame,
|
||||
const blink::WebElement& plugin_element,
|
||||
const GURL& original_url,
|
||||
const std::string& mime_type) override;
|
||||
bool IsOriginIsolatedPepperPlugin(const base::FilePath& plugin_path) override;
|
||||
v8::Local<v8::Object> GetScriptableObject(
|
||||
const blink::WebElement& plugin_element,
|
||||
v8::Isolate* isolate) override;
|
||||
|
||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
|
||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
||||
|
@ -152,9 +149,6 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
std::unique_ptr<ElectronExtensionsRendererClient> extensions_renderer_client_;
|
||||
#endif
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
ChromeKeySystemsProvider key_systems_provider_;
|
||||
#endif
|
||||
std::string renderer_client_id_;
|
||||
// An increasing ID used for identifying an V8 context in this process.
|
||||
int64_t next_context_id_ = 0;
|
||||
|
@ -162,9 +156,6 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
||||
std::unique_ptr<SpellCheck> spellcheck_;
|
||||
#endif
|
||||
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
||||
std::unique_ptr<ChromePDFPrintClient> pdf_print_client_;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue