mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 82.0.4085.0 (#749737)
- Building on macOS now requires the 10.15 SDK. Xcode 11.3 is recommended as Xcode 11.4 is not currently supported (see https://crbug.com/1065146). - Jumbo build configuration is no longer supported. Chromium is skipping the M82 release and consequently no CEF 4085 branch will be created. For details on the Chromium decision see https://groups.google.com/a/chromium.org/d/msg/chromium-dev/Vn7uzglqLz0/JItlSrZxBAAJ
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
#include "services/network/public/mojom/cors_origin_pattern.mojom.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
@@ -47,6 +47,8 @@
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/favicon/core/favicon_url.h"
|
||||
#include "components/spellcheck/common/spellcheck_features.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
@@ -69,7 +71,6 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/favicon_url.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
@@ -1056,16 +1057,18 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
SpellcheckService* spellcheck = nullptr;
|
||||
content::BrowserContext* browser_context =
|
||||
web_contents()->GetBrowserContext();
|
||||
if (browser_context) {
|
||||
SpellcheckService* spellcheck =
|
||||
SpellcheckServiceFactory::GetForContext(browser_context);
|
||||
spellcheck = SpellcheckServiceFactory::GetForContext(browser_context);
|
||||
if (spellcheck)
|
||||
spellcheck->GetCustomDictionary()->AddWord(word);
|
||||
}
|
||||
#if defined(OS_MACOSX)
|
||||
spellcheck_platform::AddWord(word);
|
||||
if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
|
||||
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2679,15 +2682,14 @@ void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidUpdateFaviconURL(
|
||||
const std::vector<content::FaviconURL>& candidates) {
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
std::vector<CefString> icon_urls;
|
||||
std::vector<content::FaviconURL>::const_iterator it = candidates.begin();
|
||||
for (; it != candidates.end(); ++it) {
|
||||
if (it->icon_type == content::FaviconURL::IconType::kFavicon)
|
||||
icon_urls.push_back(it->icon_url.spec());
|
||||
for (const auto& icon : candidates) {
|
||||
if (icon->icon_type == blink::mojom::FaviconIconType::kFavicon)
|
||||
icon_urls.push_back(icon->icon_url.spec());
|
||||
}
|
||||
if (!icon_urls.empty())
|
||||
handler->OnFaviconURLChange(this, icon_urls);
|
||||
|
@@ -485,7 +485,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) override;
|
||||
void DidUpdateFaviconURL(
|
||||
const std::vector<content::FaviconURL>& candidates) override;
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
#include "services/service_manager/embedder/result_codes.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(USE_AURA) && defined(USE_X11)
|
||||
@@ -161,8 +160,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||
#endif
|
||||
|
||||
ui::MaterialDesignController::Initialize();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Initialize extension global objects before creating the global
|
||||
// BrowserContext.
|
||||
|
@@ -372,3 +372,8 @@ ChromeBrowserProcessStub::resource_coordinator_parts() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuildState* ChromeBrowserProcessStub::GetBuildState() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -98,6 +98,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
||||
override;
|
||||
BuildState* GetBuildState() override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
|
@@ -5,9 +5,35 @@
|
||||
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
|
||||
#include "components/variations/variations_client.h"
|
||||
#include "components/variations/variations_http_header_provider.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CefVariationsClient : public variations::VariationsClient {
|
||||
public:
|
||||
explicit CefVariationsClient(content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {}
|
||||
|
||||
~CefVariationsClient() override = default;
|
||||
|
||||
bool IsIncognito() const override {
|
||||
return browser_context_->IsOffTheRecord();
|
||||
}
|
||||
|
||||
std::string GetVariationsHeader() const override {
|
||||
return variations::VariationsHttpHeaderProvider::GetInstance()
|
||||
->GetClientDataHeader(false /* is_signed_in */);
|
||||
}
|
||||
|
||||
private:
|
||||
content::BrowserContext* browser_context_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeProfileStub::ChromeProfileStub() {}
|
||||
|
||||
ChromeProfileStub::~ChromeProfileStub() {}
|
||||
@@ -20,6 +46,12 @@ bool ChromeProfileStub::IsOffTheRecord() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
variations::VariationsClient* ChromeProfileStub::GetVariationsClient() {
|
||||
if (!variations_client_)
|
||||
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
||||
return variations_client_.get();
|
||||
}
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
||||
NOTREACHED();
|
||||
return scoped_refptr<base::SequencedTaskRunner>();
|
||||
|
@@ -22,6 +22,7 @@ class ChromeProfileStub : public Profile {
|
||||
// Profile methods.
|
||||
bool IsOffTheRecord() override;
|
||||
bool IsOffTheRecord() const override;
|
||||
variations::VariationsClient* GetVariationsClient() override;
|
||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||
std::string GetProfileUserName() const override;
|
||||
ProfileType GetProfileType() const override;
|
||||
@@ -48,6 +49,8 @@ class ChromeProfileStub : public Profile {
|
||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<variations::VariationsClient> variations_client_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
||||
};
|
||||
|
||||
|
@@ -115,6 +115,8 @@
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "services/service_manager/sandbox/switches.h"
|
||||
#include "storage/browser/quota/quota_settings.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"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@@ -505,6 +507,30 @@ void BindPluginInfoHost(
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
base::FilePath GetRootCachePath() {
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
return base::FilePath(
|
||||
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(
|
||||
service_manager::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
|
||||
|
||||
CefContentBrowserClient::CefContentBrowserClient()
|
||||
@@ -1088,16 +1114,13 @@ CefContentBrowserClient::CreateURLLoaderThrottles(
|
||||
request.resource_type, frame_tree_node_id));
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
bool is_off_the_record = profile->IsOffTheRecord();
|
||||
|
||||
chrome::mojom::DynamicParams dynamic_params = {
|
||||
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
||||
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps),
|
||||
variations::VariationsHttpHeaderProvider::GetInstance()
|
||||
->GetClientDataHeader(false /* is_signed_in */)};
|
||||
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||
is_off_the_record, std::move(dynamic_params)));
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps)};
|
||||
result.push_back(
|
||||
std::make_unique<GoogleURLLoaderThrottle>(std::move(dynamic_params)));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1300,10 +1323,7 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&CefContext::Get()->settings().root_cache_path));
|
||||
const auto& root_cache_path = GetRootCachePath();
|
||||
|
||||
// root_cache_path may sometimes be empty or a child of user_data_path, so
|
||||
// only return the one path in that case.
|
||||
@@ -1380,6 +1400,8 @@ CefContentBrowserClient::CreateWindowForPictureInPicture(
|
||||
void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
PopulateChromeFrameBinders(map);
|
||||
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
@@ -1404,6 +1426,11 @@ void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
extension);
|
||||
}
|
||||
|
||||
base::FilePath
|
||||
CefContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||
return GetRootCachePath();
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetProduct() {
|
||||
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
||||
return ::GetProduct();
|
||||
|
@@ -197,7 +197,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
||||
override;
|
||||
|
||||
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
std::string GetUserAgent() override;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "include/cef_context_menu_handler.h"
|
||||
#include "libcef/common/value_base.h"
|
||||
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
#include "content/public/browser/context_menu_params.h"
|
||||
|
||||
// CefContextMenuParams implementation. This class is not thread safe.
|
||||
class CefContextMenuParamsImpl
|
||||
|
@@ -167,7 +167,7 @@ void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
|
||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
|
@@ -55,7 +55,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
|
@@ -11,8 +11,8 @@
|
||||
#include "libcef/browser/menu_runner.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/browser/context_menu_params.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
|
@@ -258,10 +258,10 @@ void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
if (!event.os_event)
|
||||
return nullptr;
|
||||
return const_cast<CefEventHandle>(
|
||||
static_cast<CefEventHandle>(event.os_event->native_event()));
|
||||
// TODO(cef): We need to return an XEvent* from this method, but
|
||||
// |event.os_event->native_event()| now returns a ui::Event* instead.
|
||||
// See https://crbug.com/965991.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<CefMenuRunner>
|
||||
|
@@ -526,8 +526,7 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebWheelEvent(
|
||||
result.delta_y = deltaY;
|
||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
||||
result.delta_units =
|
||||
ui::input_types::ScrollGranularity::kScrollByPrecisePixel;
|
||||
result.delta_units = ui::ScrollGranularity::kScrollByPrecisePixel;
|
||||
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/events/x/x11_event_translation.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
|
||||
|
||||
@@ -28,13 +29,6 @@ const char kNetWMState[] = "_NET_WM_STATE";
|
||||
const char kXdndProxy[] = "XdndProxy";
|
||||
const char kUTF8String[] = "UTF8_STRING";
|
||||
|
||||
::Window FindEventTarget(const ui::PlatformEvent& xev) {
|
||||
::Window target = xev->xany.window;
|
||||
if (xev->type == GenericEvent)
|
||||
target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event;
|
||||
return target;
|
||||
}
|
||||
|
||||
::Window FindChild(::Display* display, ::Window window) {
|
||||
::Window root;
|
||||
::Window parent;
|
||||
@@ -109,8 +103,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||
CHECK(xwindow_);
|
||||
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->AddXEventDispatcher(this);
|
||||
|
||||
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
|
||||
XSelectInput(xdisplay_, xwindow_, event_mask);
|
||||
@@ -148,8 +142,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
|
||||
CefWindowX11::~CefWindowX11() {
|
||||
DCHECK(!xwindow_);
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->RemoveXEventDispatcher(this);
|
||||
}
|
||||
|
||||
void CefWindowX11::Close() {
|
||||
@@ -288,12 +282,88 @@ views::DesktopWindowTreeHostX11* CefWindowX11::GetHost() {
|
||||
}
|
||||
|
||||
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
|
||||
::Window target = FindEventTarget(event);
|
||||
return target == xwindow_;
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
return !!current_xevent_;
|
||||
}
|
||||
|
||||
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
XEvent* xev = event;
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
DCHECK(event);
|
||||
DCHECK(current_xevent_);
|
||||
|
||||
ProcessXEvent(current_xevent_);
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
// Called by X11EventSourceLibevent to determine whether this XEventDispatcher
|
||||
// implementation is able to process the next translated event sent by it.
|
||||
void CefWindowX11::CheckCanDispatchNextPlatformEvent(XEvent* xev) {
|
||||
current_xevent_ = IsTargetedBy(*xev) ? xev : nullptr;
|
||||
}
|
||||
|
||||
void CefWindowX11::PlatformEventDispatchFinished() {
|
||||
current_xevent_ = nullptr;
|
||||
}
|
||||
|
||||
ui::PlatformEventDispatcher* CefWindowX11::GetPlatformEventDispatcher() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool CefWindowX11::DispatchXEvent(XEvent* xev) {
|
||||
if (!IsTargetedBy(*xev))
|
||||
return false;
|
||||
ProcessXEvent(xev);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
||||
bool CefWindowX11::IsTargetedBy(const XEvent& xev) const {
|
||||
::Window target_window =
|
||||
(xev.type == GenericEvent)
|
||||
? static_cast<XIDeviceEvent*>(xev.xcookie.data)->event
|
||||
: xev.xany.window;
|
||||
return target_window == xwindow_;
|
||||
}
|
||||
|
||||
void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
switch (xev->type) {
|
||||
case ConfigureNotify: {
|
||||
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
||||
@@ -402,45 +472,4 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ typedef struct _XDisplay Display;
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "ui/events/platform/platform_event_dispatcher.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
@@ -25,7 +26,8 @@ class DesktopWindowTreeHostX11;
|
||||
|
||||
// Object wrapper for an X11 Window.
|
||||
// Based on WindowTreeHostX11 and DesktopWindowTreeHostX11.
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
public ui::XEventDispatcher {
|
||||
public:
|
||||
CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
::Window parent_xwindow,
|
||||
@@ -50,6 +52,12 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
||||
uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
|
||||
|
||||
// ui::XEventDispatcher methods:
|
||||
void CheckCanDispatchNextPlatformEvent(XEvent* xev) override;
|
||||
void PlatformEventDispatchFinished() override;
|
||||
ui::PlatformEventDispatcher* GetPlatformEventDispatcher() override;
|
||||
bool DispatchXEvent(XEvent* event) override;
|
||||
|
||||
::Window xwindow() const { return xwindow_; }
|
||||
gfx::Rect bounds() const { return bounds_; }
|
||||
|
||||
@@ -58,6 +66,9 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
private:
|
||||
void ContinueFocus();
|
||||
|
||||
bool IsTargetedBy(const XEvent& xev) const;
|
||||
void ProcessXEvent(XEvent* xev);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
|
||||
// The display and the native X window hosting the root window.
|
||||
@@ -73,6 +84,11 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
|
||||
bool focus_pending_;
|
||||
|
||||
// Tells if this dispatcher can process next translated event based on a
|
||||
// previous check in ::CheckCanDispatchNextPlatformEvent based on a XID
|
||||
// target.
|
||||
XEvent* current_xevent_ = nullptr;
|
||||
|
||||
// Must always be the last member.
|
||||
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_status_code.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
@@ -1202,8 +1203,8 @@ void InitOnUIThread(
|
||||
if (request.render_frame_id >= 0) {
|
||||
// TODO(network): Are these main frame checks equivalent?
|
||||
if (request.is_main_frame ||
|
||||
static_cast<content::ResourceType>(request.resource_type) ==
|
||||
content::ResourceType::kMainFrame) {
|
||||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||
blink::mojom::ResourceType::kMainFrame) {
|
||||
frame = web_contents->GetMainFrame();
|
||||
DCHECK(frame);
|
||||
} else {
|
||||
|
@@ -55,7 +55,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);
|
||||
&maybe_proxy_factory_request, nullptr /* factory_override */);
|
||||
}
|
||||
|
||||
// Allow the Content embedder to inject itself if it wants to.
|
||||
|
@@ -25,10 +25,8 @@
|
||||
#include "components/viz/common/frame_sinks/begin_frame_args.h"
|
||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||
#include "components/viz/common/gl_helper.h"
|
||||
#include "components/viz/common/switches.h"
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
||||
#include "content/browser/renderer_host/cursor_manager.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
@@ -48,7 +46,6 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "media/base/video_frame.h"
|
||||
#include "ui/base/cursor/types/cursor_types.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/events/blink/blink_event_util.h"
|
||||
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
|
||||
@@ -236,15 +233,11 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
|
||||
external_begin_frame_enabled_ = use_external_begin_frame;
|
||||
|
||||
content::ImageTransportFactory* factory =
|
||||
content::ImageTransportFactory::GetInstance();
|
||||
ui::ContextFactoryPrivate* context_factory_private =
|
||||
factory->GetContextFactoryPrivate();
|
||||
auto context_factory = content::GetContextFactory();
|
||||
|
||||
// Matching the attributes from RecyclableCompositorMac.
|
||||
compositor_.reset(new ui::Compositor(
|
||||
context_factory_private->AllocateFrameSinkId(),
|
||||
content::GetContextFactory(), context_factory_private,
|
||||
context_factory->AllocateFrameSinkId(), context_factory,
|
||||
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
|
||||
use_external_begin_frame));
|
||||
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
|
||||
@@ -447,8 +440,9 @@ base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::LockMouse(bool request_unadjusted_movement) {
|
||||
return false;
|
||||
blink::mojom::PointerLockResult CefRenderWidgetHostViewOSR::LockMouse(
|
||||
bool request_unadjusted_movement) {
|
||||
return blink::mojom::PointerLockResult::kPermissionDenied;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UnlockMouse() {}
|
||||
@@ -588,39 +582,29 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
browser_impl_->GetClient()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
const content::CursorInfo& cursor_info = cursor.info();
|
||||
const auto& ui_cursor = cursor.cursor();
|
||||
|
||||
const cef_cursor_type_t cursor_type =
|
||||
static_cast<cef_cursor_type_t>(cursor_info.type);
|
||||
static_cast<cef_cursor_type_t>(ui_cursor.type());
|
||||
CefCursorInfo custom_cursor_info;
|
||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
||||
custom_cursor_info.hotspot.x = cursor_info.hotspot.x();
|
||||
custom_cursor_info.hotspot.y = cursor_info.hotspot.y();
|
||||
custom_cursor_info.image_scale_factor = cursor_info.image_scale_factor;
|
||||
custom_cursor_info.buffer = cursor_info.custom_image.getPixels();
|
||||
custom_cursor_info.size.width = cursor_info.custom_image.width();
|
||||
custom_cursor_info.size.height = cursor_info.custom_image.height();
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
custom_cursor_info.hotspot.x = ui_cursor.custom_hotspot().x();
|
||||
custom_cursor_info.hotspot.y = ui_cursor.custom_hotspot().y();
|
||||
custom_cursor_info.image_scale_factor = ui_cursor.image_scale_factor();
|
||||
custom_cursor_info.buffer = ui_cursor.custom_bitmap().getPixels();
|
||||
custom_cursor_info.size.width = ui_cursor.custom_bitmap().width();
|
||||
custom_cursor_info.size.height = ui_cursor.custom_bitmap().height();
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
content::WebCursor web_cursor(cursor_info);
|
||||
content::WebCursor web_cursor(ui_cursor);
|
||||
|
||||
ui::PlatformCursor platform_cursor;
|
||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
||||
ui::Cursor ui_cursor(ui::CursorType::kCustom);
|
||||
SkBitmap bitmap;
|
||||
gfx::Point hotspot;
|
||||
float scale_factor;
|
||||
web_cursor.CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot,
|
||||
&scale_factor);
|
||||
ui_cursor.set_custom_bitmap(bitmap);
|
||||
ui_cursor.set_custom_hotspot(hotspot);
|
||||
ui_cursor.set_device_scale_factor(scale_factor);
|
||||
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
// |web_cursor| owns the resulting |platform_cursor|.
|
||||
platform_cursor = web_cursor.GetPlatformCursor(ui_cursor);
|
||||
} else {
|
||||
platform_cursor = GetPlatformCursor(cursor_info.type);
|
||||
platform_cursor = GetPlatformCursor(ui_cursor.type());
|
||||
}
|
||||
|
||||
handler->OnCursorChange(browser_impl_.get(), platform_cursor, cursor_type,
|
||||
@@ -1065,8 +1049,8 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
||||
|
||||
compositor_->context_factory_private()->IssueExternalBeginFrame(
|
||||
compositor_.get(), begin_frame_args, /* force= */ true,
|
||||
compositor_->IssueExternalBeginFrame(
|
||||
begin_frame_args, /* force= */ true,
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/browser/renderer_host/text_input_manager.h"
|
||||
#include "content/public/common/widget_type.h"
|
||||
#include "ui/base/cursor/types/cursor_types.h"
|
||||
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
|
||||
@@ -49,7 +49,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#endif
|
||||
|
||||
@@ -124,7 +123,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
base::Optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
bool LockMouse(bool request_unadjusted_movement) override;
|
||||
blink::mojom::PointerLockResult LockMouse(
|
||||
bool request_unadjusted_movement) override;
|
||||
void UnlockMouse() override;
|
||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||
|
||||
@@ -321,7 +321,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void UpdateBackgroundColorFromRenderer(SkColor color);
|
||||
|
||||
#if defined(USE_AURA)
|
||||
ui::PlatformCursor GetPlatformCursor(ui::CursorType type);
|
||||
ui::PlatformCursor GetPlatformCursor(ui::mojom::CursorType type);
|
||||
#endif
|
||||
|
||||
// The background color of the web content.
|
||||
|
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
@@ -23,110 +21,108 @@ namespace {
|
||||
|
||||
// Based on ui/base/cursor/cursor_loader_x11.cc.
|
||||
|
||||
using blink::WebCursorInfo;
|
||||
|
||||
int ToCursorID(ui::CursorType type) {
|
||||
int ToCursorID(ui::mojom::CursorType type) {
|
||||
switch (type) {
|
||||
case ui::CursorType::kPointer:
|
||||
case ui::mojom::CursorType::kPointer:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kCross:
|
||||
case ui::mojom::CursorType::kCross:
|
||||
return XC_crosshair;
|
||||
case ui::CursorType::kHand:
|
||||
case ui::mojom::CursorType::kHand:
|
||||
return XC_hand2;
|
||||
case ui::CursorType::kIBeam:
|
||||
case ui::mojom::CursorType::kIBeam:
|
||||
return XC_xterm;
|
||||
case ui::CursorType::kWait:
|
||||
case ui::mojom::CursorType::kWait:
|
||||
return XC_watch;
|
||||
case ui::CursorType::kHelp:
|
||||
case ui::mojom::CursorType::kHelp:
|
||||
return XC_question_arrow;
|
||||
case ui::CursorType::kEastResize:
|
||||
case ui::mojom::CursorType::kEastResize:
|
||||
return XC_right_side;
|
||||
case ui::CursorType::kNorthResize:
|
||||
case ui::mojom::CursorType::kNorthResize:
|
||||
return XC_top_side;
|
||||
case ui::CursorType::kNorthEastResize:
|
||||
case ui::mojom::CursorType::kNorthEastResize:
|
||||
return XC_top_right_corner;
|
||||
case ui::CursorType::kNorthWestResize:
|
||||
case ui::mojom::CursorType::kNorthWestResize:
|
||||
return XC_top_left_corner;
|
||||
case ui::CursorType::kSouthResize:
|
||||
case ui::mojom::CursorType::kSouthResize:
|
||||
return XC_bottom_side;
|
||||
case ui::CursorType::kSouthEastResize:
|
||||
case ui::mojom::CursorType::kSouthEastResize:
|
||||
return XC_bottom_right_corner;
|
||||
case ui::CursorType::kSouthWestResize:
|
||||
case ui::mojom::CursorType::kSouthWestResize:
|
||||
return XC_bottom_left_corner;
|
||||
case ui::CursorType::kWestResize:
|
||||
case ui::mojom::CursorType::kWestResize:
|
||||
return XC_left_side;
|
||||
case ui::CursorType::kNorthSouthResize:
|
||||
case ui::mojom::CursorType::kNorthSouthResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case ui::CursorType::kEastWestResize:
|
||||
case ui::mojom::CursorType::kEastWestResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case ui::CursorType::kNorthEastSouthWestResize:
|
||||
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kNorthWestSouthEastResize:
|
||||
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kColumnResize:
|
||||
case ui::mojom::CursorType::kColumnResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case ui::CursorType::kRowResize:
|
||||
case ui::mojom::CursorType::kRowResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case ui::CursorType::kMiddlePanning:
|
||||
case ui::mojom::CursorType::kMiddlePanning:
|
||||
return XC_fleur;
|
||||
case ui::CursorType::kEastPanning:
|
||||
case ui::mojom::CursorType::kEastPanning:
|
||||
return XC_sb_right_arrow;
|
||||
case ui::CursorType::kNorthPanning:
|
||||
case ui::mojom::CursorType::kNorthPanning:
|
||||
return XC_sb_up_arrow;
|
||||
case ui::CursorType::kNorthEastPanning:
|
||||
case ui::mojom::CursorType::kNorthEastPanning:
|
||||
return XC_top_right_corner;
|
||||
case ui::CursorType::kNorthWestPanning:
|
||||
case ui::mojom::CursorType::kNorthWestPanning:
|
||||
return XC_top_left_corner;
|
||||
case ui::CursorType::kSouthPanning:
|
||||
case ui::mojom::CursorType::kSouthPanning:
|
||||
return XC_sb_down_arrow;
|
||||
case ui::CursorType::kSouthEastPanning:
|
||||
case ui::mojom::CursorType::kSouthEastPanning:
|
||||
return XC_bottom_right_corner;
|
||||
case ui::CursorType::kSouthWestPanning:
|
||||
case ui::mojom::CursorType::kSouthWestPanning:
|
||||
return XC_bottom_left_corner;
|
||||
case ui::CursorType::kWestPanning:
|
||||
case ui::mojom::CursorType::kWestPanning:
|
||||
return XC_sb_left_arrow;
|
||||
case ui::CursorType::kMove:
|
||||
case ui::mojom::CursorType::kMove:
|
||||
return XC_fleur;
|
||||
case ui::CursorType::kVerticalText:
|
||||
case ui::mojom::CursorType::kVerticalText:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kCell:
|
||||
case ui::mojom::CursorType::kCell:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kContextMenu:
|
||||
case ui::mojom::CursorType::kContextMenu:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kAlias:
|
||||
case ui::mojom::CursorType::kAlias:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kProgress:
|
||||
case ui::mojom::CursorType::kProgress:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kNoDrop:
|
||||
case ui::mojom::CursorType::kNoDrop:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kCopy:
|
||||
case ui::mojom::CursorType::kCopy:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kNotAllowed:
|
||||
case ui::mojom::CursorType::kNotAllowed:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kZoomIn:
|
||||
case ui::mojom::CursorType::kZoomIn:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kZoomOut:
|
||||
case ui::mojom::CursorType::kZoomOut:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kGrab:
|
||||
case ui::mojom::CursorType::kGrab:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kGrabbing:
|
||||
case ui::mojom::CursorType::kGrabbing:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kMiddlePanningVertical:
|
||||
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kMiddlePanningHorizontal:
|
||||
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kDndNone:
|
||||
case ui::mojom::CursorType::kDndNone:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kDndMove:
|
||||
case ui::mojom::CursorType::kDndMove:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kDndCopy:
|
||||
case ui::mojom::CursorType::kDndCopy:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kDndLink:
|
||||
case ui::mojom::CursorType::kDndLink:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kNull:
|
||||
case ui::mojom::CursorType::kNull:
|
||||
return XC_left_ptr;
|
||||
case ui::CursorType::kCustom:
|
||||
case ui::CursorType::kNone:
|
||||
case ui::mojom::CursorType::kCustom:
|
||||
case ui::mojom::CursorType::kNone:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
@@ -184,9 +180,9 @@ XCursorCache* cursor_cache = nullptr;
|
||||
#endif // defined(USE_X11)
|
||||
|
||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
ui::CursorType type) {
|
||||
ui::mojom::CursorType type) {
|
||||
#if defined(USE_X11)
|
||||
if (type == ui::CursorType::kNone) {
|
||||
if (type == ui::mojom::CursorType::kNone) {
|
||||
if (!invisible_cursor_) {
|
||||
invisible_cursor_.reset(new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
||||
gfx::GetXDisplay()));
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "ui/resources/grit/ui_unscaled_resources.h"
|
||||
|
||||
namespace {
|
||||
@@ -39,112 +38,110 @@ class CefCompositorHostWin : public gfx::WindowImpl {
|
||||
|
||||
// From content/common/cursors/webcursor_win.cc.
|
||||
|
||||
using blink::WebCursorInfo;
|
||||
|
||||
LPCWSTR ToCursorID(ui::CursorType type) {
|
||||
LPCWSTR ToCursorID(ui::mojom::CursorType type) {
|
||||
switch (type) {
|
||||
case ui::CursorType::kPointer:
|
||||
case ui::mojom::CursorType::kPointer:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kCross:
|
||||
case ui::mojom::CursorType::kCross:
|
||||
return IDC_CROSS;
|
||||
case ui::CursorType::kHand:
|
||||
case ui::mojom::CursorType::kHand:
|
||||
return IDC_HAND;
|
||||
case ui::CursorType::kIBeam:
|
||||
case ui::mojom::CursorType::kIBeam:
|
||||
return IDC_IBEAM;
|
||||
case ui::CursorType::kWait:
|
||||
case ui::mojom::CursorType::kWait:
|
||||
return IDC_WAIT;
|
||||
case ui::CursorType::kHelp:
|
||||
case ui::mojom::CursorType::kHelp:
|
||||
return IDC_HELP;
|
||||
case ui::CursorType::kEastResize:
|
||||
case ui::mojom::CursorType::kEastResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::CursorType::kNorthResize:
|
||||
case ui::mojom::CursorType::kNorthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::CursorType::kNorthEastResize:
|
||||
case ui::mojom::CursorType::kNorthEastResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::CursorType::kNorthWestResize:
|
||||
case ui::mojom::CursorType::kNorthWestResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::CursorType::kSouthResize:
|
||||
case ui::mojom::CursorType::kSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::CursorType::kSouthEastResize:
|
||||
case ui::mojom::CursorType::kSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::CursorType::kSouthWestResize:
|
||||
case ui::mojom::CursorType::kSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::CursorType::kWestResize:
|
||||
case ui::mojom::CursorType::kWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::CursorType::kNorthSouthResize:
|
||||
case ui::mojom::CursorType::kNorthSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::CursorType::kEastWestResize:
|
||||
case ui::mojom::CursorType::kEastWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::CursorType::kNorthEastSouthWestResize:
|
||||
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::CursorType::kNorthWestSouthEastResize:
|
||||
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::CursorType::kColumnResize:
|
||||
case ui::mojom::CursorType::kColumnResize:
|
||||
return MAKEINTRESOURCE(IDC_COLRESIZE);
|
||||
case ui::CursorType::kRowResize:
|
||||
case ui::mojom::CursorType::kRowResize:
|
||||
return MAKEINTRESOURCE(IDC_ROWRESIZE);
|
||||
case ui::CursorType::kMiddlePanning:
|
||||
case ui::mojom::CursorType::kMiddlePanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
|
||||
case ui::CursorType::kEastPanning:
|
||||
case ui::mojom::CursorType::kEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_EAST);
|
||||
case ui::CursorType::kNorthPanning:
|
||||
case ui::mojom::CursorType::kNorthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH);
|
||||
case ui::CursorType::kNorthEastPanning:
|
||||
case ui::mojom::CursorType::kNorthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
|
||||
case ui::CursorType::kNorthWestPanning:
|
||||
case ui::mojom::CursorType::kNorthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
|
||||
case ui::CursorType::kSouthPanning:
|
||||
case ui::mojom::CursorType::kSouthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
|
||||
case ui::CursorType::kSouthEastPanning:
|
||||
case ui::mojom::CursorType::kSouthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
|
||||
case ui::CursorType::kSouthWestPanning:
|
||||
case ui::mojom::CursorType::kSouthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
|
||||
case ui::CursorType::kWestPanning:
|
||||
case ui::mojom::CursorType::kWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_WEST);
|
||||
case ui::CursorType::kMove:
|
||||
case ui::mojom::CursorType::kMove:
|
||||
return IDC_SIZEALL;
|
||||
case ui::CursorType::kVerticalText:
|
||||
case ui::mojom::CursorType::kVerticalText:
|
||||
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
|
||||
case ui::CursorType::kCell:
|
||||
case ui::mojom::CursorType::kCell:
|
||||
return MAKEINTRESOURCE(IDC_CELL);
|
||||
case ui::CursorType::kContextMenu:
|
||||
case ui::mojom::CursorType::kContextMenu:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kAlias:
|
||||
case ui::mojom::CursorType::kAlias:
|
||||
return MAKEINTRESOURCE(IDC_ALIAS);
|
||||
case ui::CursorType::kProgress:
|
||||
case ui::mojom::CursorType::kProgress:
|
||||
return IDC_APPSTARTING;
|
||||
case ui::CursorType::kNoDrop:
|
||||
case ui::mojom::CursorType::kNoDrop:
|
||||
return IDC_NO;
|
||||
case ui::CursorType::kCopy:
|
||||
case ui::mojom::CursorType::kCopy:
|
||||
return MAKEINTRESOURCE(IDC_COPYCUR);
|
||||
case ui::CursorType::kNone:
|
||||
case ui::mojom::CursorType::kNone:
|
||||
return MAKEINTRESOURCE(IDC_CURSOR_NONE);
|
||||
case ui::CursorType::kNotAllowed:
|
||||
case ui::mojom::CursorType::kNotAllowed:
|
||||
return IDC_NO;
|
||||
case ui::CursorType::kZoomIn:
|
||||
case ui::mojom::CursorType::kZoomIn:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMIN);
|
||||
case ui::CursorType::kZoomOut:
|
||||
case ui::mojom::CursorType::kZoomOut:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMOUT);
|
||||
case ui::CursorType::kGrab:
|
||||
case ui::mojom::CursorType::kGrab:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||
case ui::CursorType::kGrabbing:
|
||||
case ui::mojom::CursorType::kGrabbing:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||
case ui::CursorType::kNull:
|
||||
case ui::mojom::CursorType::kNull:
|
||||
return IDC_NO;
|
||||
case ui::CursorType::kMiddlePanningVertical:
|
||||
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_VERTICAL);
|
||||
case ui::CursorType::kMiddlePanningHorizontal:
|
||||
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_HORIZONTAL);
|
||||
// TODO(cef): Find better cursors for these things
|
||||
case ui::CursorType::kDndNone:
|
||||
case ui::mojom::CursorType::kDndNone:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kDndMove:
|
||||
case ui::mojom::CursorType::kDndMove:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kDndCopy:
|
||||
case ui::mojom::CursorType::kDndCopy:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kDndLink:
|
||||
case ui::mojom::CursorType::kDndLink:
|
||||
return IDC_ARROW;
|
||||
case ui::CursorType::kCustom:
|
||||
case ui::mojom::CursorType::kCustom:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
@@ -158,7 +155,7 @@ bool IsSystemCursorID(LPCWSTR cursor_id) {
|
||||
} // namespace
|
||||
|
||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
ui::CursorType type) {
|
||||
ui::mojom::CursorType type) {
|
||||
HMODULE module_handle = NULL;
|
||||
const wchar_t* cursor_id = ToCursorID(type);
|
||||
if (!IsSystemCursorID(cursor_id)) {
|
||||
|
@@ -29,8 +29,11 @@ void CefWebContentsViewOSR::WebContentsCreated(
|
||||
DCHECK(!web_contents_);
|
||||
web_contents_ = web_contents;
|
||||
|
||||
// Call this again for popup browsers now that the view should exist.
|
||||
RenderViewCreated(web_contents_->GetRenderViewHost());
|
||||
auto host = web_contents_->GetRenderViewHost();
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||
@@ -123,15 +126,6 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
|
||||
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
if (!host)
|
||||
return;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewReady() {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
|
@@ -50,7 +50,6 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const base::string16& title) override;
|
||||
void RenderViewCreated(content::RenderViewHost* host) override;
|
||||
void RenderViewReady() override;
|
||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||
content::RenderViewHost* new_host) override;
|
||||
|
@@ -784,7 +784,7 @@ void CefMainDelegate::PreSandboxStartup() {
|
||||
crash_reporting::PreSandboxStartup(*command_line, process_type);
|
||||
|
||||
InitializeResourceBundle();
|
||||
InitializePDF();
|
||||
MaybeInitializeGDI();
|
||||
}
|
||||
|
||||
void CefMainDelegate::SandboxInitialized(const std::string& process_type) {
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/resource_type.h"
|
||||
#include "net/base/elements_upload_data_stream.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
@@ -38,6 +37,7 @@
|
||||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "services/network/public/cpp/resource_request_body.h"
|
||||
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h"
|
||||
#include "third_party/blink/public/platform/web_http_body.h"
|
||||
#include "third_party/blink/public/platform/web_security_origin.h"
|
||||
#include "third_party/blink/public/platform/web_string.h"
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
@@ -207,17 +207,6 @@ void GetHeaderMap(const CefRequest::HeaderMap& source,
|
||||
}
|
||||
}
|
||||
|
||||
// Read |map| into |request|.
|
||||
void SetHeaderMap(const CefRequest::HeaderMap& map,
|
||||
blink::WebURLRequest& request) {
|
||||
CefRequest::HeaderMap::const_iterator it = map.begin();
|
||||
for (; it != map.end(); ++it) {
|
||||
request.SetHttpHeaderField(
|
||||
blink::WebString::FromUTF16(it->first.ToString16()),
|
||||
blink::WebString::FromUTF16(it->second.ToString16()));
|
||||
}
|
||||
}
|
||||
|
||||
// Type used in UploadDataStream.
|
||||
typedef std::vector<std::unique_ptr<net::UploadElementReader>>
|
||||
UploadElementReaders;
|
||||
@@ -610,63 +599,6 @@ void CefRequestImpl::Set(
|
||||
static_cast<cef_transition_type_t>(params.transition_type());
|
||||
}
|
||||
|
||||
void CefRequestImpl::Get(blink::WebURLRequest& request,
|
||||
int64& upload_data_size) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
request.SetRequestContext(blink::mojom::RequestContextType::INTERNAL);
|
||||
request.SetUrl(url_);
|
||||
request.SetHttpMethod(blink::WebString::FromUTF8(method_));
|
||||
|
||||
if (!referrer_url_.is_empty()) {
|
||||
const blink::WebString& referrer =
|
||||
blink::WebSecurityPolicy::GenerateReferrerHeader(
|
||||
NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_), url_,
|
||||
blink::WebString::FromUTF8(referrer_url_.spec()));
|
||||
if (!referrer.IsEmpty()) {
|
||||
request.SetReferrerString(referrer);
|
||||
request.SetReferrerPolicy(
|
||||
NetReferrerPolicyToBlinkReferrerPolicy(referrer_policy_));
|
||||
}
|
||||
}
|
||||
|
||||
if (postdata_.get()) {
|
||||
blink::WebHTTPBody body;
|
||||
body.Initialize();
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->Get(body);
|
||||
request.SetHttpBody(body);
|
||||
|
||||
if (flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) {
|
||||
// Attempt to determine the upload data size.
|
||||
CefPostData::ElementVector elements;
|
||||
postdata_->GetElements(elements);
|
||||
if (elements.size() == 1 && elements[0]->GetType() == PDE_TYPE_BYTES) {
|
||||
CefPostDataElementImpl* impl =
|
||||
static_cast<CefPostDataElementImpl*>(elements[0].get());
|
||||
upload_data_size = impl->GetBytesCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::SetHeaderMap(headermap_, request);
|
||||
|
||||
if (!site_for_cookies_.IsNull())
|
||||
request.SetSiteForCookies(site_for_cookies_);
|
||||
|
||||
int flags = flags_;
|
||||
if (!(flags & kURCachePolicyMask)) {
|
||||
// Only consider the Cache-Control directives when a cache policy is not
|
||||
// explicitly set on the request.
|
||||
flags |= GetCacheControlHeaderPolicy(headermap_);
|
||||
}
|
||||
request.SetCacheMode(GetFetchCacheMode(flags));
|
||||
|
||||
SETBOOLFLAG(request, flags_, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_STORED_CREDENTIALS);
|
||||
SETBOOLFLAG(request, flags_, SetReportUploadProgress,
|
||||
UR_FLAG_REPORT_UPLOAD_PROGRESS);
|
||||
}
|
||||
|
||||
// static
|
||||
void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
||||
blink::WebURLRequest& request) {
|
||||
@@ -867,8 +799,7 @@ CefRequestImpl::NetReferrerPolicyToBlinkReferrerPolicy(
|
||||
case REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE:
|
||||
return network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade;
|
||||
case REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN:
|
||||
return network::mojom::ReferrerPolicy::
|
||||
kNoReferrerWhenDowngradeOriginWhenCrossOrigin;
|
||||
return network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin;
|
||||
case REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN:
|
||||
return network::mojom::ReferrerPolicy::kOriginWhenCrossOrigin;
|
||||
case REFERRER_POLICY_NEVER_CLEAR_REFERRER:
|
||||
@@ -892,8 +823,7 @@ cef_referrer_policy_t CefRequestImpl::BlinkReferrerPolicyToNetReferrerPolicy(
|
||||
switch (blink_policy) {
|
||||
case network::mojom::ReferrerPolicy::kNoReferrerWhenDowngrade:
|
||||
return REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE;
|
||||
case network::mojom::ReferrerPolicy::
|
||||
kNoReferrerWhenDowngradeOriginWhenCrossOrigin:
|
||||
case network::mojom::ReferrerPolicy::kStrictOriginWhenCrossOrigin:
|
||||
return REFERRER_POLICY_REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN;
|
||||
case network::mojom::ReferrerPolicy::kOriginWhenCrossOrigin:
|
||||
return REFERRER_POLICY_ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN;
|
||||
@@ -1182,42 +1112,6 @@ std::unique_ptr<net::UploadDataStream> CefPostDataImpl::Get() const {
|
||||
std::move(element_readers), 0);
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Set(const blink::WebHTTPBody& data) {
|
||||
{
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostDataElement> postelem;
|
||||
blink::WebHTTPBody::Element element;
|
||||
size_t size = data.ElementCount();
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (data.ElementAt(i, element)) {
|
||||
postelem = CefPostDataElement::Create();
|
||||
static_cast<CefPostDataElementImpl*>(postelem.get())->Set(element);
|
||||
AddElement(postelem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataImpl::Get(blink::WebHTTPBody& data) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
blink::WebHTTPBody::Element element;
|
||||
ElementVector::const_iterator it = elements_.begin();
|
||||
for (; it != elements_.end(); ++it) {
|
||||
static_cast<CefPostDataElementImpl*>(it->get())->Get(element);
|
||||
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
|
||||
data.AppendData(element.data);
|
||||
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
|
||||
data.AppendFileRange(element.file_path, element.file_start,
|
||||
element.file_length, element.modification_time);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataImpl::SetReadOnly(bool read_only) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
if (read_only_ == read_only)
|
||||
@@ -1470,45 +1364,6 @@ std::unique_ptr<net::UploadElementReader> CefPostDataElementImpl::Get() const {
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
|
||||
{
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
}
|
||||
|
||||
if (element.type == blink::WebHTTPBody::Element::kTypeData) {
|
||||
std::string file_contents;
|
||||
file_contents.reserve(element.data.size());
|
||||
element.data.ForEachSegment([&file_contents](const char* segment,
|
||||
size_t segment_size,
|
||||
size_t segment_offset) {
|
||||
file_contents.append(segment, segment_size);
|
||||
return true;
|
||||
});
|
||||
SetToBytes(file_contents.size(), file_contents.data());
|
||||
} else if (element.type == blink::WebHTTPBody::Element::kTypeFile) {
|
||||
SetToFile(element.file_path.Utf16());
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (type_ == PDE_TYPE_BYTES) {
|
||||
element.type = blink::WebHTTPBody::Element::kTypeData;
|
||||
element.data.Assign(static_cast<char*>(data_.bytes.bytes),
|
||||
data_.bytes.size);
|
||||
} else if (type_ == PDE_TYPE_FILE) {
|
||||
element.type = blink::WebHTTPBody::Element::kTypeFile;
|
||||
element.file_path =
|
||||
blink::WebString::FromUTF16(CefString(&data_.filename).ToString16());
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void CefPostDataElementImpl::SetReadOnly(bool read_only) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
if (read_only_ == read_only)
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "net/cookies/site_for_cookies.h"
|
||||
#include "services/network/public/mojom/referrer_policy.mojom-shared.h"
|
||||
#include "third_party/blink/public/platform/web_http_body.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace blink {
|
||||
@@ -109,10 +108,6 @@ class CefRequestImpl : public CefRequest {
|
||||
void Set(const navigation_interception::NavigationParams& params,
|
||||
bool is_main_frame);
|
||||
|
||||
// Populate the WebURLRequest object from this object.
|
||||
// Called from CefRenderURLRequest::Context::Start().
|
||||
void Get(blink::WebURLRequest& request, int64& upload_data_size) const;
|
||||
|
||||
// Populate the WebURLRequest object based on the contents of |params|.
|
||||
// Called from CefBrowserImpl::LoadRequest().
|
||||
static void Get(const CefMsg_LoadRequest_Params& params,
|
||||
@@ -217,8 +212,6 @@ class CefPostDataImpl : public CefPostData {
|
||||
void Set(const net::UploadDataStream& data_stream);
|
||||
void Get(net::UploadData& data) const;
|
||||
std::unique_ptr<net::UploadDataStream> Get() const;
|
||||
void Set(const blink::WebHTTPBody& data);
|
||||
void Get(blink::WebHTTPBody& data) const;
|
||||
|
||||
void SetReadOnly(bool read_only);
|
||||
|
||||
@@ -270,8 +263,6 @@ class CefPostDataElementImpl : public CefPostDataElement {
|
||||
void Set(const net::UploadElementReader& element_reader);
|
||||
void Get(net::UploadElement& element) const;
|
||||
std::unique_ptr<net::UploadElementReader> Get() const;
|
||||
void Set(const blink::WebHTTPBody::Element& element);
|
||||
void Get(blink::WebHTTPBody::Element& element) const;
|
||||
|
||||
void SetReadOnly(bool read_only);
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/thread_annotations.h"
|
||||
#include "base/threading/platform_thread.h"
|
||||
|
||||
// Controller implementation base class.
|
||||
@@ -142,11 +143,11 @@ class CefValueControllerThreadSafe : public CefValueController {
|
||||
// CefValueController methods.
|
||||
bool thread_safe() override { return true; }
|
||||
bool on_correct_thread() override { return true; }
|
||||
void lock() override {
|
||||
void lock() override NO_THREAD_SAFETY_ANALYSIS {
|
||||
lock_.Acquire();
|
||||
locked_thread_id_ = base::PlatformThread::CurrentId();
|
||||
}
|
||||
void unlock() override {
|
||||
void unlock() override NO_THREAD_SAFETY_ANALYSIS {
|
||||
locked_thread_id_ = 0;
|
||||
lock_.Release();
|
||||
}
|
||||
|
@@ -378,7 +378,7 @@ CefValueController* CefValueImpl::GetValueController() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefValueImpl::AcquireLock() {
|
||||
void CefValueImpl::AcquireLock() NO_THREAD_SAFETY_ANALYSIS {
|
||||
lock_.Acquire();
|
||||
|
||||
CefValueController* controller = GetValueController();
|
||||
@@ -386,7 +386,7 @@ void CefValueImpl::AcquireLock() {
|
||||
controller->lock();
|
||||
}
|
||||
|
||||
void CefValueImpl::ReleaseLock() {
|
||||
void CefValueImpl::ReleaseLock() NO_THREAD_SAFETY_ANALYSIS {
|
||||
CefValueController* controller = GetValueController();
|
||||
if (controller) {
|
||||
controller->AssertLockAcquired();
|
||||
|
@@ -152,7 +152,8 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
||||
if (frame &&
|
||||
frame->GetDocument()->CanExecuteScripts(blink::kAboutToExecuteScript)) {
|
||||
func_rv = blink::V8ScriptRunner::CallFunction(
|
||||
function, frame->GetDocument(), receiver, argc, args, isolate);
|
||||
function, frame->GetDocument()->ToExecutionContext(), receiver, argc,
|
||||
args, isolate);
|
||||
}
|
||||
|
||||
return func_rv;
|
||||
|
@@ -95,7 +95,6 @@
|
||||
#include "third_party/blink/public/platform/platform.h"
|
||||
#include "third_party/blink/public/platform/scheduler/web_renderer_process_type.h"
|
||||
#include "third_party/blink/public/platform/url_conversion.h"
|
||||
#include "third_party/blink/public/platform/web_prerendering_support.h"
|
||||
#include "third_party/blink/public/platform/web_runtime_features.h"
|
||||
#include "third_party/blink/public/platform/web_string.h"
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
@@ -115,15 +114,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Stub implementation of blink::WebPrerenderingSupport.
|
||||
class CefPrerenderingSupport : public blink::WebPrerenderingSupport {
|
||||
private:
|
||||
void Add(const blink::WebPrerender& prerender) override {}
|
||||
void Cancel(const blink::WebPrerender& prerender) override {}
|
||||
void Abandon(const blink::WebPrerender& prerender) override {}
|
||||
void PrefetchFinished() override {}
|
||||
};
|
||||
|
||||
// Stub implementation of blink::WebPrerendererClient.
|
||||
class CefPrerendererClient : public content::RenderViewObserver,
|
||||
public blink::WebPrerendererClient {
|
||||
@@ -141,7 +131,6 @@ class CefPrerendererClient : public content::RenderViewObserver,
|
||||
void OnDestruct() override { delete this; }
|
||||
|
||||
// WebPrerendererClient methods:
|
||||
void WillAddPrerender(blink::WebPrerender* prerender) override {}
|
||||
bool IsPrefetchOnly() override { return false; }
|
||||
};
|
||||
|
||||
@@ -404,8 +393,6 @@ void CefContentRendererClient::RenderThreadStarted() {
|
||||
base::MessageLoopCurrent::Get()->AddDestructionObserver(this);
|
||||
}
|
||||
|
||||
blink::WebPrerenderingSupport::Initialize(new CefPrerenderingSupport());
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
{
|
||||
base::ScopedCFTypeRef<CFStringRef> key(
|
||||
|
@@ -84,12 +84,6 @@ void CefRenderThreadObserver::SetConfiguration(
|
||||
void CefRenderThreadObserver::SetContentSettingRules(
|
||||
const RendererContentSettingRules& rules) {}
|
||||
|
||||
void CefRenderThreadObserver::SetFieldTrialGroup(
|
||||
const std::string& trial_name,
|
||||
const std::string& group_name) {
|
||||
content::RenderThread::Get()->SetFieldTrialGroup(trial_name, group_name);
|
||||
}
|
||||
|
||||
void CefRenderThreadObserver::OnRendererConfigurationAssociatedRequest(
|
||||
mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
|
||||
receiver) {
|
||||
|
@@ -46,8 +46,6 @@ class CefRenderThreadObserver : public content::RenderThreadObserver,
|
||||
void SetConfiguration(chrome::mojom::DynamicParamsPtr params) override;
|
||||
void SetContentSettingRules(
|
||||
const RendererContentSettingRules& rules) override;
|
||||
void SetFieldTrialGroup(const std::string& trial_name,
|
||||
const std::string& group_name) override;
|
||||
|
||||
void OnRendererConfigurationAssociatedRequest(
|
||||
mojo::PendingAssociatedReceiver<chrome::mojom::RendererConfiguration>
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "net/base/request_priority.h"
|
||||
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
|
||||
#include "third_party/blink/public/platform/web_security_origin.h"
|
||||
#include "third_party/blink/public/platform/web_string.h"
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
@@ -110,15 +112,35 @@ class CefRenderURLRequest::Context
|
||||
|
||||
url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags()));
|
||||
|
||||
WebURLRequest urlRequest;
|
||||
std::unique_ptr<network::ResourceRequest> resource_request =
|
||||
std::make_unique<network::ResourceRequest>();
|
||||
static_cast<CefRequestImpl*>(request_.get())
|
||||
->Get(urlRequest, upload_data_size_);
|
||||
urlRequest.SetPriority(blink::WebURLRequest::Priority::kMedium);
|
||||
->Get(resource_request.get(), false);
|
||||
resource_request->priority = net::MEDIUM;
|
||||
|
||||
// Behave the same as a subresource load.
|
||||
resource_request->fetch_request_context_type =
|
||||
static_cast<int>(blink::mojom::RequestContextType::SUBRESOURCE);
|
||||
resource_request->resource_type =
|
||||
static_cast<int>(blink::mojom::ResourceType::kSubResource);
|
||||
|
||||
// Need load timing info for WebURLLoaderImpl::PopulateURLResponse to
|
||||
// properly set cached status.
|
||||
resource_request->enable_load_timing = true;
|
||||
|
||||
// Set the origin to match the request. The requirement for an origin is
|
||||
// DCHECK'd in ResourceDispatcherHostImpl::ContinuePendingBeginRequest.
|
||||
urlRequest.SetRequestorOrigin(
|
||||
blink::WebSecurityOrigin::Create(urlRequest.Url()));
|
||||
resource_request->request_initiator = url::Origin::Create(url);
|
||||
|
||||
if (resource_request->request_body) {
|
||||
const auto& elements = *resource_request->request_body->elements();
|
||||
if (elements.size() > 0) {
|
||||
const auto& element = elements[0];
|
||||
if (element.type() == network::mojom::DataElementType::kBytes) {
|
||||
upload_data_size_ = element.length() - element.offset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blink::WebURLLoaderFactory* factory = nullptr;
|
||||
if (frame_) {
|
||||
@@ -131,9 +153,13 @@ class CefRenderURLRequest::Context
|
||||
}
|
||||
|
||||
loader_ = factory->CreateURLLoader(
|
||||
urlRequest, blink::scheduler::WebResourceLoadingTaskRunnerHandle::
|
||||
CreateUnprioritized(task_runner_.get()));
|
||||
loader_->LoadAsynchronously(urlRequest, url_client_.get());
|
||||
blink::WebURLRequest(),
|
||||
blink::scheduler::WebResourceLoadingTaskRunnerHandle::
|
||||
CreateUnprioritized(task_runner_.get()));
|
||||
loader_->LoadAsynchronously(
|
||||
std::move(resource_request), nullptr /* extra_data */,
|
||||
0 /* requestor_id */, false /* download_to_network_cache_only */,
|
||||
false /* no_mime_sniffing */, url_client_.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -316,8 +342,7 @@ class CefRenderURLRequest::Context
|
||||
// Upload notifications are sent using a timer and may not occur if the
|
||||
// request completes too quickly. We therefore send the notification here
|
||||
// if necessary.
|
||||
client_->OnUploadProgress(url_request_.get(), upload_data_size_,
|
||||
upload_data_size_);
|
||||
url_client_->DidSendData(upload_data_size_, upload_data_size_);
|
||||
got_upload_progress_complete_ = true;
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "third_party/blink/public/common/loader/resource_type_util.h"
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
|
||||
CefURLLoaderThrottleProviderImpl::CefURLLoaderThrottleProviderImpl(
|
||||
@@ -42,22 +43,25 @@ CefURLLoaderThrottleProviderImpl::Clone() {
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
||||
CefURLLoaderThrottleProviderImpl::CreateThrottles(
|
||||
int render_frame_id,
|
||||
const blink::WebURLRequest& request,
|
||||
content::ResourceType resource_type) {
|
||||
const blink::WebURLRequest& request) {
|
||||
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
|
||||
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles;
|
||||
|
||||
const network::mojom::RequestDestination request_destination =
|
||||
request.GetRequestDestination();
|
||||
|
||||
// Some throttles have already been added in the browser for frame resources.
|
||||
// Don't add them for frame requests.
|
||||
bool is_frame_resource = content::IsResourceTypeFrame(resource_type);
|
||||
bool is_frame_resource =
|
||||
blink::IsRequestDestinationFrame(request_destination);
|
||||
|
||||
DCHECK(!is_frame_resource ||
|
||||
type_ == content::URLLoaderThrottleProviderType::kFrame);
|
||||
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
type_ == content::URLLoaderThrottleProviderType::kFrame &&
|
||||
resource_type == content::ResourceType::kObject) {
|
||||
request_destination == network::mojom::RequestDestination::kObject) {
|
||||
content::RenderFrame* render_frame =
|
||||
content::RenderFrame::FromRoutingID(render_frame_id);
|
||||
auto mime_handlers =
|
||||
@@ -73,7 +77,6 @@ CefURLLoaderThrottleProviderImpl::CreateThrottles(
|
||||
}
|
||||
|
||||
throttles.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||
CefRenderThreadObserver::is_incognito_process(),
|
||||
CefRenderThreadObserver::GetDynamicParams()));
|
||||
|
||||
return throttles;
|
||||
|
@@ -25,8 +25,7 @@ class CefURLLoaderThrottleProviderImpl
|
||||
std::unique_ptr<content::URLLoaderThrottleProvider> Clone() override;
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateThrottles(
|
||||
int render_frame_id,
|
||||
const blink::WebURLRequest& request,
|
||||
content::ResourceType resource_type) override;
|
||||
const blink::WebURLRequest& request) override;
|
||||
void SetOnline(bool is_online) override;
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user