Update to Chromium version 101.0.4951.0 (#982481)

Known issues:
- chrome: Some ceftests are failing due to bfcache same-site enabled by default
  (see issue #3301)
This commit is contained in:
Marshall Greenblatt
2022-03-25 21:12:30 -04:00
parent 77466e7b6d
commit b524edc209
100 changed files with 591 additions and 671 deletions

View File

@@ -690,7 +690,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
}
const std::string& process_type =
@@ -709,7 +709,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
network::switches::kUnsafelyTreatInsecureOriginAsSecure,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
if (extensions::ExtensionsEnabled()) {
content::RenderProcessHost* process =
@@ -738,7 +738,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLang,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
}
// Necessary to populate DIR_USER_DATA in sub-processes.
@@ -764,7 +764,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLogFile,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
}
if (crash_reporting::Enabled()) {
@@ -1324,10 +1324,10 @@ AlloyContentBrowserClient::GetNetworkContextsParentDirectory() {
bool AlloyContentBrowserClient::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,
@@ -1342,6 +1342,8 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
@@ -1420,7 +1422,7 @@ AlloyContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
}
std::string AlloyContentBrowserClient::GetProduct() {
return embedder_support::GetProduct();
return GetChromeProduct();
}
std::string AlloyContentBrowserClient::GetChromeProduct() {
@@ -1461,8 +1463,7 @@ AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context);
for (const auto& pair : map)
mime_types.insert(pair.first);
if (pdf::IsInternalPluginExternallyHandled())
mime_types.insert(pdf::kInternalPluginMimeType);
mime_types.insert(pdf::kInternalPluginMimeType);
return mime_types;
}
@@ -1503,8 +1504,7 @@ bool AlloyContentBrowserClient::IsFindInPageDisabledForOrigin(
const url::Origin& origin) {
// 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);
}
CefRefPtr<CefRequestContextImpl> AlloyContentBrowserClient::request_context()

View File

@@ -195,10 +195,10 @@ class AlloyContentBrowserClient : 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,
@@ -210,6 +210,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,

View File

@@ -53,8 +53,10 @@ class MessagePumpExternal : public base::MessagePumpForUI {
void ScheduleWork() override { handler_->OnScheduleMessagePumpWork(0); }
void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time) override {
const base::TimeDelta& delta = delayed_work_time - base::TimeTicks::Now();
void ScheduleDelayedWork(
const Delegate::NextWorkInfo& next_work_info) override {
const base::TimeDelta& delta =
next_work_info.delayed_run_time - next_work_info.recent_now;
handler_->OnScheduleMessagePumpWork(delta.InMilliseconds());
}

View File

@@ -48,6 +48,8 @@ void HandleExternalProtocolHelper(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
@@ -61,11 +63,8 @@ void HandleExternalProtocolHelper(
// Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol(
resource_request.url, web_contents_getter,
content::ChildProcessHost::kInvalidUniqueID, frame_tree_node_id,
navigation_data,
resource_request.resource_type ==
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
resource_request.url, web_contents_getter, frame_tree_node_id,
navigation_data, is_primary_main_frame, is_in_fenced_frame_tree,
sandbox_flags,
static_cast<ui::PageTransition>(resource_request.transition_type),
resource_request.has_user_gesture, initiating_origin, initiator_rfh,
@@ -114,7 +113,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
}
const std::string& process_type =
@@ -126,7 +125,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
switches::kUncaughtExceptionStackSize,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
std::size(kSwitchNames));
}
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
@@ -248,10 +247,10 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
bool ChromeContentBrowserClientCef::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,
@@ -269,15 +268,18 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
// HandleExternalProtocolHelper. Forward to the chrome layer for default
// handling.
return ChromeContentBrowserClient::HandleExternalProtocol(
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
is_main_frame, sandbox_flags, page_transition, has_user_gesture,
initiating_origin, initiator_document, nullptr);
url, web_contents_getter, frame_tree_node_id, navigation_data,
is_primary_main_frame, is_in_fenced_frame_tree, sandbox_flags,
page_transition, has_user_gesture, initiating_origin, initiator_document,
nullptr);
}
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
const absl::optional<url::Origin>& initiating_origin,
@@ -295,8 +297,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
web_contents_getter, frame_tree_node_id, resource_request,
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, frame_tree_node_id,
navigation_data, sandbox_flags, resource_request,
initiating_origin,
navigation_data, is_primary_main_frame,
is_in_fenced_frame_tree, sandbox_flags,
resource_request, initiating_origin,
std::move(weak_initiator_document)));
net_service::ProxyURLLoaderFactory::CreateProxy(

View File

@@ -63,10 +63,10 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
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,
@@ -78,6 +78,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
const absl::optional<url::Origin>& initiating_origin,

View File

@@ -159,7 +159,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
absl::nullopt /*download_schedule*/,
base::FilePath(), absl::nullopt /*download_schedule*/,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
}
}
@@ -178,7 +178,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::MixedContentStatus::UNKNOWN,
path, absl::nullopt /*download_schedule*/,
path, base::FilePath(),
absl::nullopt /*download_schedule*/,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
}
@@ -366,7 +367,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::MixedContentStatus::UNKNOWN,
item->GetForcedFilePath(), absl::nullopt /*download_schedule*/,
item->GetForcedFilePath(), base::FilePath(),
absl::nullopt /*download_schedule*/,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}

View File

@@ -65,8 +65,7 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
void CefExtensionsAPIClient::AddAdditionalValueStoreCaches(
content::BrowserContext* context,
const scoped_refptr<value_store::ValueStoreFactory>& factory,
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
observers,
SettingsChangedCallback observer,
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
// Add support for chrome.storage.sync.
// Because we don't support syncing with Google, we follow the behavior of

View File

@@ -34,8 +34,7 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
void AddAdditionalValueStoreCaches(
content::BrowserContext* context,
const scoped_refptr<value_store::ValueStoreFactory>& factory,
const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>&
observers,
SettingsChangedCallback observer,
std::map<settings_namespace::Namespace, ValueStoreCache*>* caches)
override;

View File

@@ -9,8 +9,10 @@
#include "skia/ext/skia_utils_base.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image_png_rep.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
namespace {

View File

@@ -37,7 +37,7 @@ std::u16string GetDescriptionFromMimeType(const std::string& mime_type) {
{"video", IDS_VIDEO_FILES},
};
for (size_t i = 0; i < base::size(kWildCardMimeTypes); ++i) {
for (size_t i = 0; i < std::size(kWildCardMimeTypes); ++i) {
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*")
return l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id);
}

View File

@@ -167,7 +167,7 @@ std::wstring GetDescriptionFromMimeType(const std::string& mime_type) {
{"video", IDS_VIDEO_FILES},
};
for (size_t i = 0; i < base::size(kWildCardMimeTypes); ++i) {
for (size_t i = 0; i < std::size(kWildCardMimeTypes); ++i) {
if (mime_type == std::string(kWildCardMimeTypes[i].mime_type) + "/*") {
return base::UTF16ToWide(
l10n_util::GetStringUTF16(kWildCardMimeTypes[i].string_id));
@@ -259,7 +259,7 @@ bool RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
} else {
// The value is a file name and possibly a directory.
base::wcslcpy(filename, params.default_file_name.value().c_str(),
base::size(filename));
std::size(filename));
directory = params.default_file_name.DirName().value();
}
}
@@ -480,7 +480,7 @@ bool RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
} else {
// The value is a file name and possibly a directory.
base::wcslcpy(filename, params.default_file_name.value().c_str(),
base::size(filename));
std::size(filename));
directory = params.default_file_name.DirName().value();
}
}

View File

@@ -11,7 +11,6 @@
#include "libcef/common/request_impl.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/page_navigator.h"
@@ -20,29 +19,32 @@ namespace throttle {
namespace {
// TODO(cef): We can't currently trust NavigationParams::is_main_frame() because
// it's always set to true in
// InterceptNavigationThrottle::CheckIfShouldIgnoreNavigation. Remove the
// |is_main_frame| argument once this problem is fixed.
bool NavigationOnUIThread(
bool is_main_frame,
bool is_pdf,
const content::GlobalRenderFrameHostId& global_id,
const content::GlobalRenderFrameHostId& parent_global_id,
content::WebContents* source,
const navigation_interception::NavigationParams& params) {
bool NavigationOnUIThread(content::NavigationHandle* navigation_handle) {
CEF_REQUIRE_UIT();
content::OpenURLParams open_params(
params.url(), params.referrer(), WindowOpenDisposition::CURRENT_TAB,
params.transition_type(), params.is_renderer_initiated());
open_params.user_gesture = params.has_user_gesture();
open_params.initiator_origin = params.initiator_origin();
open_params.is_pdf = is_pdf;
const bool is_main_frame = navigation_handle->IsInMainFrame();
const auto global_id = frame_util::GetGlobalId(navigation_handle);
// Identify the RenderFrameHost that originated the navigation.
const auto parent_global_id =
!is_main_frame ? navigation_handle->GetParentFrame()->GetGlobalId()
: frame_util::InvalidGlobalId();
const content::Referrer referrer(navigation_handle->GetReferrer().url,
navigation_handle->GetReferrer().policy);
content::OpenURLParams open_params(navigation_handle->GetURL(), referrer,
WindowOpenDisposition::CURRENT_TAB,
navigation_handle->GetPageTransition(),
navigation_handle->IsRendererInitiated());
open_params.user_gesture = navigation_handle->HasUserGesture();
open_params.initiator_origin = navigation_handle->GetInitiatorOrigin();
open_params.is_pdf = navigation_handle->IsPdf();
CefRefPtr<CefBrowserHostBase> browser;
if (!CefBrowserInfoManager::GetInstance()->MaybeAllowNavigation(
source->GetMainFrame(), open_params, browser)) {
navigation_handle->GetWebContents()->GetMainFrame(), open_params,
browser)) {
// Cancel the navigation.
return true;
}
@@ -65,16 +67,17 @@ bool NavigationOnUIThread(
}
CefRefPtr<CefRequestImpl> request = new CefRequestImpl();
request->Set(params, is_main_frame);
request->Set(navigation_handle);
request->SetReadOnly(true);
// Initiating a new navigation in OnBeforeBrowse will delete the
// InterceptNavigationThrottle that currently owns this callback,
// resulting in a crash. Use the lock to prevent that.
auto navigation_lock = browser->browser_info()->CreateNavigationLock();
ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.has_user_gesture(),
params.is_redirect());
ignore_navigation =
handler->OnBeforeBrowse(browser.get(), frame, request.get(),
navigation_handle->HasUserGesture(),
navigation_handle->WasServerRedirect());
}
}
}
@@ -88,22 +91,11 @@ void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
NavigationThrottleList& throttles) {
CEF_REQUIRE_UIT();
const bool is_main_frame = navigation_handle->IsInMainFrame();
const bool is_pdf = navigation_handle->IsPdf();
const auto global_id = frame_util::GetGlobalId(navigation_handle);
// Identify the RenderFrameHost that originated the navigation.
const auto parent_global_id =
!is_main_frame ? navigation_handle->GetParentFrame()->GetGlobalId()
: frame_util::InvalidGlobalId();
// Must use SynchronyMode::kSync to ensure that OnBeforeBrowse is always
// called before OnBeforeResourceLoad.
std::unique_ptr<content::NavigationThrottle> throttle =
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
navigation_handle,
base::BindRepeating(&NavigationOnUIThread, is_main_frame, is_pdf,
global_id, parent_global_id),
navigation_handle, base::BindRepeating(&NavigationOnUIThread),
navigation_interception::SynchronyMode::kSync);
throttles.push_back(std::move(throttle));
}

View File

@@ -1209,7 +1209,7 @@ InterceptedRequestHandler::OnFilterResponseBody(
ProxyURLLoaderFactory::ProxyURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
std::unique_ptr<InterceptedRequestHandler> request_handler)
@@ -1218,8 +1218,8 @@ ProxyURLLoaderFactory::ProxyURLLoaderFactory(
DCHECK(request_handler_);
// Actual creation of the factory.
if (target_factory_info) {
target_factory_.Bind(std::move(target_factory_info));
if (target_factory_remote) {
target_factory_.Bind(std::move(target_factory_remote));
target_factory_.set_disconnect_handler(base::BindOnce(
&ProxyURLLoaderFactory::OnTargetFactoryError, base::Unretained(this)));
}
@@ -1238,14 +1238,14 @@ ProxyURLLoaderFactory::~ProxyURLLoaderFactory() {
// static
void ProxyURLLoaderFactory::CreateOnIOThread(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
content::ResourceContext* resource_context,
std::unique_ptr<InterceptedRequestHandler> request_handler) {
CEF_REQUIRE_IOT();
auto proxy = new ProxyURLLoaderFactory(
std::move(factory_receiver), std::move(target_factory_info),
std::move(factory_receiver), std::move(target_factory),
std::move(header_client_receiver), std::move(request_handler));
ResourceContextData::AddProxy(proxy, resource_context);
}
@@ -1269,8 +1269,8 @@ void ProxyURLLoaderFactory::CreateProxy(
DCHECK(request_handler);
auto proxied_receiver = std::move(*factory_receiver);
network::mojom::URLLoaderFactoryPtrInfo target_factory_info;
*factory_receiver = mojo::MakeRequest(&target_factory_info);
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote;
*factory_receiver = target_factory_remote.InitWithNewPipeAndPassReceiver();
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver;
@@ -1285,7 +1285,7 @@ void ProxyURLLoaderFactory::CreateProxy(
CEF_IOT,
base::BindOnce(
&ProxyURLLoaderFactory::CreateOnIOThread, std::move(proxied_receiver),
std::move(target_factory_info), std::move(header_client_receiver),
std::move(target_factory_remote), std::move(header_client_receiver),
base::Unretained(resource_context), std::move(request_handler)));
}
@@ -1305,7 +1305,8 @@ void ProxyURLLoaderFactory::CreateProxy(
}
auto proxy = new ProxyURLLoaderFactory(
std::move(loader_receiver), nullptr,
std::move(loader_receiver),
mojo::PendingRemote<network::mojom::URLLoaderFactory>(),
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>(),
std::move(request_handler));
CEF_POST_TASK(CEF_UIT,

View File

@@ -185,14 +185,16 @@ class ProxyURLLoaderFactory
ProxyURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
mojo::PendingRemote<network::mojom::URLLoaderFactory>
target_factory_remote,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
std::unique_ptr<InterceptedRequestHandler> request_handler);
static void CreateOnIOThread(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver,
network::mojom::URLLoaderFactoryPtrInfo target_factory_info,
mojo::PendingRemote<network::mojom::URLLoaderFactory>
target_factory_remote,
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
header_client_receiver,
content::ResourceContext* resource_context,

View File

@@ -19,7 +19,7 @@
namespace net_service {
// Based on CreateDownloadURLLoaderFactoryGetter from
// Based on CreatePendingSharedURLLoaderFactory from
// content/browser/download/download_manager_impl.cc.
// static
scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
@@ -35,14 +35,17 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
auto loader_factory = browser_context->GetDefaultStoragePartition()
->GetURLLoaderFactoryForBrowserProcess();
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info;
network::mojom::URLLoaderFactoryRequest proxy_factory_request;
mojo::PendingRemote<network::mojom::URLLoaderFactory> proxy_factory_remote;
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
proxy_factory_receiver;
// Create an intermediate pipe that can be used to proxy the request's
// URLLoaderFactory.
network::mojom::URLLoaderFactoryPtrInfo maybe_proxy_factory_ptr_info;
mojo::PendingRemote<network::mojom::URLLoaderFactory>
maybe_proxy_factory_remote;
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
maybe_proxy_factory_request = MakeRequest(&maybe_proxy_factory_ptr_info);
maybe_proxy_factory_receiver =
maybe_proxy_factory_remote.InitWithNewPipeAndPassReceiver();
bool should_proxy = false;
int render_process_id = -1;
@@ -55,7 +58,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
content::devtools_instrumentation::WillCreateURLLoaderFactory(
static_cast<content::RenderFrameHostImpl*>(render_frame_host),
false /* is_navigation */, false /* is_download */,
&maybe_proxy_factory_request, nullptr /* factory_override */);
&maybe_proxy_factory_receiver, nullptr /* factory_override */);
}
auto browser_client = CefAppManager::Get()->GetContentClient()->browser();
@@ -65,24 +68,24 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
browser_context, render_frame_host, render_process_id,
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
url::Origin(), absl::nullopt /* navigation_id */, ukm::SourceIdObj(),
&maybe_proxy_factory_request, nullptr /* header_client */,
&maybe_proxy_factory_receiver, nullptr /* header_client */,
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
nullptr /* factory_override */);
// If anyone above indicated that they care about proxying, pass the
// intermediate pipe along to the URLLoaderFactoryGetter.
if (should_proxy) {
proxy_factory_ptr_info = std::move(maybe_proxy_factory_ptr_info);
proxy_factory_request = std::move(maybe_proxy_factory_request);
proxy_factory_remote = std::move(maybe_proxy_factory_remote);
proxy_factory_receiver = std::move(maybe_proxy_factory_receiver);
}
return base::WrapRefCounted(new URLLoaderFactoryGetter(
loader_factory->Clone(), std::move(proxy_factory_ptr_info),
std::move(proxy_factory_request)));
loader_factory->Clone(), std::move(proxy_factory_remote),
std::move(proxy_factory_receiver)));
}
// Based on NetworkDownloadURLLoaderFactoryGetter from
// content/browser/download/network_download_url_loader_factory_getter.cc.
// Based on CreateFactory from
// content/browser/download/network_download_pending_url_loader_factory.cc.
scoped_refptr<network::SharedURLLoaderFactory>
URLLoaderFactoryGetter::GetURLLoaderFactory() {
// On first call we associate with the current thread.
@@ -99,11 +102,11 @@ URLLoaderFactoryGetter::GetURLLoaderFactory() {
auto loader_factory =
network::SharedURLLoaderFactory::Create(std::move(loader_factory_info_));
if (proxy_factory_request_.is_pending()) {
loader_factory->Clone(std::move(proxy_factory_request_));
if (proxy_factory_receiver_.is_valid()) {
loader_factory->Clone(std::move(proxy_factory_receiver_));
lazy_factory_ =
base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
std::move(proxy_factory_ptr_info_));
std::move(proxy_factory_remote_));
} else {
lazy_factory_ = loader_factory;
}
@@ -112,11 +115,12 @@ URLLoaderFactoryGetter::GetURLLoaderFactory() {
URLLoaderFactoryGetter::URLLoaderFactoryGetter(
std::unique_ptr<network::PendingSharedURLLoaderFactory> loader_factory_info,
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info,
network::mojom::URLLoaderFactoryRequest proxy_factory_request)
mojo::PendingRemote<network::mojom::URLLoaderFactory> proxy_factory_remote,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
proxy_factory_receiver)
: loader_factory_info_(std::move(loader_factory_info)),
proxy_factory_ptr_info_(std::move(proxy_factory_ptr_info)),
proxy_factory_request_(std::move(proxy_factory_request)) {}
proxy_factory_remote_(std::move(proxy_factory_remote)),
proxy_factory_receiver_(std::move(proxy_factory_receiver)) {}
URLLoaderFactoryGetter::~URLLoaderFactoryGetter() = default;

View File

@@ -50,19 +50,21 @@ class URLLoaderFactoryGetter
URLLoaderFactoryGetterDeleter>;
friend struct URLLoaderFactoryGetterDeleter;
URLLoaderFactoryGetter(
std::unique_ptr<network::PendingSharedURLLoaderFactory>
loader_factory_info,
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info,
network::mojom::URLLoaderFactoryRequest proxy_factory_request);
URLLoaderFactoryGetter(std::unique_ptr<network::PendingSharedURLLoaderFactory>
loader_factory_info,
mojo::PendingRemote<network::mojom::URLLoaderFactory>
proxy_factory_remote,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
proxy_factory_receiver);
~URLLoaderFactoryGetter();
void DeleteOnCorrectThread() const;
std::unique_ptr<network::PendingSharedURLLoaderFactory> loader_factory_info_;
scoped_refptr<network::SharedURLLoaderFactory> lazy_factory_;
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info_;
network::mojom::URLLoaderFactoryRequest proxy_factory_request_;
mojo::PendingRemote<network::mojom::URLLoaderFactory> proxy_factory_remote_;
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
proxy_factory_receiver_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
};

View File

@@ -200,7 +200,7 @@ struct PopulateAxNodeAttributes {
CefRefPtr<CefListValue> list = CefListValue::Create();
int index = 0;
// Iterate and find which states are set.
for (unsigned i = 0; i < base::size(textStyleArr); i++) {
for (unsigned i = 0; i < std::size(textStyleArr); i++) {
if (attr.second & static_cast<int>(textStyleArr[i]))
list->SetString(index++, ToString(textStyleArr[i]));
}
@@ -260,7 +260,7 @@ struct PopulateAxNodeAttributes {
ax::mojom::MarkerType::kTextMatch};
// Iterate and find which markers are set.
for (unsigned j = 0; j < base::size(marktypeArr); j++) {
for (unsigned j = 0; j < std::size(marktypeArr); j++) {
if (attr.second[i] & static_cast<int>(marktypeArr[j]))
list->SetString(index++, ToString(marktypeArr[j]));
}

View File

@@ -7,6 +7,7 @@
#include "base/memory/shared_memory_mapping.h"
#include "base/trace_event/trace_event.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -24,7 +25,7 @@ namespace viz {
SoftwareOutputDeviceProxy::~SoftwareOutputDeviceProxy() = default;
SoftwareOutputDeviceProxy::SoftwareOutputDeviceProxy(
mojom::LayeredWindowUpdaterPtr layered_window_updater)
mojo::PendingRemote<mojom::LayeredWindowUpdater> layered_window_updater)
: layered_window_updater_(std::move(layered_window_updater)) {
DCHECK(layered_window_updater_.is_bound());
}

View File

@@ -5,7 +5,7 @@
#include "base/threading/thread_checker.h"
#include "components/viz/service/display/software_output_device.h"
#include "components/viz/service/viz_service_export.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
namespace viz {
@@ -18,7 +18,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputDeviceProxy
: public SoftwareOutputDevice {
public:
explicit SoftwareOutputDeviceProxy(
mojom::LayeredWindowUpdaterPtr layered_window_updater);
mojo::PendingRemote<mojom::LayeredWindowUpdater> layered_window_updater);
SoftwareOutputDeviceProxy(const SoftwareOutputDeviceProxy&) = delete;
SoftwareOutputDeviceProxy& operator=(const SoftwareOutputDeviceProxy&) =
@@ -39,7 +39,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputDeviceProxy
// Runs |swap_ack_callback_| after draw has happened.
void DrawAck();
mojom::LayeredWindowUpdaterPtr layered_window_updater_;
mojo::Remote<mojom::LayeredWindowUpdater> layered_window_updater_;
std::unique_ptr<SkCanvas> canvas_;
bool waiting_on_draw_ack_ = false;

View File

@@ -12,6 +12,7 @@
#include "include/cef_menu_model.h"
#include "base/threading/platform_thread.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/models/simple_menu_model.h"
// Implementation of CefMenuModel that wraps an existing ui::SimpleMenuModel.

View File

@@ -41,7 +41,6 @@
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "net/base/features.h"
#include "pdf/pdf_ppapi.h"
#include "sandbox/policy/switches.h"
#include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/switches.h"
@@ -66,7 +65,7 @@ const char* const kNonWildcardDomainNonPortSchemes[] = {
extensions::kExtensionScheme, content::kChromeDevToolsScheme,
content::kChromeUIScheme, content::kChromeUIUntrustedScheme};
const size_t kNonWildcardDomainNonPortSchemesSize =
base::size(kNonWildcardDomainNonPortSchemes);
std::size(kNonWildcardDomainNonPortSchemes);
} // namespace
@@ -381,12 +380,6 @@ void AlloyMainDelegate::PreSandboxStartup() {
MaybePatchGdiGetFontData();
}
void AlloyMainDelegate::SandboxInitialized(const std::string& process_type) {
AlloyContentClient::SetPDFEntryFunctions(chrome_pdf::PPP_GetInterface,
chrome_pdf::PPP_InitializeModule,
chrome_pdf::PPP_ShutdownModule);
}
absl::variant<int, content::MainFunctionParams> AlloyMainDelegate::RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) {

View File

@@ -45,7 +45,6 @@ class AlloyMainDelegate : public content::ContentMainDelegate,
void PreBrowserMain() override;
bool BasicStartupComplete(int* exit_code) override;
void PreSandboxStartup() override;
void SandboxInitialized(const std::string& process_type) override;
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;

View File

@@ -495,14 +495,14 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
};
// Make sure we can fit all possible name/value pairs.
static_assert(base::size(ids) * crashpad::Annotation::kValueMaxSize >=
static_assert(std::size(ids) * crashpad::Annotation::kValueMaxSize >=
3 * 26 /* sizes (small, medium, large) * slots (A to Z) */
* (3 + 2 /* key size ("S-A") + delim size ("=,") */
+ crashpad::Annotation::kNameMaxLength),
"Not enough storage for key map");
size_t offset = 0;
for (size_t i = 0; i < base::size(ids); ++i) {
for (size_t i = 0; i < std::size(ids); ++i) {
size_t length = std::min(map_keys.size() - offset,
crashpad::Annotation::kValueMaxSize);
ids[i].Set(base::StringPiece(map_keys.data() + offset, length));
@@ -718,7 +718,7 @@ bool CefCrashReporterClient::EnableBrowserCrashForwarding() {
bool Set##name##Annotation(size_t index, const base::StringPiece& value) { \
using IDKey = crash_reporter::CrashKeyString<size_>; \
static IDKey ids[] = {IDKEY_ENTRIES(#name)}; \
if (index < base::size(ids)) { \
if (index < std::size(ids)) { \
if (value.empty()) { \
ids[index].Clear(); \
} else { \

View File

@@ -159,7 +159,7 @@ bool IsBoringCEFSwitch(const std::string& flag) {
size_t end = flag.find("=");
size_t len = (end == std::string::npos) ? flag.length() - 2 : end - 2;
for (size_t i = 0; i < base::size(kIgnoreSwitches); ++i) {
for (size_t i = 0; i < std::size(kIgnoreSwitches); ++i) {
if (flag.compare(2, len, kIgnoreSwitches[i]) == 0)
return true;
}

View File

@@ -53,7 +53,7 @@ interface RenderFrame {
FrameAttachedAck();
// Send a message to the render process.
SendMessage(string name, mojo_base.mojom.ListValue arguments);
SendMessage(string name, mojo_base.mojom.Value arguments);
// Send a command.
SendCommand(string command);
@@ -82,7 +82,7 @@ interface RenderFrame {
// Interface for communicating with a frame in the browser process.
interface BrowserFrame {
// Send a message to the browser process.
SendMessage(string name, mojo_base.mojom.ListValue arguments);
SendMessage(string name, mojo_base.mojom.Value arguments);
// The render frame is ready to begin handling actions.
FrameAttached(pending_remote<RenderFrame> render_frame,
@@ -111,7 +111,7 @@ struct NewBrowserInfo {
bool is_popup;
bool is_windowless;
bool is_guest_view;
mojo_base.mojom.DictionaryValue? extra_info;
mojo_base.mojom.Value? extra_info;
};
// Interface for communicating with browser management in the browser process.

View File

@@ -17,8 +17,8 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/common/content_switches.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/load_flags.h"
@@ -518,26 +518,25 @@ void CefRequestImpl::Set(const net::HttpRequestHeaders& headers) {
::GetHeaderMap(headers, headermap_);
}
void CefRequestImpl::Set(
const navigation_interception::NavigationParams& params,
bool is_main_frame) {
void CefRequestImpl::Set(content::NavigationHandle* navigation_handle) {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
Reset();
url_ = params.url();
method_ = params.is_post() ? "POST" : "GET";
url_ = navigation_handle->GetURL();
method_ = navigation_handle->IsPost() ? "POST" : "GET";
const auto& sanitized_referrer =
content::Referrer::SanitizeForRequest(params.url(), params.referrer());
referrer_url_ = sanitized_referrer.url;
const auto& sanitized_referrer = content::Referrer::SanitizeForRequest(
navigation_handle->GetURL(), navigation_handle->GetReferrer());
referrer_url_ = sanitized_referrer->url;
referrer_policy_ =
BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer.policy);
BlinkReferrerPolicyToNetReferrerPolicy(sanitized_referrer->policy);
resource_type_ = is_main_frame ? RT_MAIN_FRAME : RT_SUB_FRAME;
transition_type_ =
static_cast<cef_transition_type_t>(params.transition_type());
resource_type_ =
navigation_handle->IsInMainFrame() ? RT_MAIN_FRAME : RT_SUB_FRAME;
transition_type_ = static_cast<cef_transition_type_t>(
navigation_handle->GetPageTransition());
}
// static

View File

@@ -22,9 +22,9 @@ namespace blink {
class WebURLRequest;
} // namespace blink
namespace navigation_interception {
class NavigationParams;
}
namespace content {
class NavigationHandle;
} // namespace content
namespace net {
class HttpRequestHeaders;
@@ -96,11 +96,8 @@ class CefRequestImpl : public CefRequest {
void Set(const net::HttpRequestHeaders& headers);
// Populate this object from the NavigationParams object.
// TODO(cef): Remove the |is_main_frame| argument once NavigationParams is
// reliable in reporting that value.
// Called from content_browser_client.cc NavigationOnUIThread().
void Set(const navigation_interception::NavigationParams& params,
bool is_main_frame);
// Called from throttle_handler.cc NavigationOnUIThread().
void Set(content::NavigationHandle* navigation_handle);
// Populate the WebURLRequest object based on the contents of |params|.
// Called from CefBrowserImpl::LoadRequest().

View File

@@ -28,7 +28,7 @@ gfx::Image CefResourceBundleDelegate::GetNativeImageNamed(int resource_id) {
return gfx::Image();
}
base::RefCountedStaticMemory* CefResourceBundleDelegate::LoadDataResourceBytes(
base::RefCountedMemory* CefResourceBundleDelegate::LoadDataResourceBytes(
int resource_id,
ui::ResourceScaleFactor scale_factor) {
return nullptr;

View File

@@ -29,7 +29,7 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
const std::string& locale) override;
gfx::Image GetImageNamed(int resource_id) override;
gfx::Image GetNativeImageNamed(int resource_id) override;
base::RefCountedStaticMemory* LoadDataResourceBytes(
base::RefCountedMemory* LoadDataResourceBytes(
int resource_id,
ui::ResourceScaleFactor scale_factor) override;
absl::optional<std::string> LoadDataResourceString(int resource_id) override;

View File

@@ -53,8 +53,7 @@
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
#include "chrome/renderer/loadtimes_extension_bindings.h"
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
#include "chrome/renderer/pepper/pepper_helper.h"
#include "chrome/renderer/media/chrome_key_systems.h"
#include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/nacl/common/nacl_constants.h"
@@ -231,11 +230,6 @@ void AlloyContentRendererClient::RenderThreadStarted() {
}
#endif // BUILDFLAG(IS_MAC)
if (extensions::PdfExtensionEnabled()) {
pdf_print_client_.reset(new ChromePDFPrintClient());
pdf::PepperPDFHost::SetPrintClient(pdf_print_client_.get());
}
if (extensions::ExtensionsEnabled())
extensions_renderer_client_->RenderThreadStarted();
}
@@ -275,8 +269,6 @@ void AlloyContentRendererClient::RenderFrameCreated(
content::RenderFrame* render_frame) {
auto render_frame_observer = new CefRenderFrameObserver(render_frame);
new PepperHelper(render_frame);
if (extensions::ExtensionsEnabled()) {
extensions_renderer_client_->RenderFrameCreated(
render_frame, render_frame_observer->registry());
@@ -352,8 +344,7 @@ bool AlloyContentRendererClient::IsPluginHandledExternally(
plugin_element);
return false;
}
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.
@@ -421,11 +412,7 @@ bool AlloyContentRendererClient::IsOriginIsolatedPepperPlugin(
void AlloyContentRendererClient::GetSupportedKeySystems(
media::GetSupportedKeySystemsCB cb) {
key_systems_provider_.GetSupportedKeySystems(std::move(cb));
}
bool AlloyContentRendererClient::IsKeySystemsUpdateNeeded() {
return key_systems_provider_.IsKeySystemsUpdateNeeded();
GetChromeKeySystems(std::move(cb));
}
void AlloyContentRendererClient::RunScriptsAtDocumentStart(

View File

@@ -18,7 +18,6 @@
#include "base/task/current_thread.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/common/plugin.mojom.h"
#include "chrome/renderer/media/chrome_key_systems_provider.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/render_thread.h"
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
@@ -43,7 +42,6 @@ class WebCacheImpl;
class AlloyRenderThreadObserver;
class CefRenderManager;
class ChromePDFPrintClient;
class SpellCheck;
class AlloyContentRendererClient
@@ -101,7 +99,6 @@ class AlloyContentRendererClient
bool IsLinkVisited(uint64_t link_hash) override;
bool IsOriginIsolatedPepperPlugin(const base::FilePath& plugin_path) override;
void GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb) override;
bool IsKeySystemsUpdateNeeded() override;
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
@@ -140,16 +137,10 @@ class AlloyContentRendererClient
std::unique_ptr<SpellCheck> spellcheck_;
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_slave_;
std::unique_ptr<ChromePDFPrintClient> pdf_print_client_;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::CefExtensionsRendererClient>
extensions_renderer_client_;
// Used to refresh the list of supported key systems after Widevine is
// installed as a component update.
ChromeKeySystemsProvider key_systems_provider_;
// Used in single-process mode to test when cleanup is complete.
// Access must be protected by |single_process_cleanup_lock_|.
bool single_process_cleanup_complete_ = false;

View File

@@ -16,9 +16,9 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "content/renderer/document_state.h"
#include "content/renderer/navigation_state.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url_error.h"

View File

@@ -17,7 +17,6 @@
#include "content/public/renderer/render_frame.h"
#include "extensions/common/constants.h"
#include "extensions/renderer/guest_view/mime_handler_view/post_message_support.h"
#include "pdf/pdf_features.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
@@ -35,25 +34,8 @@ CefPrintRenderFrameHelperDelegate::~CefPrintRenderFrameHelperDelegate() =
// Return the PDF object element if |frame| is the out of process PDF extension.
blink::WebElement CefPrintRenderFrameHelperDelegate::GetPdfElement(
blink::WebLocalFrame* frame) {
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;

View File

@@ -41,6 +41,7 @@
#include "services/network/public/mojom/cors_origin_pattern.mojom.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/web/web_frame.h"
#include "third_party/blink/public/web/web_security_policy.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_view_observer.h"

View File

@@ -12,6 +12,7 @@ need to be translated for each locale.-->
<emit emit_type='prepend'></emit>
</output>
<output filename="cef_strings_af.pak" type="data_package" lang="af" />
<output filename="cef_strings_am.pak" type="data_package" lang="am" />
<output filename="cef_strings_ar.pak" type="data_package" lang="ar" />
<if expr="pp_ifdef('use_third_party_translations')">
@@ -100,6 +101,7 @@ need to be translated for each locale.-->
<output filename="cef_strings_ug.pak" type="data_package" lang="ug" />
</if>
<output filename="cef_strings_uk.pak" type="data_package" lang="uk" />
<output filename="cef_strings_ur.pak" type="data_package" lang="ur" />
<output filename="cef_strings_vi.pak" type="data_package" lang="vi" />
<output filename="cef_strings_zh-CN.pak" type="data_package" lang="zh-CN" />
<output filename="cef_strings_zh-TW.pak" type="data_package" lang="zh-TW" />