mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 86.0.4240.0 (#800218)
- CefURLRequest::Create is no longer supported in the renderer process (see https://crbug.com/891872). Use CefFrame::CreateURLRequest instead. - Mac platform definitions have been changed from `MACOSX` to `MAC` (see https://crbug.com/1105907) and related CMake macro names have been updated. The old `OS_MACOSX` define is still set in code and CMake for backwards compatibility. - Linux ARM build is currently broken (see https://crbug.com/1123214).
This commit is contained in:
@ -96,10 +96,10 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
|
||||
// Values checked in ProfileNetworkContextService::CreateNetworkContextParams
|
||||
// when creating the NetworkContext.
|
||||
bool ShouldRestoreOldSessionCookies() override {
|
||||
bool ShouldRestoreOldSessionCookies() const override {
|
||||
return ShouldPersistSessionCookies();
|
||||
}
|
||||
bool ShouldPersistSessionCookies() override {
|
||||
bool ShouldPersistSessionCookies() const override {
|
||||
return !!settings_.persist_session_cookies;
|
||||
}
|
||||
base::Optional<std::vector<std::string>> GetCookieableSchemes() override {
|
||||
|
@ -57,7 +57,7 @@
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
#include "chrome/browser/ui/views/chrome_layout_provider.h"
|
||||
#include "chrome/browser/ui/views/chrome_views_delegate.h"
|
||||
#else
|
||||
@ -105,7 +105,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
views_delegate_ = std::make_unique<ChromeViewsDelegate>();
|
||||
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
|
||||
#else
|
||||
@ -230,7 +230,7 @@ void AlloyBrowserMainParts::PostDestroyThreads() {
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
views_delegate_.reset();
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
layout_provider_.reset();
|
||||
#endif
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
@ -32,7 +32,7 @@ class WMState;
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
namespace views {
|
||||
class ViewsDelegate;
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
class LayoutProvider;
|
||||
#endif
|
||||
} // namespace views
|
||||
@ -96,7 +96,7 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
std::unique_ptr<views::ViewsDelegate> views_delegate_;
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
std::unique_ptr<views::LayoutProvider> layout_provider_;
|
||||
#endif
|
||||
#endif // defined(TOOLKIT_VIEWS)
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/net/scheme_registration.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h"
|
||||
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
@ -73,7 +72,6 @@
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/variations/variations_http_header_provider.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
@ -104,6 +102,8 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/info_map.h"
|
||||
#include "extensions/browser/process_map.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
@ -112,11 +112,11 @@
|
||||
#include "net/base/auth.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
|
||||
#include "services/service_manager/embedder/switches.h"
|
||||
#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"
|
||||
@ -131,7 +131,7 @@
|
||||
#include "libcef/common/widevine_loader.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_POSIX) && !defined(OS_MAC)
|
||||
#include "base/debug/leak_annotations.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "components/crash/content/browser/crash_handler_host_linux.h"
|
||||
@ -139,7 +139,7 @@
|
||||
#include "content/public/common/content_descriptors.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
#include "net/ssl/client_cert_store_mac.h"
|
||||
#include "services/video_capture/public/mojom/constants.mojom.h"
|
||||
#endif
|
||||
@ -381,7 +381,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefQuotaPermissionContext);
|
||||
};
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_POSIX) && !defined(OS_MAC)
|
||||
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
|
||||
const std::string& process_type) {
|
||||
base::FilePath dumps_path;
|
||||
@ -436,7 +436,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#endif // defined(OS_POSIX) && !defined(OS_MAC)
|
||||
|
||||
// TODO(cef): We can't currently trust NavigationParams::is_main_frame() because
|
||||
// it's always set to true in
|
||||
@ -697,12 +697,6 @@ void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
extensions::ProcessMap::Get(browser_context)
|
||||
->Insert(extension->id(), site_instance->GetProcess()->GetID(),
|
||||
site_instance->GetId());
|
||||
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT, base::Bind(&extensions::InfoMap::RegisterExtensionProcess,
|
||||
browser_context->extension_system()->info_map(),
|
||||
extension->id(), site_instance->GetProcess()->GetID(),
|
||||
site_instance->GetId()));
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::SiteInstanceDeleting(
|
||||
@ -729,12 +723,6 @@ void AlloyContentBrowserClient::SiteInstanceDeleting(
|
||||
extensions::ProcessMap::Get(browser_context)
|
||||
->Remove(extension->id(), site_instance->GetProcess()->GetID(),
|
||||
site_instance->GetId());
|
||||
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT, base::Bind(&extensions::InfoMap::UnregisterExtensionProcess,
|
||||
browser_context->extension_system()->info_map(),
|
||||
extension->id(), site_instance->GetProcess()->GetID(),
|
||||
site_instance->GetId()));
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::BindHostReceiverForRenderer(
|
||||
@ -756,15 +744,6 @@ void AlloyContentBrowserClient::BindHostReceiverForRenderer(
|
||||
#endif // BUILDFLAG(HAS_SPELLCHECK_PANEL)
|
||||
}
|
||||
|
||||
base::Optional<service_manager::Manifest>
|
||||
AlloyContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||
if (name == content::mojom::kBrowserServiceName) {
|
||||
return GetCefContentBrowserOverlayManifest();
|
||||
}
|
||||
|
||||
return base::nullopt;
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
base::CommandLine* command_line,
|
||||
int child_process_id) {
|
||||
@ -775,7 +754,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
switches::kDisablePackLoading,
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
switches::kFrameworkDirPath,
|
||||
switches::kMainBundlePath,
|
||||
#endif
|
||||
@ -855,7 +834,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
base::size(kSwitchNames));
|
||||
|
||||
#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) {
|
||||
if (!browser_cmd->HasSwitch(sandbox::policy::switches::kNoSandbox)) {
|
||||
// Pass the Widevine CDM path to the Zygote process. See comments in
|
||||
// CefWidevineLoader::AddContentDecryptionModules.
|
||||
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
|
||||
@ -1179,7 +1158,7 @@ AlloyContentBrowserClient::CreateClientCertStore(
|
||||
net::ClientCertStoreNSS::PasswordDelegateFactory()));
|
||||
#elif defined(OS_WIN)
|
||||
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
|
||||
#else
|
||||
#error Unknown platform.
|
||||
@ -1203,6 +1182,7 @@ AlloyContentBrowserClient::CreateLoginDelegate(
|
||||
|
||||
void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
base::UkmSourceId ukm_source_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
@ -1212,7 +1192,7 @@ void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
web_contents->GetBrowserContext(),
|
||||
web_contents->GetBrowserContext(), ukm_source_id,
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
void BindHostReceiverForRenderer(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
mojo::GenericPendingReceiver receiver) override;
|
||||
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
std::string GetApplicationLocale() override;
|
||||
@ -149,6 +147,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
void RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
base::UkmSourceId ukm_source_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
|
@ -222,7 +222,7 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
|
||||
widget->LostCapture();
|
||||
}
|
||||
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
|
||||
if (!web_contents_)
|
||||
return;
|
||||
|
@ -36,7 +36,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
extensions::ExtensionHost* GetExtensionHost() const override;
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
void SendCaptureLostEvent() override;
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
#endif
|
||||
bool PreHandleGestureEvent(content::WebContents* source,
|
||||
|
@ -5,8 +5,9 @@
|
||||
|
||||
#include "libcef/browser/alloy/chrome_profile_alloy.h"
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
#include "components/variations/variations_client.h"
|
||||
#include "components/variations/variations_http_header_provider.h"
|
||||
#include "components/variations/variations_ids_provider.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
namespace {
|
||||
@ -23,7 +24,7 @@ class CefVariationsClient : public variations::VariationsClient {
|
||||
}
|
||||
|
||||
std::string GetVariationsHeader() const override {
|
||||
return variations::VariationsHttpHeaderProvider::GetInstance()
|
||||
return variations::VariationsIdsProvider::GetInstance()
|
||||
->GetClientDataHeader(false /* is_signed_in */);
|
||||
}
|
||||
|
||||
@ -157,7 +158,7 @@ void ChromeProfileAlloy::SetExitType(ExitType exit_type) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() {
|
||||
Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() const {
|
||||
NOTREACHED();
|
||||
return EXIT_NORMAL;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class ChromeProfileAlloy : public Profile {
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
ExitType GetLastSessionExitType() override;
|
||||
ExitType GetLastSessionExitType() const override;
|
||||
base::Time GetCreationTime() const override;
|
||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
#include "components/spellcheck/browser/spellcheck_platform.h"
|
||||
#endif
|
||||
|
||||
@ -565,7 +565,7 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
}
|
||||
|
||||
content::WebContents* contents = web_contents();
|
||||
if (contents && contents->NeedToFireBeforeUnloadOrUnload()) {
|
||||
if (contents && contents->NeedToFireBeforeUnloadOrUnloadEvents()) {
|
||||
// Will result in a call to BeforeUnloadFired() and, if the close isn't
|
||||
// canceled, CloseContents().
|
||||
contents->DispatchBeforeUnload(false /* auto_cancel */);
|
||||
@ -1048,7 +1048,7 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
if (spellcheck)
|
||||
spellcheck->GetCustomDictionary()->AddWord(word);
|
||||
}
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
|
||||
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
|
||||
}
|
||||
@ -1225,7 +1225,7 @@ void CefBrowserHostImpl::SendCaptureLostEvent() {
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
@ -2301,10 +2301,10 @@ CefBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
|
||||
|
||||
void CefBrowserHostImpl::RunFileChooser(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) {
|
||||
EnsureFileDialogManager();
|
||||
file_dialog_manager_->RunFileChooser(std::move(listener), params);
|
||||
file_dialog_manager_->RunFileChooser(listener, params);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HandleContextMenu(
|
||||
@ -2320,7 +2320,7 @@ bool CefBrowserHostImpl::HandleContextMenu(
|
||||
|
||||
void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
|
||||
const gfx::Size& pref_size) {
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
CEF_REQUIRE_UIT();
|
||||
if (platform_delegate_)
|
||||
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
|
||||
|
@ -430,7 +430,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
||||
content::WebContents* source) override;
|
||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) override;
|
||||
bool EmbedsFullscreenWidget() override;
|
||||
void EnterFullscreenModeForTab(
|
||||
|
@ -157,7 +157,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
CefPopupFeatures cef_features;
|
||||
TranslatePopupFeatures(features, cef_features);
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_MACOSX))
|
||||
#if (defined(OS_WIN) || defined(OS_MAC))
|
||||
// Default to the size from the popup features.
|
||||
if (cef_features.xSet)
|
||||
window_info->x = cef_features.x;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "base/message_loop/message_pump.h"
|
||||
#include "base/message_loop/message_pump_for_ui.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||
#include "base/message_loop/message_pump_mac.h"
|
||||
#endif
|
||||
@ -29,7 +29,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
void Run(Delegate* delegate) override {
|
||||
base::TimeTicks start = base::TimeTicks::Now();
|
||||
while (true) {
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
||||
#endif
|
||||
|
||||
@ -108,7 +108,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
|
||||
return std::make_unique<MessagePumpExternal>(0.01f, handler);
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
return base::MessagePumpMac::Create();
|
||||
#else
|
||||
return std::make_unique<base::MessagePumpForUI>();
|
||||
|
@ -127,7 +127,7 @@ void CefBrowserPlatformDelegate::SendCaptureLostEvent() {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
void CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted() {}
|
||||
|
||||
void CefBrowserPlatformDelegate::SizeTo(int width, int height) {}
|
||||
|
@ -207,7 +207,7 @@ class CefBrowserPlatformDelegate {
|
||||
// Send capture lost event.
|
||||
virtual void SendCaptureLostEvent();
|
||||
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
// The window hosting the browser is about to be moved or resized. Only used
|
||||
// on Windows and Linux.
|
||||
virtual void NotifyMoveOrResizeStarted();
|
||||
|
@ -18,7 +18,7 @@
|
||||
#if defined(OS_WIN)
|
||||
#include "libcef/browser/native/browser_platform_delegate_native_win.h"
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
#include "libcef/browser/native/browser_platform_delegate_native_mac.h"
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_mac.h"
|
||||
#elif defined(OS_LINUX)
|
||||
@ -40,7 +40,7 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
|
||||
#if defined(OS_WIN)
|
||||
return std::make_unique<CefBrowserPlatformDelegateNativeWin>(
|
||||
window_info, background_color);
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
return std::make_unique<CefBrowserPlatformDelegateNativeMac>(
|
||||
window_info, background_color);
|
||||
#elif defined(OS_LINUX)
|
||||
@ -56,7 +56,7 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
|
||||
#if defined(OS_WIN)
|
||||
return std::make_unique<CefBrowserPlatformDelegateOsrWin>(
|
||||
std::move(native_delegate), use_shared_texture, use_external_begin_frame);
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
|
||||
std::move(native_delegate));
|
||||
#elif defined(OS_LINUX)
|
||||
|
@ -26,7 +26,8 @@ ChromeContentBrowserClientCef::CreateBrowserMainParts(
|
||||
ChromeContentBrowserClient::CreateBrowserMainParts(parameters);
|
||||
browser_main_parts_ = new ChromeBrowserMainExtraPartsCef;
|
||||
static_cast<ChromeBrowserMainParts*>(main_parts.get())
|
||||
->AddParts(browser_main_parts_);
|
||||
->AddParts(
|
||||
base::WrapUnique<ChromeBrowserMainExtraParts>(browser_main_parts_));
|
||||
return main_parts;
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
|
||||
#include "chrome/app/chrome_crash_reporter_client.h"
|
||||
|
||||
// Required due to https://crrev.com/1c9f89a06f
|
||||
void ChromeCrashReporterClient::Create() {}
|
||||
|
||||
#endif // defined(OS_MACOSX)
|
||||
#endif // defined(OS_MAC)
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "components/network_session_configurator/common/network_switches.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
@ -294,7 +294,7 @@ void CefSetOSModalLoop(bool osModalLoop) {
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT())
|
||||
base::MessageLoopCurrent::Get()->set_os_modal_loop(osModalLoop);
|
||||
base::CurrentThread::Get()->set_os_modal_loop(osModalLoop);
|
||||
else
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(CefSetOSModalLoop, osModalLoop));
|
||||
#endif // defined(OS_WIN)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
@ -538,7 +539,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
// Quick check to avoid parsing the JSON object. Events begin with a
|
||||
// "method" value whereas method results begin with an "id" value.
|
||||
LogProtocolMessage(str_message.starts_with("{\"method\":")
|
||||
LogProtocolMessage(base::StartsWith(str_message, "{\"method\":")
|
||||
? ProtocolMessageType::EVENT
|
||||
: ProtocolMessageType::RESULT,
|
||||
str_message);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/devtools/devtools_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
|
||||
namespace devtools_util {
|
||||
|
||||
@ -24,7 +25,7 @@ bool ParseEvent(const base::StringPiece& message,
|
||||
static const char kMethodEnd[] = "\"";
|
||||
static const char kParamsStart[] = ",\"params\":";
|
||||
|
||||
if (!message.starts_with(kMethodStart))
|
||||
if (!base::StartsWith(message, kMethodStart))
|
||||
return false;
|
||||
|
||||
const size_t method_start = sizeof(kMethodStart) - 1;
|
||||
@ -41,7 +42,7 @@ bool ParseEvent(const base::StringPiece& message,
|
||||
params = base::StringPiece();
|
||||
} else {
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kParamsStart)) {
|
||||
if (base::StartsWith(remainder, kParamsStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kParamsStart) - 1;
|
||||
params =
|
||||
@ -71,7 +72,7 @@ bool ParseResult(const base::StringPiece& message,
|
||||
static const char kResultStart[] = "\"result\":";
|
||||
static const char kErrorStart[] = "\"error\":";
|
||||
|
||||
if (!message.starts_with(kIdStart))
|
||||
if (!base::StartsWith(message, kIdStart))
|
||||
return false;
|
||||
|
||||
const size_t id_start = sizeof(kIdStart) - 1;
|
||||
@ -84,13 +85,13 @@ bool ParseResult(const base::StringPiece& message,
|
||||
|
||||
size_t remainder_start = id_end + sizeof(kIdEnd) - 1;
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kResultStart)) {
|
||||
if (base::StartsWith(remainder, kResultStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kResultStart) - 1;
|
||||
result =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
success = true;
|
||||
} else if (remainder.starts_with(kErrorStart)) {
|
||||
} else if (base::StartsWith(remainder, kErrorStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kErrorStart) - 1;
|
||||
result =
|
||||
|
@ -487,7 +487,7 @@ void CefExtensionSystem::InstallUpdate(
|
||||
bool install_immediately,
|
||||
InstallUpdateCallback install_update_callback) {
|
||||
NOTREACHED();
|
||||
base::DeleteFile(temp_dir, true /* recursive */);
|
||||
base::DeletePathRecursively(temp_dir);
|
||||
}
|
||||
|
||||
void CefExtensionSystem::PerformActionBasedOnOmahaAttributes(
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/common/file_chooser_file_info.h"
|
||||
#include "net/base/directory_lister.h"
|
||||
|
||||
namespace {
|
||||
@ -202,7 +201,7 @@ void CefFileDialogManager::RunFileDialog(
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
@ -213,11 +212,11 @@ void CefFileDialogManager::RunFileChooser(
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
callback = base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, listener);
|
||||
} else {
|
||||
callback = base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
callback =
|
||||
base::BindOnce(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, listener);
|
||||
}
|
||||
|
||||
RunFileChooserInternal(cef_params, std::move(callback));
|
||||
@ -320,7 +319,7 @@ void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
const blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@ -328,21 +327,21 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
|
||||
if (file_paths.size() == 0) {
|
||||
// Client canceled the file chooser.
|
||||
OnRunFileChooserDelegateCallback(mode, std::move(listener),
|
||||
selected_accept_filter, file_paths);
|
||||
OnRunFileChooserDelegateCallback(mode, listener, selected_accept_filter,
|
||||
file_paths);
|
||||
} else {
|
||||
lister_.reset(new net::DirectoryLister(
|
||||
file_paths[0], net::DirectoryLister::NO_SORT_RECURSIVE,
|
||||
new UploadFolderHelper(base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode, std::move(listener)))));
|
||||
weak_ptr_factory_.GetWeakPtr(), mode, listener))));
|
||||
lister_->Start();
|
||||
}
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserDelegateCallback(
|
||||
blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
@ -46,7 +46,7 @@ class CefFileDialogManager {
|
||||
|
||||
// Called from CefBrowserHostImpl::RunFileChooser.
|
||||
// See WebContentsDelegate::RunFileChooser documentation.
|
||||
void RunFileChooser(std::unique_ptr<content::FileSelectListener> listener,
|
||||
void RunFileChooser(scoped_refptr<content::FileSelectListener> listener,
|
||||
const blink::mojom::FileChooserParams& params);
|
||||
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
@ -71,7 +71,7 @@ class CefFileDialogManager {
|
||||
// blink::mojom::FileChooserParams::Mode::kUploadFolder.
|
||||
void OnRunFileChooserUploadFolderDelegateCallback(
|
||||
const blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
@ -79,7 +79,7 @@ class CefFileDialogManager {
|
||||
// RenderFrameHost.
|
||||
void OnRunFileChooserDelegateCallback(
|
||||
blink::mojom::FileChooserParams::Mode mode,
|
||||
std::unique_ptr<content::FileSelectListener> listener,
|
||||
scoped_refptr<content::FileSelectListener> listener,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MAC) || defined(OS_WIN)
|
||||
#include "components/crash/core/app/crash_switches.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
#endif
|
||||
@ -64,7 +64,7 @@ std::unique_ptr<CefMainRunnerDelegate> MakeDelegate(
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MAC) || defined(OS_WIN)
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||
@ -87,7 +87,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
}),
|
||||
argv.end());
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
// HandlerMain on macOS uses the system version of getopt_long which expects
|
||||
// the first argument to be the program name.
|
||||
argv.insert(argv.begin(), command_line.GetProgram().value());
|
||||
@ -110,7 +110,7 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
argv_as_utf8.get(), nullptr);
|
||||
}
|
||||
|
||||
#endif // defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#endif // defined(OS_MAC) || defined(OS_WIN)
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -325,7 +325,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
|
||||
int result;
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#if defined(OS_MAC) || defined(OS_WIN)
|
||||
if (process_type == crash_reporter::switches::kCrashpadHandler) {
|
||||
result = RunAsCrashpadHandler(command_line);
|
||||
main_delegate->AfterExecuteProcess();
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "libcef/browser/native/window_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
@ -40,11 +40,6 @@ long GetSystemUptime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// See https://crbug.com/1066670#c57 for background.
|
||||
inline x11::Window ToX11Window(::Window window) {
|
||||
return static_cast<x11::Window>(window);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux(
|
||||
@ -92,8 +87,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
|
||||
CefWindowDelegateView* delegate_view = new CefWindowDelegateView(
|
||||
GetBackgroundColor(), window_x11_->TopLevelAlwaysOnTop(),
|
||||
GetBoundsChangedCallback());
|
||||
delegate_view->Init(ToX11Window(window_info_.window), web_contents_,
|
||||
gfx::Rect(gfx::Point(), rect.size()));
|
||||
delegate_view->Init(static_cast<gfx::AcceleratedWidget>(window_info_.window),
|
||||
web_contents_, gfx::Rect(gfx::Point(), rect.size()));
|
||||
|
||||
window_widget_ = delegate_view->GetWidget();
|
||||
window_widget_->Show();
|
||||
@ -176,7 +171,7 @@ void CefBrowserPlatformDelegateNativeLinux::NotifyMoveOrResizeStarted() {
|
||||
if (!window_x11_)
|
||||
return;
|
||||
|
||||
views::DesktopWindowTreeHostX11* tree_host = window_x11_->GetHost();
|
||||
views::DesktopWindowTreeHostLinux* tree_host = window_x11_->GetHost();
|
||||
if (!tree_host)
|
||||
return;
|
||||
|
||||
@ -212,7 +207,7 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
|
||||
return view;
|
||||
|
||||
// We can't use aura::Window::GetBoundsInScreen on Linux because it will
|
||||
// return bounds from DesktopWindowTreeHostX11 which in our case is relative
|
||||
// return bounds from DesktopWindowTreeHostLinux which in our case is relative
|
||||
// to the parent window instead of the root window (screen).
|
||||
const gfx::Rect& bounds_in_screen = window_x11_->GetBoundsInScreen();
|
||||
return gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#import "base/mac/scoped_sending_event.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#import "ui/base/cocoa/menu_controller.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
@ -23,6 +23,7 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
// Create a menu controller based on the model.
|
||||
menu_controller_.reset([[MenuControllerCocoa alloc]
|
||||
initWithModel:model->model()
|
||||
delegate:nil
|
||||
useWithPopUpButtonCell:NO]);
|
||||
|
||||
// Keep the menu controller alive (by adding an additional retain) until after
|
||||
@ -33,7 +34,7 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
menu_controller_);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
base::CurrentThread::ScopedNestableTaskAllower allow;
|
||||
|
||||
// One of the events that could be pumped is |window.close()|.
|
||||
// User-initiated event-tracking loops protect against this by
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/native/menu_2.h"
|
||||
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
CefMenuRunnerWin::CefMenuRunnerWin() {}
|
||||
@ -21,7 +21,7 @@ bool CefMenuRunnerWin::RunContextMenu(
|
||||
menu_->Rebuild(nullptr);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
base::CurrentThread::ScopedNestableTaskAllower allow;
|
||||
|
||||
const gfx::Point& screen_point =
|
||||
browser->GetScreenPoint(gfx::Point(params.x, params.y));
|
||||
|
@ -4,18 +4,18 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/native/window_x11.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XInput2.h>
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#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/platform_window/x11/x11_topmost_window_finder.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -208,7 +208,7 @@ void CefWindowX11::Show() {
|
||||
if (child && toplevel_window) {
|
||||
// Configure the drag&drop proxy property for the top-most window so
|
||||
// that all drag&drop-related messages will be sent to the child
|
||||
// DesktopWindowTreeHostX11. The proxy property is referenced by
|
||||
// DesktopWindowTreeHostLinux. The proxy property is referenced by
|
||||
// DesktopDragDropClientAuraX11::FindWindowFor.
|
||||
x11::Window window = x11::Window::None;
|
||||
ui::GetProperty(ToX11Window(toplevel_window), gfx::GetAtom(kXdndProxy),
|
||||
@ -246,7 +246,7 @@ void CefWindowX11::Focus() {
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child && ui::IsWindowVisible(ToX11Window(child))) {
|
||||
// Give focus to the child DesktopWindowTreeHostX11.
|
||||
// Give focus to the child DesktopWindowTreeHostLinux.
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
|
||||
}
|
||||
} else {
|
||||
@ -289,13 +289,13 @@ gfx::Rect CefWindowX11::GetBoundsInScreen() {
|
||||
return gfx::Rect();
|
||||
}
|
||||
|
||||
views::DesktopWindowTreeHostX11* CefWindowX11::GetHost() {
|
||||
views::DesktopWindowTreeHostLinux* CefWindowX11::GetHost() {
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child) {
|
||||
return static_cast<views::DesktopWindowTreeHostX11*>(
|
||||
return static_cast<views::DesktopWindowTreeHostLinux*>(
|
||||
views::DesktopWindowTreeHostLinux::GetHostForWidget(
|
||||
ToX11Window(child)));
|
||||
static_cast<gfx::AcceleratedWidget>(child)));
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@ -318,8 +318,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
// Called by X11EventSourceLibevent to determine whether this XEventDispatcher
|
||||
// implementation is able to process the next translated event sent by it.
|
||||
void CefWindowX11::CheckCanDispatchNextPlatformEvent(x11::Event* x11_event) {
|
||||
XEvent* xev = &x11_event->xlib_event();
|
||||
current_xevent_ = IsTargetedBy(*x11_event) ? xev : nullptr;
|
||||
current_xevent_ = IsTargetedBy(*x11_event) ? x11_event : nullptr;
|
||||
}
|
||||
|
||||
void CefWindowX11::PlatformEventDispatchFinished() {
|
||||
@ -333,8 +332,7 @@ ui::PlatformEventDispatcher* CefWindowX11::GetPlatformEventDispatcher() {
|
||||
bool CefWindowX11::DispatchXEvent(x11::Event* x11_event) {
|
||||
if (!IsTargetedBy(*x11_event))
|
||||
return false;
|
||||
XEvent* xev = &x11_event->xlib_event();
|
||||
ProcessXEvent(xev);
|
||||
ProcessXEvent(x11_event);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -378,77 +376,64 @@ bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
}
|
||||
|
||||
bool CefWindowX11::IsTargetedBy(const x11::Event& x11_event) const {
|
||||
const XEvent& xev = x11_event.xlib_event();
|
||||
::Window target_window =
|
||||
xev.type == x11::GeGenericEvent::opcode
|
||||
? static_cast<XIDeviceEvent*>(xev.xcookie.data)->event
|
||||
: xev.xany.window;
|
||||
return target_window == xwindow_;
|
||||
return ToWindow(x11_event.window()) == xwindow_;
|
||||
}
|
||||
|
||||
void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
switch (xev->type) {
|
||||
case ConfigureNotify: {
|
||||
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
||||
DCHECK_EQ(xwindow_, xev->xconfigure.window);
|
||||
// It's possible that the X window may be resized by some other means
|
||||
// than from within Aura (e.g. the X window manager can change the
|
||||
// size). Make sure the root window size is maintained properly.
|
||||
gfx::Rect bounds(xev->xconfigure.x, xev->xconfigure.y,
|
||||
xev->xconfigure.width, xev->xconfigure.height);
|
||||
bounds_ = bounds;
|
||||
void CefWindowX11::ProcessXEvent(x11::Event* event) {
|
||||
if (auto* configure = event->As<x11::ConfigureNotifyEvent>()) {
|
||||
DCHECK_EQ(xwindow_, ToWindow(configure->event));
|
||||
DCHECK_EQ(xwindow_, ToWindow(configure->window));
|
||||
// It's possible that the X window may be resized by some other means
|
||||
// than from within Aura (e.g. the X window manager can change the
|
||||
// size). Make sure the root window size is maintained properly.
|
||||
bounds_ = gfx::Rect(configure->x, configure->y, configure->width,
|
||||
configure->height);
|
||||
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child) {
|
||||
// Resize the child DesktopWindowTreeHostX11 to match this window.
|
||||
XWindowChanges changes = {0};
|
||||
changes.width = bounds.width();
|
||||
changes.height = bounds.height();
|
||||
XConfigureWindow(xdisplay_, child, CWHeight | CWWidth, &changes);
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child) {
|
||||
// Resize the child DesktopWindowTreeHostLinux to match this window.
|
||||
XWindowChanges changes = {0};
|
||||
changes.width = bounds_.width();
|
||||
changes.height = bounds_.height();
|
||||
XConfigureWindow(xdisplay_, child, CWHeight | CWWidth, &changes);
|
||||
|
||||
browser_->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
browser_->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ClientMessage: {
|
||||
Atom message_type = xev->xclient.message_type;
|
||||
if (message_type == GetAtom(kWMProtocols)) {
|
||||
Atom protocol = static_cast<Atom>(xev->xclient.data.l[0]);
|
||||
if (protocol == GetAtom(kWMDeleteWindow)) {
|
||||
// We have received a close message from the window manager.
|
||||
if (!browser_ || browser_->TryCloseBrowser()) {
|
||||
// Allow the close.
|
||||
XDestroyWindow(xdisplay_, xwindow_);
|
||||
} else if (auto* client = event->As<x11::ClientMessageEvent>()) {
|
||||
if (client->type == gfx::GetAtom(kWMProtocols)) {
|
||||
x11::Atom protocol = static_cast<x11::Atom>(client->data.data32[0]);
|
||||
if (protocol == gfx::GetAtom(kWMDeleteWindow)) {
|
||||
// We have received a close message from the window manager.
|
||||
if (!browser_ || browser_->TryCloseBrowser()) {
|
||||
// Allow the close.
|
||||
XDestroyWindow(xdisplay_, xwindow_);
|
||||
|
||||
xwindow_ = x11::None;
|
||||
xwindow_ = x11::None;
|
||||
|
||||
if (browser_.get()) {
|
||||
// Force the browser to be destroyed and release the reference
|
||||
// added in PlatformCreateWindow().
|
||||
browser_->WindowDestroyed();
|
||||
}
|
||||
|
||||
delete this;
|
||||
if (browser_.get()) {
|
||||
// Force the browser to be destroyed and release the reference
|
||||
// added in PlatformCreateWindow().
|
||||
browser_->WindowDestroyed();
|
||||
}
|
||||
} else if (protocol == GetAtom(kNetWMPing)) {
|
||||
XEvent reply_event = *xev;
|
||||
reply_event.xclient.window = parent_xwindow_;
|
||||
|
||||
XSendEvent(xdisplay_, reply_event.xclient.window, false,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||
&reply_event);
|
||||
XFlush(xdisplay_);
|
||||
delete this;
|
||||
}
|
||||
} else if (protocol == gfx::GetAtom(kNetWMPing)) {
|
||||
x11::ClientMessageEvent reply_event = *client;
|
||||
reply_event.window = ToX11Window(parent_xwindow_);
|
||||
ui::SendEvent(reply_event, reply_event.window,
|
||||
x11::EventMask::SubstructureNotify |
|
||||
x11::EventMask::SubstructureRedirect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case x11::FocusIn:
|
||||
} else if (auto* focus = event->As<x11::FocusEvent>()) {
|
||||
if (focus->opcode == x11::FocusEvent::In) {
|
||||
// This message is received first followed by a "_NET_ACTIVE_WINDOW"
|
||||
// message sent to the root window. When X11DesktopHandler handles the
|
||||
// "_NET_ACTIVE_WINDOW" message it will erroneously mark the WebView
|
||||
// (hosted in a DesktopWindowTreeHostX11) as unfocused. Use a delayed
|
||||
// (hosted in a DesktopWindowTreeHostLinux) as unfocused. Use a delayed
|
||||
// task here to restore the WebView's focus state.
|
||||
if (!focus_pending_) {
|
||||
focus_pending_ = true;
|
||||
@ -457,44 +442,40 @@ void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
100);
|
||||
}
|
||||
break;
|
||||
case x11::FocusOut:
|
||||
} else {
|
||||
// Cancel the pending focus change if some other window has gained focus
|
||||
// while waiting for the async task to run. Otherwise we can get stuck in
|
||||
// a focus change loop.
|
||||
if (focus_pending_)
|
||||
focus_pending_ = false;
|
||||
break;
|
||||
case PropertyNotify: {
|
||||
::Atom changed_atom = xev->xproperty.atom;
|
||||
if (changed_atom == GetAtom(kNetWMState)) {
|
||||
// State change event like minimize/maximize.
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child) {
|
||||
// Forward the state change to the child DesktopWindowTreeHostX11
|
||||
// window so that resource usage will be reduced while the window is
|
||||
// minimized.
|
||||
std::vector<x11::Atom> atom_list;
|
||||
if (ui::GetAtomArrayProperty(ToX11Window(xwindow_), kNetWMState,
|
||||
&atom_list) &&
|
||||
!atom_list.empty()) {
|
||||
ui::SetAtomArrayProperty(ToX11Window(child), kNetWMState, "ATOM",
|
||||
atom_list);
|
||||
} else {
|
||||
// Set an empty list of property values to pass the check in
|
||||
// DesktopWindowTreeHostX11::OnWMStateUpdated().
|
||||
XChangeProperty(xdisplay_, child,
|
||||
GetAtom(kNetWMState), // name
|
||||
GetAtom(kAtom), // type
|
||||
32, // size in bits of items in 'value'
|
||||
PropModeReplace, NULL,
|
||||
0); // num items
|
||||
}
|
||||
}
|
||||
} else if (auto* property = event->As<x11::PropertyNotifyEvent>()) {
|
||||
if (property->atom == gfx::GetAtom(kNetWMState)) {
|
||||
// State change event like minimize/maximize.
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child) {
|
||||
// Forward the state change to the child DesktopWindowTreeHostLinux
|
||||
// window so that resource usage will be reduced while the window is
|
||||
// minimized.
|
||||
std::vector<x11::Atom> atom_list;
|
||||
if (ui::GetAtomArrayProperty(ToX11Window(xwindow_), kNetWMState,
|
||||
&atom_list) &&
|
||||
!atom_list.empty()) {
|
||||
ui::SetAtomArrayProperty(ToX11Window(child), kNetWMState, "ATOM",
|
||||
atom_list);
|
||||
} else {
|
||||
// Set an empty list of property values to pass the check in
|
||||
// DesktopWindowTreeHostLinux::OnWMStateUpdated().
|
||||
XChangeProperty(xdisplay_, child,
|
||||
GetAtom(kNetWMState), // name
|
||||
GetAtom(kAtom), // type
|
||||
32, // size in bits of items in 'value'
|
||||
PropModeReplace, NULL,
|
||||
0); // num items
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ typedef struct _XDisplay Display;
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
namespace views {
|
||||
class DesktopWindowTreeHostX11;
|
||||
class DesktopWindowTreeHostLinux;
|
||||
}
|
||||
|
||||
// Object wrapper for an X11 Window.
|
||||
@ -46,7 +46,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
|
||||
gfx::Rect GetBoundsInScreen();
|
||||
|
||||
views::DesktopWindowTreeHostX11* GetHost();
|
||||
views::DesktopWindowTreeHostLinux* GetHost();
|
||||
|
||||
// ui::PlatformEventDispatcher methods:
|
||||
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
||||
@ -67,7 +67,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
void ContinueFocus();
|
||||
|
||||
bool IsTargetedBy(const x11::Event& x11_event) const;
|
||||
void ProcessXEvent(XEvent* xev);
|
||||
void ProcessXEvent(x11::Event* xev);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
|
||||
@ -87,7 +87,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
// 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;
|
||||
x11::Event* current_xevent_ = nullptr;
|
||||
|
||||
// Must always be the last member.
|
||||
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "content/public/browser/global_request_id.h"
|
||||
#include "content/public/common/referrer.h"
|
||||
#include "net/cookies/site_for_cookies.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
#include "url/gurl.h"
|
||||
|
@ -191,7 +191,7 @@ void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
std::string GetOSType() {
|
||||
#if defined(OS_WIN)
|
||||
return "Windows";
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
return "Mac OS X";
|
||||
#elif defined(OS_CHROMEOS)
|
||||
return "Chromium OS";
|
||||
|
@ -82,10 +82,10 @@ struct SaveCookiesProgress {
|
||||
|
||||
void SetCanonicalCookieCallback(SaveCookiesProgress* progress,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieInclusionStatus status) {
|
||||
net::CookieAccessResult access_result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
progress->num_cookie_lines_left_--;
|
||||
if (status.IsInclude()) {
|
||||
if (access_result.status.IsInclude()) {
|
||||
progress->allowed_cookies_.push_back(cookie);
|
||||
}
|
||||
|
||||
@ -131,8 +131,8 @@ void SaveCookiesOnUIThread(content::BrowserContext* browser_context,
|
||||
|
||||
SetCanonicalCookieCallback(
|
||||
progress, net::CanonicalCookie(),
|
||||
net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR));
|
||||
net::CookieAccessResult(net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -45,14 +45,16 @@ void RunAsyncCompletionOnUIThread(CefRefPtr<CefCompletionCallback> callback) {
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
net::CookieInclusionStatus status) {
|
||||
net::CookieAccessResult access_result) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
if (!status.IsInclude()) {
|
||||
LOG(WARNING) << "SetCookie failed with reason: " << status.GetDebugString();
|
||||
const bool is_include = access_result.status.IsInclude();
|
||||
if (!is_include) {
|
||||
LOG(WARNING) << "SetCookie failed with reason: "
|
||||
<< access_result.status.GetDebugString();
|
||||
}
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), status.IsInclude()));
|
||||
callback.get(), is_include));
|
||||
}
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
@ -260,8 +262,8 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
|
||||
if (!canonical_cookie) {
|
||||
SetCookieCallbackImpl(
|
||||
callback, net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR));
|
||||
callback, net::CookieAccessResult(net::CookieInclusionStatus(
|
||||
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "mojo/public/cpp/base/big_buffer.h"
|
||||
#include "net/http/http_status_code.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "services/network/public/cpp/cors/cors.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "libcef/browser/osr/web_contents_view_osr.h"
|
||||
#include "libcef/common/drag_data_impl.h"
|
||||
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/task/current_thread.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
@ -482,7 +482,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
|
||||
CefRefPtr<CefDragDataImpl> drag_data(
|
||||
new CefDragDataImpl(drop_data, cef_image, cef_image_pos));
|
||||
drag_data->SetReadOnly(true);
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
base::CurrentThread::ScopedNestableTaskAllower allow;
|
||||
handled = handler->StartDragging(
|
||||
browser_, drag_data.get(),
|
||||
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
|
||||
|
@ -150,6 +150,12 @@ struct PopulateAxNodeAttributes {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kTextAlign: {
|
||||
auto state = static_cast<ax::mojom::TextAlign>(attr.second);
|
||||
if (ax::mojom::TextAlign::kNone != state) {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kNameFrom:
|
||||
attributes->SetString(
|
||||
ToString(attr.first),
|
||||
@ -173,8 +179,8 @@ struct PopulateAxNodeAttributes {
|
||||
}
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kTextDirection: {
|
||||
auto state = static_cast<ax::mojom::TextDirection>(attr.second);
|
||||
if (ax::mojom::TextDirection::kNone != state) {
|
||||
auto state = static_cast<ax::mojom::WritingDirection>(attr.second);
|
||||
if (ax::mojom::WritingDirection::kNone != state) {
|
||||
attributes->SetString(ToString(attr.first), ToString(state));
|
||||
}
|
||||
} break;
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "ui/gfx/geometry/size_conversions.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "ui/base/x/x11_cursor.h"
|
||||
#include "ui/base/x/x11_cursor_loader.h"
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#endif
|
||||
|
||||
@ -67,8 +67,8 @@ const size_t kMaxDamageRects = 10;
|
||||
|
||||
const float kDefaultScaleFactor = 1.0;
|
||||
|
||||
content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
|
||||
content::ScreenInfo screenInfo;
|
||||
blink::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
|
||||
blink::ScreenInfo screenInfo;
|
||||
screenInfo.device_scale_factor = src.device_scale_factor;
|
||||
screenInfo.depth = src.depth;
|
||||
screenInfo.depth_per_component = src.depth_per_component;
|
||||
@ -101,7 +101,7 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
|
||||
// may not match the page's, so use black as the gutter color to avoid
|
||||
// flashes of brighter colors during the transition.
|
||||
if (view_->render_widget_host()->delegate() &&
|
||||
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
|
||||
view_->render_widget_host()->delegate()->IsFullscreen()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return *view_->GetBackgroundColor();
|
||||
@ -197,7 +197,8 @@ ui::ImeTextSpan::UnderlineStyle GetImeUnderlineStyle(
|
||||
CefCursorHandle ToCursorHandle(ui::PlatformCursor cursor) {
|
||||
#if defined(USE_X11)
|
||||
// See https://crbug.com/1029142 for background.
|
||||
return static_cast<ui::X11Cursor*>(cursor)->xcursor();
|
||||
return static_cast<CefCursorHandle>(
|
||||
static_cast<ui::X11Cursor*>(cursor)->xcursor());
|
||||
#else
|
||||
return cursor;
|
||||
#endif
|
||||
@ -654,7 +655,7 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
|
||||
handler->OnCursorChange(browser_impl_.get(), platform_cursor, cursor_type,
|
||||
custom_cursor_info);
|
||||
#elif defined(OS_MACOSX)
|
||||
#elif defined(OS_MAC)
|
||||
// |web_cursor| owns the resulting |native_cursor|.
|
||||
content::WebCursor web_cursor(cursor);
|
||||
CefCursorHandle native_cursor = web_cursor.GetNativeCursor();
|
||||
@ -741,7 +742,7 @@ void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
|
||||
void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::ScreenInfo* results) {
|
||||
if (!browser_impl_.get())
|
||||
return;
|
||||
|
||||
@ -792,7 +793,7 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
|
||||
return GetViewBounds();
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
#if !defined(OS_MAC)
|
||||
viz::ScopedSurfaceIdAllocator
|
||||
CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
|
||||
const cc::RenderFrameMetadata& metadata) {
|
||||
@ -1443,13 +1444,16 @@ gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
current_device_scale_factor_);
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
void CefRenderWidgetHostViewOSR::SetActive(bool active) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ShowDefinitionForSelection() {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SpeakSelection() {}
|
||||
#endif
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetWindowFrameInScreen(const gfx::Rect& rect) {
|
||||
}
|
||||
#endif // defined(OS_MAC)
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
|
||||
const gfx::Size& pixel_size,
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "ui/events/gesture_detection/motion_event_generic.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
#include "content/browser/renderer_host/browser_compositor_view_mac.h"
|
||||
#endif
|
||||
|
||||
@ -65,8 +65,9 @@ class CefWebContentsViewOSR;
|
||||
|
||||
#if defined(USE_X11)
|
||||
namespace ui {
|
||||
class XScopedCursor;
|
||||
}
|
||||
class X11Cursor;
|
||||
class XCursorLoader;
|
||||
} // namespace ui
|
||||
class CefWindowX11;
|
||||
#endif
|
||||
|
||||
@ -88,7 +89,7 @@ class CefWindowX11;
|
||||
// RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
class MacHelper;
|
||||
#endif
|
||||
|
||||
@ -129,11 +130,12 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void UnlockMouse() override;
|
||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
void SetActive(bool active) override;
|
||||
void ShowDefinitionForSelection() override;
|
||||
void SpeakSelection() override;
|
||||
#endif // defined(OS_MACOSX)
|
||||
void SetWindowFrameInScreen(const gfx::Rect& rect) override;
|
||||
#endif // defined(OS_MAC)
|
||||
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
@ -152,11 +154,11 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const SkBitmap&)> callback) override;
|
||||
void GetScreenInfo(content::ScreenInfo* results) override;
|
||||
void GetScreenInfo(blink::ScreenInfo* results) override;
|
||||
void TransformPointToRootSurface(gfx::PointF* point) override;
|
||||
gfx::Rect GetBoundsInRootWindow() override;
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
#if !defined(OS_MAC)
|
||||
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
|
||||
const cc::RenderFrameMetadata& metadata) override;
|
||||
#endif
|
||||
@ -345,7 +347,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
viz::ParentLocalSurfaceIdAllocator compositor_local_surface_id_allocator_;
|
||||
|
||||
#if defined(USE_X11)
|
||||
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||
std::unique_ptr<ui::XCursorLoader> cursor_loader_;
|
||||
scoped_refptr<ui::X11Cursor> invisible_cursor_;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<content::CursorManager> cursor_manager_;
|
||||
|
@ -8,10 +8,11 @@
|
||||
#if defined(USE_X11)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#undef Status // Avoid conflicts with url_request_status.h
|
||||
|
||||
#include "libcef/browser/native/window_x11.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/base/x/x11_cursor_loader.h"
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/gfx/x/x11_types.h"
|
||||
#endif // defined(USE_X11)
|
||||
@ -176,6 +177,14 @@ XCursorCache* cursor_cache = nullptr;
|
||||
return cursor_cache->GetCursor(cursor_shape);
|
||||
}
|
||||
|
||||
// Based on ui/base/x/x11_cursor_factory.cc.
|
||||
scoped_refptr<ui::X11Cursor> CreateInvisibleCursor(
|
||||
ui::XCursorLoader* cursor_loader) {
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocN32Pixels(1, 1);
|
||||
return cursor_loader->CreateCursor(bitmap, gfx::Point(0, 0));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif // defined(USE_X11)
|
||||
|
||||
@ -184,10 +193,11 @@ CefCursorHandle CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
#if defined(USE_X11)
|
||||
if (type == ui::mojom::CursorType::kNone) {
|
||||
if (!invisible_cursor_) {
|
||||
invisible_cursor_.reset(new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
||||
gfx::GetXDisplay()));
|
||||
cursor_loader_ =
|
||||
std::make_unique<ui::XCursorLoader>(x11::Connection::Get());
|
||||
invisible_cursor_ = CreateInvisibleCursor(cursor_loader_.get());
|
||||
}
|
||||
return invisible_cursor_->get();
|
||||
return static_cast<::Cursor>(invisible_cursor_->xcursor());
|
||||
} else {
|
||||
return GetXCursor(ToCursorID(type));
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "libcef/browser/osr/synthetic_gesture_target_osr.h"
|
||||
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/common/screen_info.h"
|
||||
#include "ui/events/gesture_detection/gesture_configuration.h"
|
||||
|
||||
CefSyntheticGestureTargetOSR::CefSyntheticGestureTargetOSR(
|
||||
|
@ -138,11 +138,11 @@ void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
|
||||
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() {
|
||||
return false;
|
||||
}
|
||||
#endif // defined(OS_MACOSX)
|
||||
#endif // defined(OS_MAC)
|
||||
|
||||
void CefWebContentsViewOSR::StartDragging(
|
||||
const content::DropData& drop_data,
|
||||
|
@ -56,7 +56,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
content::RenderViewHost* new_host) override;
|
||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_MAC)
|
||||
bool CloseTabAfterEventTrackingIfNeeded() override;
|
||||
#endif
|
||||
|
||||
|
@ -299,10 +299,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
PrefsTabHelper::RegisterProfilePrefs(registry, locale);
|
||||
RegisterAnimationPolicyPrefs(registry);
|
||||
|
||||
// From chrome::RegisterBrowserUserPrefs.
|
||||
// From chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kEnableDoNotTrack, false,
|
||||
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
||||
registry->RegisterBooleanPref(prefs::kCaretBrowsingEnabled, false);
|
||||
|
||||
// TODO(guoweis): Remove next 2 options at M50.
|
||||
registry->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled, true);
|
||||
@ -311,7 +312,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
blink::kWebRTCIPHandlingDefault);
|
||||
registry->RegisterStringPref(prefs::kWebRTCUDPPortRange, std::string());
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
#if !defined(OS_MAC)
|
||||
registry->RegisterBooleanPref(prefs::kFullscreenAllowed, true);
|
||||
#endif
|
||||
|
||||
|
@ -122,7 +122,7 @@ bool CefPrintSettingsImpl::WillCollate() {
|
||||
|
||||
void CefPrintSettingsImpl::SetColorModel(ColorModel model) {
|
||||
CEF_VALUE_VERIFY_RETURN_VOID(true);
|
||||
mutable_value()->set_color(static_cast<printing::ColorModel>(model));
|
||||
mutable_value()->set_color(static_cast<printing::mojom::ColorModel>(model));
|
||||
}
|
||||
|
||||
CefPrintSettings::ColorModel CefPrintSettingsImpl::GetColorModel() {
|
||||
|
@ -224,7 +224,7 @@ void CefPrintDialogLinux::PrintDocument(
|
||||
success = metafile.SaveTo(&file);
|
||||
file.Close();
|
||||
if (!success)
|
||||
base::DeleteFile(path_to_pdf_, false);
|
||||
base::DeleteFile(path_to_pdf_);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
|
@ -60,7 +60,8 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
// Fixed settings.
|
||||
print_settings.SetIntKey(kSettingPrinterType,
|
||||
static_cast<int>(PrinterType::kPdf));
|
||||
print_settings.SetInteger(kSettingColor, GRAY);
|
||||
print_settings.SetInteger(kSettingColor,
|
||||
static_cast<int>(mojom::ColorModel::kGray));
|
||||
print_settings.SetInteger(kSettingDuplexMode,
|
||||
static_cast<int>(mojom::DuplexMode::kSimplex));
|
||||
print_settings.SetInteger(kSettingCopies, 1);
|
||||
@ -100,23 +101,23 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
print_settings.Set(kSettingMediaSize, std::move(dict));
|
||||
}
|
||||
|
||||
int margin_type = DEFAULT_MARGINS;
|
||||
auto margin_type = printing::mojom::MarginType::kDefaultMargins;
|
||||
switch (pdf_settings.margin_type) {
|
||||
case PDF_PRINT_MARGIN_NONE:
|
||||
margin_type = NO_MARGINS;
|
||||
margin_type = printing::mojom::MarginType::kNoMargins;
|
||||
break;
|
||||
case PDF_PRINT_MARGIN_MINIMUM:
|
||||
margin_type = PRINTABLE_AREA_MARGINS;
|
||||
margin_type = printing::mojom::MarginType::kPrintableAreaMargins;
|
||||
break;
|
||||
case PDF_PRINT_MARGIN_CUSTOM:
|
||||
margin_type = CUSTOM_MARGINS;
|
||||
margin_type = printing::mojom::MarginType::kCustomMargins;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
print_settings.SetInteger(kSettingMarginsType, margin_type);
|
||||
if (margin_type == CUSTOM_MARGINS) {
|
||||
print_settings.SetInteger(kSettingMarginsType, static_cast<int>(margin_type));
|
||||
if (margin_type == printing::mojom::MarginType::kCustomMargins) {
|
||||
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||
dict->SetInteger(kSettingMarginTop, pdf_settings.margin_top);
|
||||
dict->SetInteger(kSettingMarginRight, pdf_settings.margin_right);
|
||||
@ -301,7 +302,7 @@ void CefPrintViewManager::OnRequestPrintPreview_PrintToPdf(
|
||||
|
||||
void CefPrintViewManager::OnMetafileReadyForPrinting_PrintToPdf(
|
||||
content::RenderFrameHost* rfh,
|
||||
const PrintHostMsg_DidPreviewDocument_Params& params,
|
||||
const mojom::DidPreviewDocumentParams& params,
|
||||
const PrintHostMsg_PreviewIds& ids) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
StopWorker(params.document_cookie);
|
||||
@ -318,7 +319,7 @@ void CefPrintViewManager::OnMetafileReadyForPrinting_PrintToPdf(
|
||||
print_render_frame_remote->OnPrintPreviewDialogClosed();
|
||||
|
||||
auto shared_buf = base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(
|
||||
params.content.metafile_data_region);
|
||||
params.content->metafile_data_region);
|
||||
if (!shared_buf) {
|
||||
TerminatePdfPrintJob();
|
||||
return;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "components/printing/common/print.mojom-forward.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
|
||||
@ -19,7 +20,6 @@ class WebContentsObserver;
|
||||
|
||||
class CefBrowserInfo;
|
||||
|
||||
struct PrintHostMsg_DidPreviewDocument_Params;
|
||||
struct PrintHostMsg_PreviewIds;
|
||||
struct PrintHostMsg_RequestPrintPreview_Params;
|
||||
|
||||
@ -85,7 +85,7 @@ class CefPrintViewManager
|
||||
void OnDidShowPrintDialog_PrintToPdf(content::RenderFrameHost* rfh);
|
||||
void OnMetafileReadyForPrinting_PrintToPdf(
|
||||
content::RenderFrameHost* rfh,
|
||||
const PrintHostMsg_DidPreviewDocument_Params& params,
|
||||
const mojom::DidPreviewDocumentParams& params,
|
||||
const PrintHostMsg_PreviewIds& ids);
|
||||
void InitializePrintPreview(int frame_tree_node_id);
|
||||
void TerminatePdfPrintJob();
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/child_process_host.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
@ -139,8 +140,8 @@ void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
|
||||
// will hang until the settings are retrieved.
|
||||
auto* printer_query_ptr = printer_query.get();
|
||||
printer_query_ptr->GetSettings(
|
||||
PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false, DEFAULT_MARGINS,
|
||||
false, false,
|
||||
PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false,
|
||||
printing::mojom::MarginType::kDefaultMargins, false, false,
|
||||
base::BindOnce(&CefPrintingMessageFilter::OnGetDefaultPrintSettingsReply,
|
||||
this, std::move(printer_query), reply_msg));
|
||||
}
|
||||
@ -148,11 +149,8 @@ void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
|
||||
void CefPrintingMessageFilter::OnGetDefaultPrintSettingsReply(
|
||||
std::unique_ptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg) {
|
||||
PrintMsg_Print_Params params;
|
||||
if (!printer_query.get() ||
|
||||
printer_query->last_status() != PrintingContext::OK) {
|
||||
params.Reset();
|
||||
} else {
|
||||
mojom::PrintParams params;
|
||||
if (printer_query && printer_query->last_status() == PrintingContext::OK) {
|
||||
RenderParamsFromPrintSettings(printer_query->settings(), ¶ms);
|
||||
params.document_cookie = printer_query->cookie();
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ CEF_BUTTON_IMPL_T class CefButtonImpl : public CEF_VIEW_IMPL_D {
|
||||
|
||||
CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
views::Button::ButtonState old_state = ParentClass::root_view()->state();
|
||||
views::Button::ButtonState old_state = ParentClass::root_view()->GetState();
|
||||
views::Button::ButtonState new_state =
|
||||
static_cast<views::Button::ButtonState>(state);
|
||||
|
||||
@ -72,7 +72,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetState(cef_button_state_t state) {
|
||||
|
||||
CEF_BUTTON_IMPL_T cef_button_state_t CEF_BUTTON_IMPL_D::GetState() {
|
||||
CEF_REQUIRE_VALID_RETURN(CEF_BUTTON_STATE_NORMAL);
|
||||
return static_cast<cef_button_state_t>(ParentClass::root_view()->state());
|
||||
return static_cast<cef_button_state_t>(ParentClass::root_view()->GetState());
|
||||
}
|
||||
|
||||
CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetInkDropEnabled(bool enabled) {
|
||||
|
@ -61,7 +61,7 @@ CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::ButtonPressed(
|
||||
ParentClass::cef_delegate()->OnButtonPressed(GetCefButton());
|
||||
if (ParentClass::ink_drop_mode() != views::Button::InkDropMode::OFF &&
|
||||
!ParentClass::IsFocusable() &&
|
||||
ParentClass::state() != views::Button::STATE_PRESSED) {
|
||||
ParentClass::GetState() != views::Button::STATE_PRESSED) {
|
||||
// Ink drop state does not get reset properly on click when the button is
|
||||
// non-focusable. Reset the ink drop state here if the state has not been
|
||||
// explicitly set to pressed by the OnButtonPressed callback calling
|
||||
|
@ -18,7 +18,7 @@
|
||||
// CefButtonView template.
|
||||
class MenuButtonEx : public views::MenuButton, public views::ButtonListener {
|
||||
public:
|
||||
MenuButtonEx() : views::MenuButton(base::string16(), this) {
|
||||
MenuButtonEx() : views::MenuButton(this, base::string16()) {
|
||||
// TODO(cef): MenuButton should not use ButtonListener. See
|
||||
// http://crbug.com/585252 for details.
|
||||
Button::listener_ = this;
|
||||
|
@ -36,7 +36,11 @@ class ClientViewEx : public views::ClientView {
|
||||
DCHECK(window_delegate_);
|
||||
}
|
||||
|
||||
bool CanClose() override { return window_delegate_->CanWidgetClose(); }
|
||||
views::CloseRequestResult OnWindowCloseRequested() override {
|
||||
return window_delegate_->CanWidgetClose()
|
||||
? views::CloseRequestResult::kCanClose
|
||||
: views::CloseRequestResult::kCannotClose;
|
||||
}
|
||||
|
||||
private:
|
||||
CefWindowView::Delegate* window_delegate_; // Not owned by this object.
|
||||
@ -404,15 +408,15 @@ views::ClientView* CefWindowView::CreateClientView(views::Widget* widget) {
|
||||
return new ClientViewEx(widget, GetContentsView(), window_delegate_);
|
||||
}
|
||||
|
||||
views::NonClientFrameView* CefWindowView::CreateNonClientFrameView(
|
||||
views::Widget* widget) {
|
||||
std::unique_ptr<views::NonClientFrameView>
|
||||
CefWindowView::CreateNonClientFrameView(views::Widget* widget) {
|
||||
if (is_frameless_) {
|
||||
// Custom frame type that doesn't render a caption.
|
||||
return new CaptionlessFrameView(widget, this);
|
||||
return std::make_unique<CaptionlessFrameView>(widget, this);
|
||||
} else if (widget->ShouldUseNativeFrame()) {
|
||||
// DesktopNativeWidgetAura::CreateNonClientFrameView() returns
|
||||
// NativeFrameView by default. Extend that type.
|
||||
return new NativeFrameViewEx(widget, this);
|
||||
return std::make_unique<NativeFrameViewEx>(widget, this);
|
||||
}
|
||||
|
||||
// Use Chromium provided CustomFrameView. In case if we would like to
|
||||
|
@ -63,7 +63,7 @@ class CefWindowView
|
||||
void WindowClosing() override;
|
||||
views::View* GetContentsView() override;
|
||||
views::ClientView* CreateClientView(views::Widget* widget) override;
|
||||
views::NonClientFrameView* CreateNonClientFrameView(
|
||||
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
|
||||
views::Widget* widget) override;
|
||||
bool ShouldDescendIntoChildForEventHandling(
|
||||
gfx::NativeView child,
|
||||
|
Reference in New Issue
Block a user