Update to Chromium version 93.0.4577.0 (#902210)

This commit is contained in:
Marshall Greenblatt
2021-07-23 12:40:13 -04:00
parent 1ffa5528b3
commit b4ea0496e7
141 changed files with 1188 additions and 1061 deletions

View File

@@ -1114,9 +1114,10 @@ content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(
return nullptr;
}
bool AlloyBrowserHostImpl::ShouldTransferNavigation(
bool AlloyBrowserHostImpl::ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
return platform_delegate_->ShouldTransferNavigation(is_main_frame_navigation);
return platform_delegate_->ShouldAllowRendererInitiatedCrossProcessNavigation(
is_main_frame_navigation);
}
void AlloyBrowserHostImpl::AddNewContents(

View File

@@ -207,7 +207,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
void AddNewContents(content::WebContents* source,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,

View File

@@ -121,7 +121,6 @@
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
#include "third_party/blink/public/web/web_window_features.h"
#include "third_party/widevine/cdm/buildflags.h"
@@ -465,23 +464,6 @@ base::FilePath GetRootCachePath() {
CefString(&CefContext::Get()->settings().root_cache_path));
}
// Register BrowserInterfaceBroker's GetInterface() handler callbacks for
// chrome-specific document-scoped interfaces.
// Stub implementations to silence "Empty binder for interface
// blink.mojom.[Name] for the frame/document scope" errors.
// Based on chrome/browser/chrome_browser_interface_binders.cc.
void PopulateChromeFrameBinders(
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
map->Add<blink::mojom::InsecureInputService>(base::BindRepeating(
[](content::RenderFrameHost* frame_host,
mojo::PendingReceiver<blink::mojom::InsecureInputService> receiver) {
}));
map->Add<blink::mojom::PrerenderProcessor>(base::BindRepeating(
[](content::RenderFrameHost* frame_host,
mojo::PendingReceiver<blink::mojom::PrerenderProcessor> receiver) {}));
}
} // namespace
AlloyContentBrowserClient::AlloyContentBrowserClient() {
@@ -957,11 +939,13 @@ void AlloyContentBrowserClient::OverrideWebkitPrefs(
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
// when this method is called.
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
SkColor base_background_color;
renderer_prefs::PopulateWebPreferences(rvh, *prefs, base_background_color);
web_contents->SetPageBaseBackgroundColor(base_background_color);
if (rvh->GetWidget()->GetView()) {
rvh->GetWidget()->GetView()->SetBackgroundColor(
prefs->base_background_color);
rvh->GetWidget()->GetView()->SetBackgroundColor(base_background_color);
}
}
@@ -1250,7 +1234,7 @@ AlloyContentBrowserClient::GetNetworkContextsParentDirectory() {
bool AlloyContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
@@ -1299,7 +1283,6 @@ AlloyContentBrowserClient::CreateWindowForPictureInPicture(
void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
PopulateChromeFrameBinders(map);
CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(render_frame_host,
map);
@@ -1377,7 +1360,7 @@ bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
// Persistent MediaDevice IDs are allowed if cookies are allowed.
return CookieSettingsFactory::GetForProfile(
Profile::FromBrowserContext(browser_context))
->IsCookieAccessAllowed(url, site_for_cookies, top_frame_origin);
->IsFullCookieAccessAllowed(url, site_for_cookies, top_frame_origin);
}
bool AlloyContentBrowserClient::ShouldAllowPluginCreation(

View File

@@ -178,7 +178,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
bool HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,

View File

@@ -0,0 +1,44 @@
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/alloy/alloy_dialog_util.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "base/strings/utf_string_conversions.h"
namespace alloy {
void RunFileChooser(content::WebContents* web_contents,
const blink::mojom::FileChooserParams& params,
RunFileChooserCallback callback) {
CefRefPtr<AlloyBrowserHostImpl> browser =
AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
if (!browser) {
std::move(callback).Run(-1, {});
return;
}
CefFileDialogRunner::FileChooserParams cef_params;
cef_params.mode = params.mode;
cef_params.default_file_name = params.default_file_name;
cef_params.accept_types = params.accept_types;
browser->RunFileChooser(cef_params, std::move(callback));
}
// Based on net/base/filename_util_internal.cc FilePathToString16().
std::u16string FilePathTypeToString16(const base::FilePath::StringType& str) {
std::u16string result;
#if defined(OS_WIN)
result.assign(str.begin(), str.end());
#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
if (!str.empty()) {
base::UTF8ToUTF16(str.c_str(), str.size(), &result);
}
#endif
return result;
}
} // namespace alloy

View File

@@ -0,0 +1,37 @@
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_
#pragma once
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/files/file_path.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
namespace content {
class WebContents;
}
namespace alloy {
// The argument vector will be empty if the dialog was canceled.
using RunFileChooserCallback =
base::OnceCallback<void(int /*selected_accept_filter*/,
const std::vector<base::FilePath>& /*file_paths*/)>;
// Display the file chooser dialog. Execute |callback| on completion.
// Called from patched chrome/ files.
void RunFileChooser(content::WebContents* web_contents,
const blink::mojom::FileChooserParams& params,
RunFileChooserCallback callback);
std::u16string FilePathTypeToString16(const base::FilePath::StringType& str);
} // namespace alloy
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_

View File

@@ -0,0 +1,16 @@
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/alloy/alloy_download_util.h"
#include "libcef/browser/alloy/alloy_browser_context.h"
namespace alloy {
DownloadPrefs* GetDownloadPrefsFromBrowserContext(
content::BrowserContext* context) {
return static_cast<AlloyBrowserContext*>(context)->GetDownloadPrefs();
}
} // namespace alloy

View File

@@ -0,0 +1,23 @@
// Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_
#pragma once
class DownloadPrefs;
namespace content {
class BrowserContext;
} // namespace content
namespace alloy {
// Called from DownloadPrefs::FromBrowserContext.
DownloadPrefs* GetDownloadPrefsFromBrowserContext(
content::BrowserContext* context);
} // namespace alloy
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_

View File

@@ -24,6 +24,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "extensions/browser/process_manager.h"
#include "printing/mojom/print.mojom.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
namespace {
@@ -141,10 +142,12 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents(
}
}
bool CefBrowserPlatformDelegateAlloy::ShouldTransferNavigation(
bool is_main_frame_navigation) {
bool CefBrowserPlatformDelegateAlloy::
ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
if (extension_host_) {
return extension_host_->ShouldTransferNavigation(is_main_frame_navigation);
return extension_host_->ShouldAllowRendererInitiatedCrossProcessNavigation(
is_main_frame_navigation);
}
return true;
}

View File

@@ -27,7 +27,8 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) override;
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void RenderViewReady() override;
void BrowserCreated(CefBrowserHostBase* browser) override;

View File

@@ -372,3 +372,9 @@ BuildState* ChromeBrowserProcessAlloy::GetBuildState() {
NOTREACHED();
return nullptr;
}
SerialPolicyAllowedPorts*
ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
NOTREACHED();
return nullptr;
}

View File

@@ -98,6 +98,7 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
override;
BuildState* GetBuildState() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
private:
bool initialized_;

View File

@@ -110,7 +110,9 @@ void CefAudioCapturer::Capture(const media::AudioBus* source,
pts.InMilliseconds());
}
void CefAudioCapturer::OnCaptureError(const std::string& message) {
void CefAudioCapturer::OnCaptureError(
media::AudioCapturerSource::ErrorCode code,
const std::string& message) {
audio_handler_->OnAudioStreamError(browser_, message);
StopStream();
}

View File

@@ -33,7 +33,8 @@ class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback {
base::TimeTicks audio_capture_time,
double volume,
bool key_pressed) override;
void OnCaptureError(const std::string& message) override;
void OnCaptureError(media::AudioCapturerSource::ErrorCode code,
const std::string& message) override;
void OnCaptureMuted(bool is_muted) override {}
void StopStream();

View File

@@ -473,9 +473,7 @@ void CefBrowserContentsDelegate::Observe(
DCHECK_EQ(type, content::NOTIFICATION_LOAD_STOP);
if (type == content::NOTIFICATION_LOAD_STOP) {
content::NavigationController* controller =
content::Source<content::NavigationController>(source).ptr();
OnTitleChange(controller->GetWebContents()->GetTitle());
OnTitleChange(web_contents()->GetTitle());
}
}

View File

@@ -164,7 +164,7 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
all_schemes.push_back("wss");
}
return base::make_optional(all_schemes);
return absl::make_optional(all_schemes);
}
} // namespace

View File

@@ -16,7 +16,7 @@
CefBrowserFrame::CefBrowserFrame(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver)
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
CefBrowserFrame::~CefBrowserFrame() = default;
@@ -28,7 +28,7 @@ void CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(
[](content::RenderFrameHost* frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver) {
// This object is bound to the lifetime of |frame_host| and the mojo
// connection. See FrameServiceBase for details.
// connection. See DocumentServiceBase for details.
new CefBrowserFrame(frame_host, std::move(receiver));
}));
}

View File

@@ -9,16 +9,16 @@
#include "libcef/browser/frame_host_impl.h"
#include "cef/libcef/common/mojom/cef.mojom.h"
#include "content/public/browser/frame_service_base.h"
#include "content/public/browser/document_service_base.h"
#include "mojo/public/cpp/bindings/binder_map.h"
// Implementation of the BrowserFrame mojo interface.
// This is implemented separately from CefFrameHostImpl to better manage the
// association with the RenderFrameHost (which may be speculative, etc.), and so
// that messages are always routed to the most appropriate CefFrameHostImpl
// instance. Lifespan is tied to the RFH via FrameServiceBase.
// instance. Lifespan is tied to the RFH via DocumentServiceBase.
class CefBrowserFrame
: public content::FrameServiceBase<cef::mojom::BrowserFrame> {
: public content::DocumentServiceBase<cef::mojom::BrowserFrame> {
public:
CefBrowserFrame(content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver);
@@ -39,7 +39,7 @@ class CefBrowserFrame
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
override;
// FrameServiceBase methods:
// DocumentServiceBase methods:
bool ShouldCloseOnFinishNavigation() const override { return false; }
CefRefPtr<CefFrameHostImpl> GetFrameHost(

View File

@@ -54,8 +54,9 @@ void CefBrowserPlatformDelegate::WebContentsDestroyed(
web_contents_ = nullptr;
}
bool CefBrowserPlatformDelegate::ShouldTransferNavigation(
bool is_main_frame_navigation) {
bool CefBrowserPlatformDelegate::
ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
return true;
}
@@ -398,7 +399,7 @@ int CefBrowserPlatformDelegate::TranslateWebEventModifiers(
int result = 0;
// Set modifiers based on key state.
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
result |= blink::WebInputEvent::kCapsLockOn;
result |= blink::WebInputEvent::kCapsLockOn;
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
result |= blink::WebInputEvent::kShiftKey;
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
@@ -412,7 +413,7 @@ int CefBrowserPlatformDelegate::TranslateWebEventModifiers(
if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
result |= blink::WebInputEvent::kRightButtonDown;
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
result |= blink::WebInputEvent::kMetaKey;
result |= blink::WebInputEvent::kMetaKey;
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
result |= blink::WebInputEvent::kNumLockOn;
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)

View File

@@ -118,7 +118,8 @@ class CefBrowserPlatformDelegate {
virtual void WebContentsDestroyed(content::WebContents* web_contents);
// See WebContentsDelegate documentation.
virtual bool ShouldTransferNavigation(bool is_main_frame_navigation);
virtual bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation);
// Called after the RenderViewHost is created.
virtual void RenderViewCreated(content::RenderViewHost* render_view_host);

View File

@@ -41,14 +41,14 @@ namespace {
void HandleExternalProtocolHelper(
ChromeContentBrowserClientCef* self,
content::WebContents::OnceGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
const network::ResourceRequest& resource_request) {
// Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol(
resource_request.url, std::move(web_contents_getter),
resource_request.url, web_contents_getter,
content::ChildProcessHost::kInvalidUniqueID, frame_tree_node_id,
navigation_data,
resource_request.resource_type ==
@@ -173,23 +173,25 @@ void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
ChromeContentBrowserClient::OverrideWebkitPrefs(web_contents, prefs);
SkColor base_background_color;
auto browser = ChromeBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser) {
renderer_prefs::SetCefPrefs(browser->settings(), *prefs);
// Set the background color for the WebView.
prefs->base_background_color = browser->GetBackgroundColor();
base_background_color = browser->GetBackgroundColor();
} else {
// We don't know for sure that the browser will be windowless but assume
// that the global windowless state is likely to be accurate.
prefs->base_background_color =
base_background_color =
CefContext::Get()->GetBackgroundColor(nullptr, STATE_DEFAULT);
}
web_contents->SetPageBaseBackgroundColor(base_background_color);
auto rvh = web_contents->GetRenderViewHost();
if (rvh->GetWidget()->GetView()) {
rvh->GetWidget()->GetView()->SetBackgroundColor(
prefs->base_background_color);
rvh->GetWidget()->GetView()->SetBackgroundColor(base_background_color);
}
}
@@ -236,7 +238,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
@@ -256,9 +258,9 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
// HandleExternalProtocolHelper. Forward to the chrome layer for default
// handling.
return ChromeContentBrowserClient::HandleExternalProtocol(
url, std::move(web_contents_getter), child_id, frame_tree_node_id,
navigation_data, is_main_frame, page_transition, has_user_gesture,
initiating_origin, nullptr);
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
is_main_frame, page_transition, has_user_gesture, initiating_origin,
nullptr);
}
bool ChromeContentBrowserClientCef::HandleExternalProtocol(

View File

@@ -58,7 +58,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
bool HandleExternalProtocol(
const GURL& url,
content::WebContents::OnceGetter web_contents_getter,
content::WebContents::Getter web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,

View File

@@ -8,6 +8,7 @@
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "components/zoom/zoom_controller.h"
@@ -381,8 +382,16 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file,
void ExecuteCodeInTabFunction::LoadFileComplete(
const std::string& file,
std::unique_ptr<std::string> data) {
std::vector<std::unique_ptr<std::string>> data_list;
absl::optional<std::string> error;
const bool success = !!data.get();
DidLoadAndLocalizeFile(file, success, std::move(data));
if (success) {
DCHECK(data);
data_list.push_back(std::move(data));
} else {
error = base::StringPrintf("Failed to load file '%s'.", file.c_str());
}
DidLoadAndLocalizeFile(file, std::move(data_list), std::move(error));
}
bool TabsInsertCSSFunction::ShouldInsertCSS() const {

View File

@@ -4,6 +4,7 @@
#include "libcef/browser/extensions/component_extension_resource_manager.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/values.h"

View File

@@ -35,8 +35,9 @@ CefExtensionBackgroundHost::~CefExtensionBackgroundHost() {
std::move(deleted_callback_).Run();
}
bool CefExtensionBackgroundHost::ShouldTransferNavigation(
bool is_main_frame_navigation) {
bool CefExtensionBackgroundHost::
ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
// Block navigations that cause the main frame to navigate to non-extension
// content (i.e. to web content).
return !is_main_frame_navigation;

View File

@@ -33,7 +33,8 @@ class CefExtensionBackgroundHost : public ExtensionHost {
~CefExtensionBackgroundHost() override;
// content::WebContentsDelegate methods:
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
private:
// Callback that will be executed on host deletion.

View File

@@ -61,7 +61,7 @@ bool CefExtensionViewHost::IsBackgroundPage() const {
return false;
}
bool CefExtensionViewHost::ShouldTransferNavigation(
bool CefExtensionViewHost::ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) {
// Block navigations that cause the main frame to navigate to non-extension
// content (i.e. to web content).

View File

@@ -40,7 +40,8 @@ class CefExtensionViewHost : public ExtensionHost,
bool IsBackgroundPage() const override;
// content::WebContentsDelegate methods:
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
bool is_main_frame_navigation) override;
bool PreHandleGestureEvent(content::WebContents* source,
const blink::WebGestureEvent& event) override;

View File

@@ -18,6 +18,7 @@
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "components/zoom/zoom_controller.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
#include "printing/mojom/print.mojom.h"
namespace extensions {

View File

@@ -173,12 +173,11 @@ void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
const base::FilePath& resource_relative_path,
const int resource_id,
const std::string& content_security_policy,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
bool send_cors_header) {
scoped_refptr<net::HttpResponseHeaders> headers,
mojo::PendingRemote<network::mojom::URLLoaderClient> client) {
chrome_url_request_util::LoadResourceFromResourceBundle(
request, std::move(loader), resource_relative_path, resource_id,
content_security_policy, std::move(client), send_cors_header);
std::move(headers), std::move(client));
}
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(

View File

@@ -51,9 +51,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
mojo::PendingReceiver<network::mojom::URLLoader> loader,
const base::FilePath& resource_relative_path,
const int resource_id,
const std::string& content_security_policy,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
bool send_cors_header) override;
scoped_refptr<net::HttpResponseHeaders> headers,
mojo::PendingRemote<network::mojom::URLLoaderClient> client) override;
bool AllowCrossRendererResourceLoad(
const network::ResourceRequest& request,
network::mojom::RequestDestination destination,

View File

@@ -60,11 +60,10 @@ ValueStore::ReadResult CefValueStore::Get(
return ReadResult(CreateStatusCopy(status_));
auto settings = std::make_unique<base::DictionaryValue>();
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
base::Value* value = nullptr;
if (storage_.GetWithoutPathExpansion(*it, &value)) {
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
for (const auto& key : keys) {
base::Value* value = storage_.FindKey(key);
if (value) {
settings->SetKey(key, value->Clone());
}
}
return ReadResult(std::move(settings), CreateStatusCopy(status_));
@@ -95,15 +94,14 @@ ValueStore::WriteResult CefValueStore::Set(
ValueStoreChangeList changes;
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
it.Advance()) {
base::Value* old_value = NULL;
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
!old_value->Equals(&it.value())) {
base::Value* old_value = storage_.FindKey(it.key());
if (!old_value || *old_value != it.value()) {
changes.emplace_back(it.key(),
old_value
? absl::optional<base::Value>(old_value->Clone())
: absl::nullopt,
it.value().Clone());
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
storage_.SetKey(it.key(), it.value().Clone());
}
}
return WriteResult(std::move(changes), CreateStatusCopy(status_));
@@ -120,10 +118,10 @@ ValueStore::WriteResult CefValueStore::Remove(
return WriteResult(CreateStatusCopy(status_));
ValueStoreChangeList changes;
for (auto it = keys.cbegin(); it != keys.cend(); ++it) {
std::unique_ptr<base::Value> old_value;
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
changes.emplace_back(*it, std::move(*old_value), absl::nullopt);
for (auto const& key : keys) {
absl::optional<base::Value> old_value = storage_.ExtractKey(key);
if (old_value.has_value()) {
changes.emplace_back(key, std::move(*old_value), absl::nullopt);
}
}
return WriteResult(std::move(changes), CreateStatusCopy(status_));

View File

@@ -38,7 +38,11 @@ CefRefPtr<CefMediaSource> CefMediaRouteImpl::GetSource() {
}
CefRefPtr<CefMediaSink> CefMediaRouteImpl::GetSink() {
return new CefMediaSinkImpl(route_.media_sink_id(), route_.media_sink_name());
return new CefMediaSinkImpl(
route_.media_sink_id(), route_.media_sink_name(),
route_.media_source().IsDialSource()
? media_router::mojom::MediaRouteProviderId::DIAL
: media_router::mojom::MediaRouteProviderId::CAST);
}
void CefMediaRouteImpl::SendRouteMessage(const void* message,

View File

@@ -85,9 +85,14 @@ void GetDeviceInfo(const media_router::MediaSink::Id& sink_id,
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
: sink_(sink) {}
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink::Id& sink_id,
const std::string& sink_name)
: sink_(sink_id, sink_name, media_router::SinkIconType::GENERIC) {}
CefMediaSinkImpl::CefMediaSinkImpl(
const media_router::MediaSink::Id& sink_id,
const std::string& sink_name,
media_router::mojom::MediaRouteProviderId provider_id)
: sink_(sink_id,
sink_name,
media_router::SinkIconType::GENERIC,
provider_id) {}
CefString CefMediaSinkImpl::GetId() {
return sink_.id();
@@ -116,11 +121,11 @@ void CefMediaSinkImpl::GetDeviceInfo(
}
bool CefMediaSinkImpl::IsCastSink() {
return sink_.provider_id() == media_router::CAST;
return sink_.provider_id() == media_router::mojom::MediaRouteProviderId::CAST;
}
bool CefMediaSinkImpl::IsDialSink() {
return sink_.provider_id() == media_router::DIAL;
return sink_.provider_id() == media_router::mojom::MediaRouteProviderId::DIAL;
}
bool CefMediaSinkImpl::IsCompatibleWith(CefRefPtr<CefMediaSource> source) {

View File

@@ -15,7 +15,8 @@ class CefMediaSinkImpl : public CefMediaSink {
public:
explicit CefMediaSinkImpl(const media_router::MediaSink& sink);
CefMediaSinkImpl(const media_router::MediaSink::Id& sink_id,
const std::string& sink_name);
const std::string& sink_name,
media_router::mojom::MediaRouteProviderId provider_id);
// CefMediaSink methods.
CefString GetId() override;

View File

@@ -101,14 +101,14 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50);
// Set font-related attributes.
static const base::NoDestructor<gfx::FontRenderParams> params(
static const gfx::FontRenderParams params(
gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr));
prefs->should_antialias_text = params->antialiasing;
prefs->use_subpixel_positioning = params->subpixel_positioning;
prefs->hinting = params->hinting;
prefs->use_autohinter = params->autohinter;
prefs->use_bitmaps = params->use_bitmaps;
prefs->subpixel_rendering = params->subpixel_rendering;
prefs->should_antialias_text = params.antialiasing;
prefs->use_subpixel_positioning = params.subpixel_positioning;
prefs->hinting = params.hinting;
prefs->use_autohinter = params.autohinter;
prefs->use_bitmaps = params.use_bitmaps;
prefs->subpixel_rendering = params.subpixel_rendering;
web_contents_->SyncRendererPrefs();

View File

@@ -166,14 +166,18 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
NSView* parentView =
CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(window_info_.parent_view);
NSRect contentRect = {{window_info_.x, window_info_.y},
{window_info_.width, window_info_.height}};
NSRect contentRect = {{static_cast<CGFloat>(window_info_.x),
static_cast<CGFloat>(window_info_.y)},
{static_cast<CGFloat>(window_info_.width),
static_cast<CGFloat>(window_info_.height)}};
if (parentView == nil) {
// Create a new window.
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
NSRect window_rect = {
{window_info_.x, screen_rect.size.height - window_info_.y},
{window_info_.width, window_info_.height}};
{static_cast<CGFloat>(window_info_.x),
screen_rect.size.height - static_cast<CGFloat>(window_info_.y)},
{static_cast<CGFloat>(window_info_.width),
static_cast<CGFloat>(window_info_.height)}};
if (window_rect.size.width == 0)
window_rect.size.width = 750;
if (window_rect.size.height == 0)
@@ -328,7 +332,8 @@ gfx::Point CefBrowserPlatformDelegateNativeMac::GetScreenPoint(
NSView* nsview = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(window_info_.parent_view);
if (nsview) {
NSRect bounds = [nsview bounds];
NSPoint view_pt = {view.x(), bounds.size.height - view.y()};
NSPoint view_pt = {static_cast<CGFloat>(view.x()),
bounds.size.height - static_cast<CGFloat>(view.y())};
NSPoint window_pt = [nsview convertPoint:view_pt toView:nil];
NSPoint screen_pt =
ui::ConvertPointFromWindowToScreen([nsview window], window_pt);

View File

@@ -29,6 +29,8 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
web_view_->SetWebContents(web_contents);
web_view_->SetPreferredSize(bounds.size());
SetCanResize(true);
views::Widget* widget = new views::Widget;
// See CalculateWindowStylesFromInitParams in

View File

@@ -34,7 +34,6 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
void InitContent();
// WidgetDelegateView methods:
bool CanResize() const override { return true; }
bool CanMaximize() const override { return true; }
View* GetContentsView() override { return this; }

View File

@@ -91,10 +91,10 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostBase> browser,
.depth = depth,
.wid = xwindow_,
.parent = parent_xwindow_,
.x = bounds.x(),
.y = bounds.y(),
.width = bounds.width(),
.height = bounds.height(),
.x = static_cast<int16_t>(bounds.x()),
.y = static_cast<int16_t>(bounds.y()),
.width = static_cast<uint16_t>(bounds.width()),
.height = static_cast<uint16_t>(bounds.height()),
.c_class = x11::WindowClass::InputOutput,
.visual = visual,
.background_pixel = 0,

View File

@@ -44,7 +44,6 @@
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/user_agent.h"
#include "content/public/test/scoped_web_ui_controller_factory_registration.h"
#include "ipc/ipc_channel.h"
#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "ui/base/resource/resource_bundle.h"
@@ -641,9 +640,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
static CefWebUIControllerFactory* GetInstance();
protected:
CefWebUIControllerFactory()
: remove_content_registration_(
content::ContentWebUIControllerFactory::GetInstance()) {}
CefWebUIControllerFactory() {}
~CefWebUIControllerFactory() override {}
private:
@@ -666,9 +663,6 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
return false;
}
content::ScopedWebUIControllerFactoryRegistration
remove_content_registration_;
DISALLOW_COPY_AND_ASSIGN(CefWebUIControllerFactory);
};
@@ -684,6 +678,9 @@ CefWebUIControllerFactory* CefWebUIControllerFactory::GetInstance() {
void RegisterWebUIControllerFactory() {
// Channel all WebUI handling through CefWebUIControllerFactory.
content::WebUIControllerFactory::UnregisterFactoryForTesting(
content::ContentWebUIControllerFactory::GetInstance());
content::WebUIControllerFactory::RegisterFactory(
CefWebUIControllerFactory::GetInstance());
}

View File

@@ -237,7 +237,7 @@ void SaveCookies(content::BrowserContext* browser_context,
net::CookieInclusionStatus returned_status;
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
request.url, cookie_string, base::Time::Now(),
base::make_optional(response_date), &returned_status);
absl::make_optional(response_date), &returned_status);
if (!returned_status.IsInclude()) {
continue;
}

View File

@@ -27,6 +27,7 @@
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/cors/cors.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/early_hints.mojom.h"
namespace net_service {
@@ -963,7 +964,7 @@ void InterceptedRequest::ContinueToBeforeRedirect(
bool should_clear_upload;
net::RedirectUtil::UpdateHttpRequest(original_url, original_method,
new_redirect_info,
base::make_optional(remove_headers),
absl::make_optional(remove_headers),
/*modified_headers=*/absl::nullopt,
&request_.headers, &should_clear_upload);

View File

@@ -45,6 +45,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/common/content_switches.h"
#include "media/base/video_frame.h"
#include "media/capture/mojom/video_capture_buffer.mojom.h"
#include "ui/compositor/compositor.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
@@ -60,8 +61,8 @@ const size_t kMaxDamageRects = 10;
const float kDefaultScaleFactor = 1.0;
blink::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
blink::ScreenInfo screenInfo;
display::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
display::ScreenInfo screenInfo;
screenInfo.device_scale_factor = src.device_scale_factor;
screenInfo.depth = src.depth;
screenInfo.depth_per_component = src.depth_per_component;
@@ -684,7 +685,7 @@ void CefRenderWidgetHostViewOSR::CopyFromSurface(
}
}
void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::ScreenInfo* results) {
void CefRenderWidgetHostViewOSR::GetScreenInfo(display::ScreenInfo* results) {
if (!browser_impl_.get())
return;

View File

@@ -157,7 +157,7 @@ class CefRenderWidgetHostViewOSR
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(blink::ScreenInfo* results) override;
void GetScreenInfo(display::ScreenInfo* results) override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() override;

View File

@@ -7,6 +7,7 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#include "media/base/video_frame_metadata.h"
#include "media/capture/mojom/video_capture_buffer.mojom.h"
#include "media/capture/mojom/video_capture_types.mojom.h"
#include "ui/gfx/skbitmap_operations.h"

View File

@@ -298,6 +298,9 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
registry->RegisterFilePathPref(prefs::kDiskCacheDir, cache_path);
registry->RegisterIntegerPref(prefs::kDiskCacheSize, 0);
// Based on Profile::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kSearchSuggestEnabled, false);
// Spell checking preferences.
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
std::string spellcheck_lang =

View File

@@ -107,6 +107,12 @@ void CefPrefStore::CommitPendingWrite(
std::move(synchronous_done_callback));
}
void CefPrefStore::CommitPendingWriteSynchronously() {
// This method was added for one very specific use case and is intentionally
// not implemented for other pref stores.
NOTREACHED();
}
void CefPrefStore::SchedulePendingLossyWrites() {}
void CefPrefStore::ClearMutableValues() {
@@ -155,7 +161,11 @@ bool CefPrefStore::GetString(const std::string& key, std::string* value) const {
if (!prefs_.GetValue(key, &stored_value) || !stored_value)
return false;
return stored_value->GetAsString(value);
if (value && stored_value->is_string()) {
*value = stored_value->GetString();
return true;
}
return stored_value->is_string();
}
bool CefPrefStore::GetInteger(const std::string& key, int* value) const {
@@ -163,7 +173,11 @@ bool CefPrefStore::GetInteger(const std::string& key, int* value) const {
if (!prefs_.GetValue(key, &stored_value) || !stored_value)
return false;
return stored_value->GetAsInteger(value);
if (value && stored_value->is_int()) {
*value = stored_value->GetInt();
return true;
}
return stored_value->is_int();
}
bool CefPrefStore::GetBoolean(const std::string& key, bool* value) const {
@@ -171,7 +185,11 @@ bool CefPrefStore::GetBoolean(const std::string& key, bool* value) const {
if (!prefs_.GetValue(key, &stored_value) || !stored_value)
return false;
return stored_value->GetAsBoolean(value);
if (value && stored_value->is_bool()) {
*value = stored_value->GetBool();
return true;
}
return stored_value->is_bool();
}
void CefPrefStore::SetBlockAsyncRead(bool block_async_read) {

View File

@@ -49,6 +49,7 @@ class CefPrefStore : public PersistentPrefStore {
virtual void CommitPendingWrite(
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override;
void CommitPendingWriteSynchronously() override;
void SchedulePendingLossyWrites() override;
void ClearMutableValues() override;
void OnStoreDeletionFromDisk() override;

View File

@@ -371,7 +371,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
}
void PopulateWebPreferences(content::RenderViewHost* rvh,
blink::web_pref::WebPreferences& web) {
blink::web_pref::WebPreferences& web,
SkColor& base_background_color) {
REQUIRE_ALLOY_RUNTIME();
CefRefPtr<AlloyBrowserHostImpl> browser = static_cast<AlloyBrowserHostImpl*>(
extensions::GetOwnerBrowserForHost(rvh, nullptr).get());
@@ -421,11 +422,11 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
web.picture_in_picture_enabled = browser->IsPictureInPictureSupported();
// Set the background color for the WebView.
web.base_background_color = browser->GetBackgroundColor();
base_background_color = browser->GetBackgroundColor();
} else {
// We don't know for sure that the browser will be windowless but assume
// that the global windowless state is likely to be accurate.
web.base_background_color =
base_background_color =
CefContext::Get()->GetBackgroundColor(nullptr, STATE_DEFAULT);
}
}

View File

@@ -8,6 +8,8 @@
#include "include/internal/cef_types_wrappers.h"
#include "third_party/skia/include/core/SkColor.h"
class CommandLinePrefStore;
namespace blink {
@@ -48,7 +50,8 @@ void SetCefPrefs(const CefBrowserSettings& cef,
// Populate WebPreferences based on a combination of command-line values,
// PrefService and CefBrowserSettings.
void PopulateWebPreferences(content::RenderViewHost* rvh,
blink::web_pref::WebPreferences& web);
blink::web_pref::WebPreferences& web,
SkColor& base_background_color);
bool PopulateWebPreferencesAfterNavigation(
content::WebContents* web_contents,
blink::web_pref::WebPreferences& web);

View File

@@ -59,7 +59,7 @@ void FillInDictionaryFromPdfPrintSettings(
base::DictionaryValue& print_settings) {
// Fixed settings.
print_settings.SetIntKey(kSettingPrinterType,
static_cast<int>(PrinterType::kPdf));
static_cast<int>(mojom::PrinterType::kPdf));
print_settings.SetInteger(kSettingColor,
static_cast<int>(mojom::ColorModel::kGray));
print_settings.SetInteger(kSettingDuplexMode,

View File

@@ -522,7 +522,7 @@ void CefServerImpl::StartOnUIThread(const std::string& address,
new base::Thread(base::StringPrintf("%s:%d", address.c_str(), port)));
base::Thread::Options options;
options.message_pump_type = base::MessagePumpType::IO;
if (thread->StartWithOptions(options)) {
if (thread->StartWithOptions(std::move(options))) {
// Add a reference that will be released in ShutdownOnUIThread().
AddRef();

View File

@@ -55,6 +55,16 @@ bool CefSSLHostStateDelegate::DidHostRunInsecureContent(
return false;
}
void CefSSLHostStateDelegate::AllowHttpForHost(const std::string& host) {
// Intentional no-op.
}
bool CefSSLHostStateDelegate::IsHttpAllowedForHost(const std::string& host) {
// Intentional no-op. Return value does not matter as HTTPS-Only Mode is not
// enabled.
return false;
}
void CefSSLHostStateDelegate::AllowCert(const std::string& host,
const net::X509Certificate& cert,
int error,

View File

@@ -64,6 +64,8 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate {
bool DidHostRunInsecureContent(const std::string& host,
int child_id,
InsecureContentType content_type) override;
void AllowHttpForHost(const std::string& host) override;
bool IsHttpAllowedForHost(const std::string& host) override;
void RevokeUserAllowExceptions(const std::string& host) override;
bool HasAllowException(const std::string& host,
content::WebContents* web_contents) override;

View File

@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "ui/gfx/color_utils.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/controls/button/button.h"
// Helpers for template boiler-plate.
@@ -53,7 +54,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
views::Button::ButtonState new_state =
static_cast<views::Button::ButtonState>(state);
if (ParentClass::root_view()->ink_drop()->ink_drop_mode() !=
if (views::InkDrop::Get(ParentClass::root_view())->ink_drop_mode() !=
views::InkDropHost::InkDropMode::OFF &&
!ParentClass::root_view()->IsFocusable()) {
// Ink drop state does not get set properly on state change when the button
@@ -64,7 +65,8 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
} else if (old_state == views::Button::STATE_PRESSED) {
ink_state = views::InkDropState::DEACTIVATED;
}
ParentClass::root_view()->ink_drop()->AnimateToState(ink_state, nullptr);
views::InkDrop::Get(ParentClass::root_view())
->AnimateToState(ink_state, nullptr);
}
ParentClass::root_view()->SetState(new_state);
@@ -77,12 +79,12 @@ CEF_BUTTON_IMPL_T cef_button_state_t CEF_BUTTON_IMPL_D::GetState() {
CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetInkDropEnabled(bool enabled) {
CEF_REQUIRE_VALID_RETURN_VOID();
ParentClass::root_view()->ink_drop()->SetMode(
enabled ? views::InkDropHost::InkDropMode::ON
: views::InkDropHost::InkDropMode::OFF);
views::InkDrop::Get(ParentClass::root_view())
->SetMode(enabled ? views::InkDropHost::InkDropMode::ON
: views::InkDropHost::InkDropMode::OFF);
if (enabled) {
ParentClass::root_view()->ink_drop()->SetBaseColor(
color_utils::BlendTowardMaxContrast(
views::InkDrop::Get(ParentClass::root_view())
->SetBaseColor(color_utils::BlendTowardMaxContrast(
ParentClass::root_view()->background()->get_color(), 0x61));
}
}

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/views/view_view.h"
#include "base/logging.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/controls/button/button.h"
// Helpers for template boiler-plate.
@@ -59,7 +60,7 @@ CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::ButtonPressed(
// Callback may trigger new animation state.
if (ParentClass::cef_delegate())
ParentClass::cef_delegate()->OnButtonPressed(GetCefButton());
if (ParentClass::ink_drop()->ink_drop_mode() !=
if (views::InkDrop::Get(this)->ink_drop_mode() !=
views::InkDropHost::InkDropMode::OFF &&
!ParentClass::IsFocusable() &&
ParentClass::GetState() != views::Button::STATE_PRESSED) {
@@ -67,7 +68,7 @@ CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::ButtonPressed(
// non-focusable. Reset the ink drop state here if the state has not been
// explicitly set to pressed by the OnButtonPressed callback calling
// SetState (which also sets the ink drop state).
ParentClass::ink_drop()->AnimateToState(
views::InkDrop::Get(this)->AnimateToState(
views::InkDropState::HIDDEN, ui::LocatedEvent::FromIfValid(&event));
}
}

View File

@@ -138,7 +138,7 @@ class CaptionlessFrameView : public views::NonClientFrameView {
// fullscreen, as it can't be resized in those states.
int resize_border_thickness = ResizeBorderThickness();
int frame_component = GetHTComponentForFrame(
point, resize_border_thickness, resize_border_thickness,
point, gfx::Insets(resize_border_thickness, resize_border_thickness),
kResizeAreaCornerSize, kResizeAreaCornerSize, can_ever_resize);
if (frame_component != HTNOWHERE)
return frame_component;
@@ -260,6 +260,12 @@ void CefWindowView::CreateWidget() {
params.type = views::Widget::InitParams::TYPE_WINDOW;
bool can_activate = true;
// WidgetDelegate::DeleteDelegate() will delete |this| after executing the
// registered callback.
SetOwnedByWidget(true);
RegisterDeleteDelegateCallback(
base::BindOnce(&CefWindowView::DeleteDelegate, base::Unretained(this)));
if (cef_delegate()) {
CefRefPtr<CefWindow> cef_window = GetCefWindow();
is_frameless_ = cef_delegate()->IsFrameless(cef_window);
@@ -267,6 +273,8 @@ void CefWindowView::CreateWidget() {
auto bounds = cef_delegate()->GetInitialBounds(cef_window);
params.bounds = gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height);
SetCanResize(cef_delegate()->CanResize(cef_window));
bool is_menu = false;
bool can_activate_menu = true;
CefRefPtr<CefWindow> parent_window = cef_delegate()->GetParentWindow(
@@ -335,15 +343,6 @@ void CefWindowView::DeleteDelegate() {
RemoveAllChildViews(true);
window_delegate_->OnWindowViewDeleted();
// Deletes |this|.
views::WidgetDelegateView::DeleteDelegate();
}
bool CefWindowView::CanResize() const {
if (!cef_delegate())
return true;
return cef_delegate()->CanResize(GetCefWindow());
}
bool CefWindowView::CanMinimize() const {
@@ -362,18 +361,22 @@ std::u16string CefWindowView::GetWindowTitle() const {
return title_;
}
gfx::ImageSkia CefWindowView::GetWindowIcon() {
ui::ImageModel CefWindowView::GetWindowIcon() {
if (!window_icon_)
return ParentClass::GetWindowIcon();
return static_cast<CefImageImpl*>(window_icon_.get())
->GetForced1xScaleRepresentation(GetDisplay().device_scale_factor());
auto image_skia =
static_cast<CefImageImpl*>(window_icon_.get())
->GetForced1xScaleRepresentation(GetDisplay().device_scale_factor());
return ui::ImageModel::FromImageSkia(image_skia);
}
gfx::ImageSkia CefWindowView::GetWindowAppIcon() {
ui::ImageModel CefWindowView::GetWindowAppIcon() {
if (!window_app_icon_)
return ParentClass::GetWindowAppIcon();
return static_cast<CefImageImpl*>(window_app_icon_.get())
->GetForced1xScaleRepresentation(GetDisplay().device_scale_factor());
auto image_skia =
static_cast<CefImageImpl*>(window_app_icon_.get())
->GetForced1xScaleRepresentation(GetDisplay().device_scale_factor());
return ui::ImageModel::FromImageSkia(image_skia);
}
void CefWindowView::WindowClosing() {

View File

@@ -49,16 +49,12 @@ class CefWindowView
// CefViewView::GetCefView.
CefRefPtr<CefWindow> GetCefWindow() const;
// views::WidgetDelegateView methods:
void DeleteDelegate() override;
// views::WidgetDelegate methods:
bool CanResize() const override;
bool CanMinimize() const override;
bool CanMaximize() const override;
std::u16string GetWindowTitle() const override;
gfx::ImageSkia GetWindowIcon() override;
gfx::ImageSkia GetWindowAppIcon() override;
ui::ImageModel GetWindowIcon() override;
ui::ImageModel GetWindowAppIcon() override;
void WindowClosing() override;
views::View* GetContentsView() override;
views::ClientView* CreateClientView(views::Widget* widget) override;
@@ -101,6 +97,9 @@ class CefWindowView
views::NonClientFrameView* GetNonClientFrameView() const;
private:
// Called when removed from the Widget and before |this| is deleted.
void DeleteDelegate();
// Not owned by this object.
Delegate* window_delegate_;

View File

@@ -8,7 +8,7 @@
#include "libcef/common/net/scheme_info.h"
#include "libcef/features/runtime.h"
#include "base/stl_util.h"
#include "base/containers/contains.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "net/net_buildflags.h"

View File

@@ -102,9 +102,9 @@ int GetCacheControlHeaderPolicy(CefRequest::HeaderMap headerMap) {
// Convert cef_urlrequest_flags_t to blink::WebCachePolicy.
blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) {
const bool skip_cache{ur_flags & UR_FLAG_SKIP_CACHE};
const bool only_from_cache{ur_flags & UR_FLAG_ONLY_FROM_CACHE};
const bool disable_cache{ur_flags & UR_FLAG_DISABLE_CACHE};
const bool skip_cache{!!(ur_flags & UR_FLAG_SKIP_CACHE)};
const bool only_from_cache{!!(ur_flags & UR_FLAG_ONLY_FROM_CACHE)};
const bool disable_cache{!!(ur_flags & UR_FLAG_DISABLE_CACHE)};
if (only_from_cache && (skip_cache || disable_cache)) {
// The request will always fail because only_from_cache and
// skip_cache/disable_cache are mutually exclusive.

View File

@@ -105,7 +105,7 @@ bool CefThreadImpl::Create(const CefString& display_name,
}
#endif
if (!thread_->StartWithOptions(options)) {
if (!thread_->StartWithOptions(std::move(options))) {
thread_.reset();
return false;
}

View File

@@ -243,8 +243,8 @@ bool CefValueImpl::GetBool() {
base::AutoLock lock_scope(lock_);
bool ret_value = false;
if (value_)
value_->GetAsBoolean(&ret_value);
if (value_ && value_->is_bool())
ret_value = value_->GetBool();
return ret_value;
}
@@ -252,8 +252,8 @@ int CefValueImpl::GetInt() {
base::AutoLock lock_scope(lock_);
int ret_value = 0;
if (value_)
value_->GetAsInteger(&ret_value);
if (value_ && value_->is_int())
ret_value = value_->GetInt();
return ret_value;
}
@@ -261,8 +261,8 @@ double CefValueImpl::GetDouble() {
base::AutoLock lock_scope(lock_);
double ret_value = 0;
if (value_)
value_->GetAsDouble(&ret_value);
if (value_ && value_->is_double())
ret_value = value_->GetDouble();
return ret_value;
}
@@ -270,8 +270,8 @@ CefString CefValueImpl::GetString() {
base::AutoLock lock_scope(lock_);
std::string ret_value;
if (value_)
value_->GetAsString(&ret_value);
if (value_ && value_->is_string())
ret_value = value_->GetString();
return ret_value;
}
@@ -691,7 +691,7 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::Copy(
size_t CefDictionaryValueImpl::GetSize() {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().size();
return const_value().DictSize();
}
bool CefDictionaryValueImpl::Clear() {
@@ -700,7 +700,7 @@ bool CefDictionaryValueImpl::Clear() {
// Detach any dependent values.
controller()->RemoveDependencies(mutable_value());
mutable_value()->Clear();
mutable_value()->DictClear();
return true;
}
@@ -728,10 +728,9 @@ bool CefDictionaryValueImpl::Remove(const CefString& key) {
CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
switch (out_value->type()) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value) {
switch (value->type()) {
case base::Value::Type::NONE:
return VTYPE_NULL;
case base::Value::Type::BOOLEAN:
@@ -757,11 +756,10 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value) {
return CefValueImpl::GetOrCreateRefOrCopy(
const_cast<base::Value*>(out_value),
const_cast<base::Value*>(value),
const_cast<base::DictionaryValue*>(&const_value()), read_only(),
controller());
}
@@ -772,11 +770,12 @@ CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
bool CefDictionaryValueImpl::GetBool(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, false);
const base::Value* out_value = nullptr;
bool ret_value = false;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsBoolean(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_bool()) {
ret_value = value->GetBool();
}
return ret_value;
}
@@ -784,11 +783,12 @@ bool CefDictionaryValueImpl::GetBool(const CefString& key) {
int CefDictionaryValueImpl::GetInt(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, 0);
const base::Value* out_value = nullptr;
int ret_value = 0;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsInteger(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_int()) {
ret_value = value->GetInt();
}
return ret_value;
}
@@ -796,11 +796,12 @@ int CefDictionaryValueImpl::GetInt(const CefString& key) {
double CefDictionaryValueImpl::GetDouble(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, 0);
const base::Value* out_value = nullptr;
double ret_value = 0;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsDouble(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_double()) {
ret_value = value->GetDouble();
}
return ret_value;
}
@@ -808,11 +809,12 @@ double CefDictionaryValueImpl::GetDouble(const CefString& key) {
CefString CefDictionaryValueImpl::GetString(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, CefString());
const base::Value* out_value = nullptr;
std::string ret_value;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsString(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_string()) {
ret_value = value->GetString();
}
return ret_value;
}
@@ -821,12 +823,9 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_blob()) {
base::Value* binary_value = const_cast<base::Value*>(out_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_blob()) {
base::Value* binary_value = const_cast<base::Value*>(value);
return CefBinaryValueImpl::GetOrCreateRef(
binary_value, const_cast<base::DictionaryValue*>(&const_value()),
controller());
@@ -839,13 +838,10 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_dict()) {
base::DictionaryValue* dict_value = static_cast<base::DictionaryValue*>(
const_cast<base::Value*>(out_value));
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_dict()) {
base::DictionaryValue* dict_value =
static_cast<base::DictionaryValue*>(const_cast<base::Value*>(value));
return CefDictionaryValueImpl::GetOrCreateRef(
dict_value, const_cast<base::DictionaryValue*>(&const_value()),
read_only(), controller());
@@ -857,13 +853,10 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
CefRefPtr<CefListValue> CefDictionaryValueImpl::GetList(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_list()) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_list()) {
base::ListValue* list_value =
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
static_cast<base::ListValue*>(const_cast<base::Value*>(value));
return CefListValueImpl::GetOrCreateRef(
list_value, const_cast<base::DictionaryValue*>(&const_value()),
read_only(), controller());
@@ -952,18 +945,29 @@ bool CefDictionaryValueImpl::SetList(const CefString& key,
}
bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) {
std::unique_ptr<base::Value> out_value;
if (!mutable_value()->RemoveWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
// The ExtractKey() call below which removes the Value from the dictionary
// will return a new Value object with the moved contents of the Value that
// exists in the implementation std::map. Consequently we use FindKey() to
// retrieve the actual Value pointer as it current exists first, for later
// comparison purposes.
const base::Value* actual_value =
const_value().FindKey(base::StringPiece(key));
if (!actual_value)
return false;
// |actual_value| is no longer valid after this call.
absl::optional<base::Value> out_value =
mutable_value()->ExtractKey(base::StringPiece(key));
if (!out_value.has_value()) {
return false;
}
// Remove the value.
controller()->Remove(out_value.get(), true);
controller()->Remove(const_cast<base::Value*>(actual_value), true);
// Only list and dictionary types may have dependencies.
if (out_value->is_list() || out_value->is_dict()) {
controller()->RemoveDependencies(out_value.get());
controller()->RemoveDependencies(const_cast<base::Value*>(actual_value));
}
return true;
@@ -1126,7 +1130,7 @@ bool CefListValueImpl::Clear() {
// Detach any dependent values.
controller()->RemoveDependencies(mutable_value());
mutable_value()->Clear();
mutable_value()->ClearList();
return true;
}
@@ -1183,8 +1187,9 @@ bool CefListValueImpl::GetBool(size_t index) {
const base::Value* out_value = nullptr;
bool ret_value = false;
if (const_value().Get(index, &out_value))
out_value->GetAsBoolean(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_bool()) {
ret_value = out_value->GetBool();
}
return ret_value;
}
@@ -1195,8 +1200,9 @@ int CefListValueImpl::GetInt(size_t index) {
const base::Value* out_value = nullptr;
int ret_value = 0;
if (const_value().Get(index, &out_value))
out_value->GetAsInteger(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_int()) {
ret_value = out_value->GetInt();
}
return ret_value;
}
@@ -1207,8 +1213,9 @@ double CefListValueImpl::GetDouble(size_t index) {
const base::Value* out_value = nullptr;
double ret_value = 0;
if (const_value().Get(index, &out_value))
out_value->GetAsDouble(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_double()) {
ret_value = out_value->GetDouble();
}
return ret_value;
}
@@ -1219,8 +1226,9 @@ CefString CefListValueImpl::GetString(size_t index) {
const base::Value* out_value = nullptr;
std::string ret_value;
if (const_value().Get(index, &out_value))
out_value->GetAsString(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_string()) {
ret_value = out_value->GetString();
}
return ret_value;
}
@@ -1348,24 +1356,28 @@ bool CefListValueImpl::SetList(size_t index, CefRefPtr<CefListValue> value) {
}
bool CefListValueImpl::RemoveInternal(size_t index) {
// base::Value now uses move semantics which means that Remove() will return
// a new base::Value object with the moved contents of the base::Value that
// exists in the implementation std::vector. Consequently we use Get() to
// retrieve the actual base::Value pointer as it exists in the std::vector.
const base::Value* actual_value = nullptr;
if (!const_value().Get(index, &actual_value))
auto list = mutable_value()->GetList();
if (index >= list.size())
return false;
DCHECK(actual_value);
std::unique_ptr<base::Value> out_value;
if (!mutable_value()->Remove(index, &out_value))
// The std::move() call below which removes the Value from the list will
// return a new Value object with the moved contents of the Value that exists
// in the implementation std::vector. Consequently we use Get() to retrieve
// the actual Value pointer as it current exists first, for later comparison
// purposes.
const base::Value* actual_value = nullptr;
if (!const_value().Get(index, &actual_value) || !actual_value)
return false;
// |actual_value| is no longer valid after this call.
auto out_value = std::move(list[index]);
mutable_value()->EraseListIter(list.begin() + index);
// Remove the value.
controller()->Remove(const_cast<base::Value*>(actual_value), true);
// Only list and dictionary types may have dependencies.
if (out_value->is_list() || out_value->is_dict()) {
if (out_value.is_list() || out_value.is_dict()) {
controller()->RemoveDependencies(const_cast<base::Value*>(actual_value));
}
@@ -1375,10 +1387,13 @@ bool CefListValueImpl::RemoveInternal(size_t index) {
base::Value* CefListValueImpl::SetInternal(size_t index, base::Value* value) {
DCHECK(value);
if (RemoveInternal(index))
mutable_value()->Insert(index, base::WrapUnique(value));
else
if (RemoveInternal(index)) {
auto list = mutable_value()->GetList();
CHECK_LE(index, list.size());
mutable_value()->Insert(list.begin() + index, std::move(*value));
} else {
mutable_value()->Set(index, base::WrapUnique(value));
}
// base::Value now uses move semantics which means that Insert()/Set() will
// move the contents of the passed-in base::Value instead of keeping the same

View File

@@ -53,7 +53,7 @@ const char kWidevineCdmArch[] =
"x64";
#elif defined(ARCH_CPU_ARM64)
"arm64";
#else
#else
"???";
#endif
@@ -93,6 +93,7 @@ const char kCdmSupportedEncryptionSchemesName[] =
// parameter |kCdmCodecsListName|.
const char kCdmSupportedCodecVp8[] = "vp8";
const char kCdmSupportedCodecVp9[] = "vp09";
const char kCdmSupportedCodecAv1[] = "av01";
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const char kCdmSupportedCodecAvc1[] = "avc1";
#endif
@@ -197,7 +198,7 @@ bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
// valid. Returns false and does not modify |video_codecs| if the manifest entry
// is incorrectly formatted.
bool GetCodecs(const base::DictionaryValue& manifest,
std::vector<media::VideoCodec>* video_codecs,
media::CdmCapability::VideoCodecMap* video_codecs,
std::string* error_message) {
DCHECK(video_codecs);
@@ -224,19 +225,22 @@ bool GetCodecs(const base::DictionaryValue& manifest,
return true;
}
std::vector<media::VideoCodec> result;
media::CdmCapability::VideoCodecMap result;
const std::vector<media::VideoCodecProfile> kAllProfiles = {};
const std::vector<base::StringPiece> supported_codecs =
base::SplitStringPiece(codecs, kCdmValueDelimiter, base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
for (const auto& codec : supported_codecs) {
if (codec == kCdmSupportedCodecVp8)
result.push_back(media::VideoCodec::kCodecVP8);
result.emplace(media::VideoCodec::kCodecVP8, kAllProfiles);
else if (codec == kCdmSupportedCodecVp9)
result.push_back(media::VideoCodec::kCodecVP9);
result.emplace(media::VideoCodec::kCodecVP9, kAllProfiles);
else if (codec == kCdmSupportedCodecAv1)
result.emplace(media::VideoCodec::kCodecAV1, kAllProfiles);
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
else if (codec == kCdmSupportedCodecAvc1)
result.push_back(media::VideoCodec::kCodecH264);
result.emplace(media::VideoCodec::kCodecH264, kAllProfiles);
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
}

View File

@@ -64,7 +64,6 @@
#include "components/spellcheck/renderer/spellcheck_provider.h"
#include "components/visitedlink/renderer/visitedlink_reader.h"
#include "components/web_cache/renderer/web_cache_impl.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
@@ -309,13 +308,13 @@ void AlloyContentRendererClient::RenderFrameCreated(
}
}
void AlloyContentRendererClient::RenderViewCreated(
content::RenderView* render_view) {
void AlloyContentRendererClient::WebViewCreated(blink::WebView* web_view) {
bool browser_created;
absl::optional<bool> is_windowless;
render_manager_->RenderViewCreated(render_view, browser_created,
is_windowless);
render_manager_->WebViewCreated(web_view, browser_created, is_windowless);
if (browser_created) {
auto render_view = content::RenderView::FromWebView(web_view);
CHECK(render_view);
OnBrowserCreated(render_view, is_windowless);
}
}

View File

@@ -79,7 +79,7 @@ class AlloyContentRendererClient
void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override;
void RenderThreadConnected() override;
void RenderFrameCreated(content::RenderFrame* render_frame) override;
void RenderViewCreated(content::RenderView* render_view) override;
void WebViewCreated(blink::WebView* web_view) override;
bool IsPluginHandledExternally(content::RenderFrame* render_frame,
const blink::WebElement& plugin_element,
const GURL& original_url,

View File

@@ -53,14 +53,12 @@ void ChromeContentRendererClientCef::RenderFrameCreated(
}
}
void ChromeContentRendererClientCef::RenderViewCreated(
content::RenderView* render_view) {
ChromeContentRendererClient::RenderViewCreated(render_view);
void ChromeContentRendererClientCef::WebViewCreated(blink::WebView* web_view) {
ChromeContentRendererClient::WebViewCreated(web_view);
bool browser_created;
absl::optional<bool> is_windowless;
render_manager_->RenderViewCreated(render_view, browser_created,
is_windowless);
render_manager_->WebViewCreated(web_view, browser_created, is_windowless);
if (is_windowless.has_value() && *is_windowless) {
LOG(ERROR) << "The chrome runtime does not support windowless browsers";
}

View File

@@ -34,7 +34,7 @@ class ChromeContentRendererClientCef : public ChromeContentRendererClient {
void RenderThreadStarted() override;
void RenderThreadConnected() override;
void RenderFrameCreated(content::RenderFrame* render_frame) override;
void RenderViewCreated(content::RenderView* render_view) override;
void WebViewCreated(blink::WebView* web_view) override;
void DevToolsAgentAttached() override;
void DevToolsAgentDetached() override;
void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override;

View File

@@ -8,6 +8,7 @@
#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h"
#include "base/command_line.h"
#include "base/stl_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/renderer/extensions/extension_process_policy.h"
#include "chrome/renderer/extensions/resource_request_policy.h"

View File

@@ -279,15 +279,12 @@ std::unique_ptr<blink::WebURLLoader> CefFrameImpl::CreateURLLoader() {
if (!url_loader_factory_)
return nullptr;
// KeepAlive is not supported.
mojo::PendingRemote<blink::mojom::KeepAliveHandle> keep_alive_handle =
mojo::NullRemote();
return url_loader_factory_->CreateURLLoader(
blink::WebURLRequest(),
blink_glue::CreateResourceLoadingTaskRunnerHandle(frame_),
blink_glue::CreateResourceLoadingMaybeUnfreezableTaskRunnerHandle(frame_),
std::move(keep_alive_handle), blink::WebBackForwardCacheLoaderHelper());
/*keep_alive_handle=*/mojo::NullRemote(),
blink::WebBackForwardCacheLoaderHelper());
}
std::unique_ptr<blink::ResourceLoadInfoNotifierWrapper>
@@ -357,7 +354,7 @@ void CefFrameImpl::OnDraggableRegionsChanged() {
if (browser_frame) {
browser_frame->UpdateDraggableRegions(
regions.empty() ? absl::nullopt
: base::make_optional(std::move(regions)));
: absl::make_optional(std::move(regions)));
}
}

View File

@@ -110,11 +110,19 @@ void CefRenderManager::RenderFrameCreated(
}
}
void CefRenderManager::RenderViewCreated(content::RenderView* render_view,
bool& browser_created,
absl::optional<bool>& is_windowless) {
MaybeCreateBrowser(render_view, render_view->GetMainRenderFrame(),
&browser_created, &is_windowless);
void CefRenderManager::WebViewCreated(blink::WebView* web_view,
bool& browser_created,
absl::optional<bool>& is_windowless) {
auto render_view = content::RenderView::FromWebView(web_view);
CHECK(render_view);
content::RenderFrame* render_frame = nullptr;
if (web_view->MainFrame()->IsWebLocalFrame()) {
render_frame = content::RenderFrame::FromWebFrame(
web_view->MainFrame()->ToWebLocalFrame());
}
MaybeCreateBrowser(render_view, render_frame, &browser_created,
&is_windowless);
}
void CefRenderManager::DevToolsAgentAttached() {

View File

@@ -19,7 +19,8 @@
namespace blink {
class WebFrame;
}
class WebView;
} // namespace blink
namespace content {
class RenderFrame;
@@ -50,9 +51,9 @@ class CefRenderManager : public cef::mojom::RenderManager {
CefRenderFrameObserver* render_frame_observer,
bool& browser_created,
absl::optional<bool>& is_windowless);
void RenderViewCreated(content::RenderView* render_view,
bool& browser_created,
absl::optional<bool>& is_windowless);
void WebViewCreated(blink::WebView* web_view,
bool& browser_created,
absl::optional<bool>& is_windowless);
void DevToolsAgentAttached();
void DevToolsAgentDetached();
void ExposeInterfacesToBrowser(mojo::BinderMap* binders);