mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9aea513c1c | ||
|
df2fcc86b7 | ||
|
6d8faa4942 | ||
|
7c74b173ae | ||
|
b3c8970bae | ||
|
ee28c52b2d | ||
|
396e93c645 | ||
|
e5b78a54cf | ||
|
aabe4c4cfc | ||
|
a42963aa05 | ||
|
4b48a153c7 | ||
|
fcd71ff604 | ||
|
e81cdf2664 | ||
|
b7e0359c52 | ||
|
0357a228bd | ||
|
500aec0399 | ||
|
142c56012f | ||
|
b46a26f6a4 | ||
|
29552e0ff5 | ||
|
f406a7400a | ||
|
db41052eac | ||
|
503b1176a5 | ||
|
2e7b0e4a16 | ||
|
f4dd8c19ff |
7
BUILD.gn
7
BUILD.gn
@@ -118,6 +118,7 @@ if (is_clang) {
|
||||
}
|
||||
if (is_linux) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
import("//third_party/fontconfig/fontconfig.gni")
|
||||
}
|
||||
if (is_mac) {
|
||||
import("//build/config/mac/rules.gni")
|
||||
@@ -148,6 +149,12 @@ if (is_clang) {
|
||||
assert(!clang_use_chrome_plugins)
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
||||
# issue #2424).
|
||||
assert(!use_bundled_fontconfig)
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
# Always generate dSYM files. The make_distrib script will fail if
|
||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||
|
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'bc084a8b5afa3744a74927344e304c02ae54189f',
|
||||
'chromium_checkout': 'refs/tags/65.0.3325.181',
|
||||
}
|
||||
|
@@ -198,9 +198,12 @@ if(OS_LINUX)
|
||||
set(CEF_BINARY_FILES
|
||||
chrome-sandbox
|
||||
libcef.so
|
||||
libEGL.so
|
||||
libGLESv2.so
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
swiftshader
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
@@ -350,6 +353,13 @@ if(OS_WINDOWS)
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
# Consumers using different runtime types may want to pass different flags
|
||||
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
|
||||
if (CEF_RUNTIME_LIBRARY_FLAG)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
|
||||
endif()
|
||||
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
@@ -369,12 +379,10 @@ if(OS_WINDOWS)
|
||||
${CEF_DEBUG_INFO_FLAG}
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Optimize for maximum speed
|
||||
/Ob2 # Inline any suitable function
|
||||
/GF # Enable string pooling
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e0605a0c9918e225b9282b6d5e6138a7d697945b$
|
||||
// $hash=00e6d1aa80d5998d89cc272dcb199cde0add12fa$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -159,6 +159,16 @@ typedef struct _cef_cookie_manager_t {
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
||||
///
|
||||
// Returns a cookie manager that neither stores nor retrieves cookies. All usage
|
||||
// of cookies will be blocked including cookies accessed via the network
|
||||
// (request/response headers), via JavaScript (document.cookie), and via
|
||||
// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If
|
||||
// you wish to only block cookies sent via the network use the
|
||||
// cef_request_tHandler CanGetCookies and CanSetCookie functions instead.
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager();
|
||||
|
||||
///
|
||||
// Creates a new cookie manager. If |path| is NULL data will be stored in memory
|
||||
// only. Otherwise, data will be stored at the specified |path|. To persist
|
||||
|
@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Continue the authentication request.
|
||||
///
|
||||
/*--cef(capi_name=cont,optional_param=password)--*/
|
||||
/*--cef(capi_name=cont,optional_param=username,optional_param=password)--*/
|
||||
virtual void Continue(const CefString& username,
|
||||
const CefString& password) = 0;
|
||||
|
||||
|
@@ -64,6 +64,17 @@ class CefCookieManager : public virtual CefBaseRefCounted {
|
||||
static CefRefPtr<CefCookieManager> GetGlobalManager(
|
||||
CefRefPtr<CefCompletionCallback> callback);
|
||||
|
||||
///
|
||||
// Returns a cookie manager that neither stores nor retrieves cookies. All
|
||||
// usage of cookies will be blocked including cookies accessed via the network
|
||||
// (request/response headers), via JavaScript (document.cookie), and via
|
||||
// CefCookieManager methods. No cookies will be displayed in DevTools. If you
|
||||
// wish to only block cookies sent via the network use the CefRequestHandler
|
||||
// CanGetCookies and CanSetCookie methods instead.
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefCookieManager> GetBlockingManager();
|
||||
|
||||
///
|
||||
// Creates a new cookie manager. If |path| is empty data will be stored in
|
||||
// memory only. Otherwise, data will be stored at the specified |path|. To
|
||||
|
@@ -120,7 +120,8 @@ net::CookieStore* GetExistingCookieStoreHelper(
|
||||
|
||||
} // namespace
|
||||
|
||||
CefCookieManagerImpl::CefCookieManagerImpl() : weak_ptr_factory_(this) {}
|
||||
CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking)
|
||||
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
|
||||
|
||||
CefCookieManagerImpl::~CefCookieManagerImpl() {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -131,6 +132,7 @@ void CefCookieManagerImpl::Initialize(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CHECK(!is_blocking_);
|
||||
if (request_context.get()) {
|
||||
request_context_ = request_context;
|
||||
request_context_->GetRequestContextImpl(
|
||||
@@ -160,7 +162,7 @@ void CefCookieManagerImpl::GetCookieStore(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(cookie_store_.get());
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
|
||||
// Binding ref-counted |this| to CookieStoreGetter may result in
|
||||
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
||||
@@ -192,7 +194,9 @@ net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
DCHECK(is_blocking_);
|
||||
if (!is_blocking_)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -495,12 +499,11 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(cookie_store_.get());
|
||||
if (!cookie_store_.get())
|
||||
return;
|
||||
|
||||
supported_schemes_ = schemes;
|
||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
if (cookie_store_) {
|
||||
supported_schemes_ = schemes;
|
||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
||||
}
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
@@ -552,8 +555,13 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string name = CefString(&cookie.name).ToString();
|
||||
std::string value = CefString(&cookie.value).ToString();
|
||||
@@ -584,8 +592,13 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.is_empty()) {
|
||||
// Delete all cookies.
|
||||
@@ -610,8 +623,10 @@ void CefCookieManagerImpl::FlushStoreInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback));
|
||||
}
|
||||
@@ -631,6 +646,11 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
|
||||
callback);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
|
||||
return new CefCookieManagerImpl(true);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
const CefString& path,
|
||||
@@ -642,7 +662,8 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager =
|
||||
new CefCookieManagerImpl(false);
|
||||
cookie_manager->Initialize(NULL, path, persist_session_cookies, callback);
|
||||
return cookie_manager.get();
|
||||
}
|
||||
|
@@ -18,10 +18,11 @@
|
||||
// Implementation of the CefCookieManager interface.
|
||||
class CefCookieManagerImpl : public CefCookieManager {
|
||||
public:
|
||||
CefCookieManagerImpl();
|
||||
explicit CefCookieManagerImpl(bool is_blocking);
|
||||
~CefCookieManagerImpl() override;
|
||||
|
||||
// Must be called immediately after this object is created.
|
||||
// Must be called immediately after this object is created when |is_blocking|
|
||||
// is false.
|
||||
void Initialize(CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
@@ -113,6 +114,9 @@ class CefCookieManagerImpl : public CefCookieManager {
|
||||
void FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback,
|
||||
const CookieStoreGetter& cookie_store_getter);
|
||||
|
||||
// If true all cookies will be blocked.
|
||||
const bool is_blocking_;
|
||||
|
||||
// Used for cookie monsters owned by the context.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_;
|
||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
|
||||
|
@@ -384,4 +384,6 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetSystemUptime());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -469,4 +469,6 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
|
||||
|
||||
// timestamp - Mac OSX specific
|
||||
result.SetTimeStampSeconds(currentEventTimestamp());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
|
||||
@@ -95,6 +96,31 @@ void ExecuteExternalProtocol(const GURL& url) {
|
||||
ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
// DPI value for 1x scale factor.
|
||||
#define DPI_1X 96.0f
|
||||
|
||||
float GetWindowScaleFactor(HWND hwnd) {
|
||||
DCHECK(hwnd);
|
||||
|
||||
if (base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// Let Windows tell us the correct DPI.
|
||||
static auto get_dpi_for_window_func = []() {
|
||||
return reinterpret_cast<decltype(::GetDpiForWindow)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow"));
|
||||
}();
|
||||
if (get_dpi_for_window_func)
|
||||
return static_cast<float>(get_dpi_for_window_func(hwnd)) / DPI_1X;
|
||||
}
|
||||
|
||||
// Fallback to the monitor that contains the window center point.
|
||||
RECT cr;
|
||||
GetWindowRect(hwnd, &cr);
|
||||
return display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(
|
||||
gfx::Point((cr.right - cr.left) / 2, (cr.bottom - cr.top) / 2))
|
||||
.device_scale_factor();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin(
|
||||
@@ -117,40 +143,49 @@ void CefBrowserPlatformDelegateNativeWin::BrowserDestroyed(
|
||||
bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
RegisterWindowClass();
|
||||
|
||||
has_frame_ = !(window_info_.style & WS_CHILD);
|
||||
|
||||
std::wstring windowName(CefString(&window_info_.window_name));
|
||||
|
||||
// Create the new browser window.
|
||||
window_info_.window = CreateWindowEx(
|
||||
window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y, window_info_.width,
|
||||
window_info_.height, window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), NULL);
|
||||
CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y,
|
||||
window_info_.width, window_info_.height,
|
||||
window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), this);
|
||||
|
||||
// It's possible for CreateWindowEx to fail if the parent window was
|
||||
// destroyed between the call to CreateBrowser and the above one.
|
||||
DCHECK(window_info_.window != NULL);
|
||||
DCHECK(window_info_.window);
|
||||
if (!window_info_.window)
|
||||
return false;
|
||||
|
||||
host_window_created_ = true;
|
||||
|
||||
// Set window user data to this object for future reference from the window
|
||||
// procedure.
|
||||
gfx::SetWindowUserData(window_info_.window, this);
|
||||
|
||||
// Add a reference that will later be released in DestroyBrowser().
|
||||
browser_->AddRef();
|
||||
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
if (!called_enable_non_client_dpi_scaling_ && has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions < 10.0.14393.0.
|
||||
// Derived signature; not available in headers.
|
||||
static auto enable_child_window_dpi_message_func = []() {
|
||||
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
|
||||
return reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
|
||||
}();
|
||||
if (enable_child_window_dpi_message_func)
|
||||
enable_child_window_dpi_message_func(window_info_.window, TRUE);
|
||||
}
|
||||
|
||||
DCHECK(!window_widget_);
|
||||
|
||||
// Adjust for potential display scaling.
|
||||
// Convert from device coordinates to logical coordinates.
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
gfx::Point point = gfx::Point(cr.right, cr.bottom);
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(point)
|
||||
.device_scale_factor();
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
point =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||
|
||||
@@ -270,19 +305,19 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
|
||||
if (windowless_handler_)
|
||||
return windowless_handler_->GetParentScreenPoint(view);
|
||||
|
||||
if (!window_widget_)
|
||||
if (!window_info_.window)
|
||||
return view;
|
||||
|
||||
aura::Window* window = window_widget_->GetNativeView();
|
||||
const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen();
|
||||
const gfx::Point& screen_point = gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
bounds_in_screen.y() + view.y());
|
||||
// Convert from logical coordinates to device coordinates.
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
const gfx::Point& device_pt =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(view), scale));
|
||||
|
||||
// Adjust for potential display scaling.
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(screen_point)
|
||||
.device_scale_factor();
|
||||
return gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(screen_point), scale));
|
||||
// Convert from client coordinates to screen coordinates.
|
||||
POINT screen_pt = {device_pt.x(), device_pt.y()};
|
||||
ClientToScreen(window_info_.window, &screen_pt);
|
||||
|
||||
return gfx::Point(screen_pt.x, screen_pt.y);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
|
||||
@@ -524,6 +559,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -562,12 +599,15 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate =
|
||||
static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr;
|
||||
CefBrowserHostImpl* browser = nullptr;
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
|
||||
if (message != WM_NCCREATE) {
|
||||
platform_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
}
|
||||
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
@@ -579,6 +619,31 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
// Allow the close.
|
||||
break;
|
||||
|
||||
case WM_NCCREATE: {
|
||||
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
platform_delegate =
|
||||
reinterpret_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
cs->lpCreateParams);
|
||||
DCHECK(platform_delegate);
|
||||
// Associate |platform_delegate| with the window handle.
|
||||
gfx::SetWindowUserData(hwnd, platform_delegate);
|
||||
platform_delegate->window_info_.window = hwnd;
|
||||
|
||||
if (platform_delegate->has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when
|
||||
// WM_DPICHANGED is fired on Windows versions >= 10.0.14393.0.
|
||||
static auto enable_non_client_dpi_scaling_func = []() {
|
||||
return reinterpret_cast<decltype(::EnableNonClientDpiScaling)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"),
|
||||
"EnableNonClientDpiScaling"));
|
||||
}();
|
||||
platform_delegate->called_enable_non_client_dpi_scaling_ =
|
||||
!!(enable_non_client_dpi_scaling_func &&
|
||||
enable_non_client_dpi_scaling_func(hwnd));
|
||||
}
|
||||
} break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if (platform_delegate) {
|
||||
// Clear the user data pointer.
|
||||
@@ -617,6 +682,17 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 0;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
if (platform_delegate && platform_delegate->has_frame_) {
|
||||
// Suggested size and position of the current window scaled for the
|
||||
// new DPI.
|
||||
const RECT* rect = reinterpret_cast<RECT*>(lParam);
|
||||
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left,
|
||||
rect->top, rect->right - rect->left,
|
||||
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
|
@@ -68,6 +68,9 @@ class CefBrowserPlatformDelegateNativeWin
|
||||
// Widget hosting the web contents. It will be deleted automatically when the
|
||||
// associated root window is destroyed.
|
||||
views::Widget* window_widget_;
|
||||
|
||||
bool has_frame_ = false;
|
||||
bool called_enable_non_client_dpi_scaling_ = false;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_WIN_H_
|
||||
|
@@ -33,6 +33,8 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +48,8 @@ void CefCookieStoreProxy::SetCanonicalCookieAsync(
|
||||
cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source,
|
||||
modify_http_only,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +58,11 @@ void CefCookieStoreProxy::GetCookiesWithOptionsAsync(
|
||||
const net::CookieOptions& options,
|
||||
GetCookiesCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetCookiesWithOptionsAsync(url, options, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(std::string());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
|
||||
@@ -63,31 +70,43 @@ void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
|
||||
const net::CookieOptions& options,
|
||||
GetCookieListCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetCookieListWithOptionsAsync(url, options,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(net::CookieList());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::GetAllCookiesAsync(GetCookieListCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetAllCookiesAsync(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(net::CookieList());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url,
|
||||
const std::string& cookie_name,
|
||||
base::OnceClosure callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteCookieAsync(url, cookie_name, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
|
||||
const net::CanonicalCookie& cookie,
|
||||
DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteCanonicalCookieAsync(cookie, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
|
||||
@@ -98,6 +117,8 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,19 +131,27 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
delete_begin, delete_end, predicate, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteSessionCookiesAsync(DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteSessionCookiesAsync(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->FlushStore(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<net::CookieStore::CookieChangedSubscription>
|
||||
@@ -131,8 +160,9 @@ CefCookieStoreProxy::AddCallbackForCookie(
|
||||
const std::string& name,
|
||||
const CookieChangedCallback& callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
return cookie_store->AddCallbackForCookie(url, name, callback);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -140,8 +170,9 @@ std::unique_ptr<net::CookieStore::CookieChangedSubscription>
|
||||
CefCookieStoreProxy::AddCallbackForAllChanges(
|
||||
const CookieChangedCallback& callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
return cookie_store->AddCallbackForAllChanges(callback);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -155,25 +186,23 @@ bool CefCookieStoreProxy::IsEphemeral() {
|
||||
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = nullptr;
|
||||
|
||||
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
||||
if (manager.get()) {
|
||||
// Use the cookie store provided by the manager.
|
||||
cookie_store = reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
DCHECK(cookie_store);
|
||||
return cookie_store;
|
||||
// Use the cookie store provided by the manager. May be nullptr if the
|
||||
// cookie manager is blocking.
|
||||
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
}
|
||||
|
||||
DCHECK(parent_);
|
||||
if (parent_) {
|
||||
// Use the cookie store from the parent.
|
||||
cookie_store = parent_->cookie_store();
|
||||
net::CookieStore* cookie_store = parent_->cookie_store();
|
||||
DCHECK(cookie_store);
|
||||
if (!cookie_store)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
return cookie_store;
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -328,6 +328,14 @@ bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefResourceRequestJob::GetCharset(std::string* charset) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (net::HttpResponseHeaders *headers = GetResponseHeaders())
|
||||
return headers->GetCharset(charset);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::SendHeaders() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
|
@@ -40,6 +40,7 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
|
||||
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
|
||||
bool GetMimeType(std::string* mime_type) const override;
|
||||
bool GetCharset(std::string* charset) override;
|
||||
|
||||
void SendHeaders();
|
||||
|
||||
|
@@ -135,9 +135,10 @@ CefWebContentsViewOSR::CreateViewForPopupWidget(
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
// |view| will be nullptr the first time this method is called for popup
|
||||
// browsers.
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (!host)
|
||||
return;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
@@ -120,6 +120,11 @@ void CefPrintViewManagerBase::PrintDocument(
|
||||
print_job_->StartPdfToEmfConversion(print_data, page_size, content_area,
|
||||
print_text_with_gdi);
|
||||
}
|
||||
// Indicate that the PDF is fully rendered and we no longer need the renderer
|
||||
// and web contents, so the print job does not need to be cancelled if they
|
||||
// die. This is needed on Windows because the PrintedDocument will not be
|
||||
// considered complete until PDF conversion finishes.
|
||||
document->SetConvertingPdf();
|
||||
#else
|
||||
std::unique_ptr<PdfMetafileSkia> metafile =
|
||||
std::make_unique<PdfMetafileSkia>(SkiaDocumentType::PDF);
|
||||
@@ -346,18 +351,18 @@ bool CefPrintViewManagerBase::RenderAllMissingPagesNow() {
|
||||
if (!print_job_.get() || !print_job_->is_job_pending())
|
||||
return false;
|
||||
|
||||
// We can't print if there is no renderer.
|
||||
if (!web_contents() || !web_contents()->GetRenderViewHost() ||
|
||||
!web_contents()->GetRenderViewHost()->IsRenderViewLive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is the document already complete?
|
||||
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
||||
printing_succeeded_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// We can't print if there is no renderer.
|
||||
if (!web_contents() || !web_contents()->GetRenderViewHost() ||
|
||||
!web_contents()->GetRenderViewHost()->IsRenderViewLive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// WebContents is either dying or a second consecutive request to print
|
||||
// happened before the first had time to finish. We need to render all the
|
||||
// pages in an hurry if a print_job_ is still pending. No need to wait for it
|
||||
|
@@ -293,7 +293,8 @@ CefString CefRequestContextImpl::GetCachePath() {
|
||||
|
||||
CefRefPtr<CefCookieManager> CefRequestContextImpl::GetDefaultCookieManager(
|
||||
CefRefPtr<CefCompletionCallback> callback) {
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager =
|
||||
new CefCookieManagerImpl(false);
|
||||
cookie_manager->Initialize(this, CefString(), false, callback);
|
||||
return cookie_manager.get();
|
||||
}
|
||||
|
@@ -4,12 +4,6 @@
|
||||
|
||||
#include "include/base/cef_build.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
#include <shellscalingapi.h>
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_logging_internal.h"
|
||||
#include "include/internal/cef_thread_internal.h"
|
||||
#include "include/internal/cef_trace_event_internal.h"
|
||||
@@ -19,50 +13,8 @@
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "base/win/windows_version.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Implementation from chrome/app/chrome_exe_main_win.cc.
|
||||
|
||||
// Win8.1 supports monitor-specific DPI scaling.
|
||||
bool SetProcessDpiAwarenessWrapper(PROCESS_DPI_AWARENESS value) {
|
||||
typedef HRESULT(WINAPI * SetProcessDpiAwarenessPtr)(PROCESS_DPI_AWARENESS);
|
||||
SetProcessDpiAwarenessPtr set_process_dpi_awareness_func =
|
||||
reinterpret_cast<SetProcessDpiAwarenessPtr>(GetProcAddress(
|
||||
GetModuleHandleA("user32.dll"), "SetProcessDpiAwarenessInternal"));
|
||||
if (set_process_dpi_awareness_func) {
|
||||
HRESULT hr = set_process_dpi_awareness_func(value);
|
||||
if (SUCCEEDED(hr)) {
|
||||
VLOG(1) << "SetProcessDpiAwareness succeeded.";
|
||||
return true;
|
||||
} else if (hr == E_ACCESSDENIED) {
|
||||
LOG(ERROR) << "Access denied error from SetProcessDpiAwareness. "
|
||||
"Function called twice, or manifest was used.";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// This function works for Windows Vista through Win8. Win8.1 must use
|
||||
// SetProcessDpiAwareness[Wrapper].
|
||||
BOOL SetProcessDPIAwareWrapper() {
|
||||
typedef BOOL(WINAPI * SetProcessDPIAwarePtr)(VOID);
|
||||
SetProcessDPIAwarePtr set_process_dpi_aware_func =
|
||||
reinterpret_cast<SetProcessDPIAwarePtr>(
|
||||
GetProcAddress(GetModuleHandleA("user32.dll"), "SetProcessDPIAware"));
|
||||
return set_process_dpi_aware_func && set_process_dpi_aware_func();
|
||||
}
|
||||
|
||||
void EnableHighDPISupport() {
|
||||
if (!SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) {
|
||||
SetProcessDPIAwareWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // defined(OS_WIN)
|
||||
#include "base/win/win_util.h"
|
||||
#endif
|
||||
|
||||
// The contents of this file are a compilation unit that is not called by other
|
||||
// functions in the the library. Consiquently MSVS will exclude it during the
|
||||
@@ -399,10 +351,6 @@ cef_get_current_platform_thread_handle() {
|
||||
|
||||
void CefEnableHighDPISupport() {
|
||||
#if defined(OS_WIN)
|
||||
// We don't want to set DPI awareness on pre-Win7 because we don't support
|
||||
// DirectWrite there. GDI fonts are kerned very badly, so better to leave
|
||||
// DPI-unaware and at effective 1.0. See also ShouldUseDirectWrite().
|
||||
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
|
||||
EnableHighDPISupport();
|
||||
base::win::EnableHighDPISupport();
|
||||
#endif
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "base/environment.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
@@ -239,6 +240,29 @@ std::string NormalizeCrashKey(const base::StringPiece& key) {
|
||||
return str;
|
||||
}
|
||||
|
||||
void ParseURL(const std::string& value, std::string* url) {
|
||||
if (value.find("http://") == 0 || value.find("https://") == 0) {
|
||||
*url = value;
|
||||
if (url->rfind('/') <= 8) {
|
||||
// Make sure the URL includes a path component. Otherwise, crash
|
||||
// upload will fail on older Windows versions due to
|
||||
// https://crbug.com/826564.
|
||||
*url += "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ParseBool(const std::string& value) {
|
||||
return base::EqualsCaseInsensitiveASCII(value, "true") || value == "1";
|
||||
}
|
||||
|
||||
int ParseZeroBasedInt(const std::string& value) {
|
||||
int int_val;
|
||||
if (base::StringToInt(value, &int_val) && int_val > 0)
|
||||
return int_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(OS_WIN)
|
||||
@@ -387,30 +411,19 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
|
||||
|
||||
if (current_section == kConfigSection) {
|
||||
if (name_str == "ServerURL") {
|
||||
if (val_str.find("http://") == 0 || val_str.find("https://") == 0)
|
||||
server_url_ = val_str;
|
||||
ParseURL(val_str, &server_url_);
|
||||
} else if (name_str == "ProductName") {
|
||||
product_name_ = val_str;
|
||||
} else if (name_str == "ProductVersion") {
|
||||
product_version_ = val_str;
|
||||
} else if (name_str == "RateLimitEnabled") {
|
||||
rate_limit_ = (base::EqualsCaseInsensitiveASCII(val_str, "true") ||
|
||||
val_str == "1");
|
||||
rate_limit_ = ParseBool(val_str);
|
||||
} else if (name_str == "MaxUploadsPerDay") {
|
||||
if (base::StringToInt(val_str, &max_uploads_)) {
|
||||
if (max_uploads_ < 0)
|
||||
max_uploads_ = 0;
|
||||
}
|
||||
max_uploads_ = ParseZeroBasedInt(val_str);
|
||||
} else if (name_str == "MaxDatabaseSizeInMb") {
|
||||
if (base::StringToInt(val_str, &max_db_size_)) {
|
||||
if (max_db_size_ < 0)
|
||||
max_db_size_ = 0;
|
||||
}
|
||||
max_db_size_ = ParseZeroBasedInt(val_str);
|
||||
} else if (name_str == "MaxDatabaseAgeInDays") {
|
||||
if (base::StringToInt(val_str, &max_db_age_)) {
|
||||
if (max_db_age_ < 0)
|
||||
max_db_age_ = 0;
|
||||
}
|
||||
max_db_age_ = ParseZeroBasedInt(val_str);
|
||||
}
|
||||
#if defined(OS_WIN)
|
||||
else if (name_str == "ExternalHandler") {
|
||||
@@ -425,9 +438,7 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
|
||||
}
|
||||
#elif defined(OS_MACOSX)
|
||||
else if (name_str == "BrowserCrashForwardingEnabled") {
|
||||
enable_browser_crash_forwarding_ =
|
||||
(base::EqualsCaseInsensitiveASCII(val_str, "true") ||
|
||||
val_str == "1");
|
||||
enable_browser_crash_forwarding_ = ParseBool(val_str);
|
||||
}
|
||||
#endif
|
||||
} else if (current_section == kCrashKeysSection) {
|
||||
@@ -499,6 +510,19 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
|
||||
}
|
||||
}
|
||||
|
||||
// Allow override of some values via environment variables.
|
||||
{
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
std::string val_str;
|
||||
|
||||
if (env->GetVar("CEF_CRASH_REPORTER_SERVER_URL", &val_str)) {
|
||||
ParseURL(val_str, &server_url_);
|
||||
}
|
||||
if (env->GetVar("CEF_CRASH_REPORTER_RATE_LIMIT_ENABLED", &val_str)) {
|
||||
rate_limit_ = ParseBool(val_str);
|
||||
}
|
||||
}
|
||||
|
||||
has_crash_config_file_ = true;
|
||||
return true;
|
||||
}
|
||||
|
@@ -310,7 +310,7 @@ class V8FunctionData {
|
||||
public:
|
||||
static v8::Local<v8::External> Create(v8::Isolate* isolate,
|
||||
const CefString& function_name,
|
||||
CefV8Handler* handler) {
|
||||
CefRefPtr<CefV8Handler> handler) {
|
||||
// |data| will be deleted if/when the returned v8::External is GC'd.
|
||||
V8FunctionData* data = new V8FunctionData(isolate, function_name, handler);
|
||||
return data->CreateExternal();
|
||||
@@ -323,12 +323,16 @@ class V8FunctionData {
|
||||
|
||||
CefString function_name() const { return function_name_; }
|
||||
|
||||
CefV8Handler* handler() const { return handler_; }
|
||||
CefV8Handler* handler() const {
|
||||
if (!handler_)
|
||||
return nullptr;
|
||||
return handler_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
V8FunctionData(v8::Isolate* isolate,
|
||||
const CefString& function_name,
|
||||
CefV8Handler* handler)
|
||||
CefRefPtr<CefV8Handler> handler)
|
||||
: isolate_(isolate), function_name_(function_name), handler_(handler) {
|
||||
DCHECK(isolate_);
|
||||
DCHECK(handler_);
|
||||
@@ -337,6 +341,8 @@ class V8FunctionData {
|
||||
~V8FunctionData() {
|
||||
isolate_->AdjustAmountOfExternalAllocatedMemory(
|
||||
-static_cast<int>(sizeof(V8FunctionData)));
|
||||
handler_ = nullptr;
|
||||
function_name_ = "FreedFunction";
|
||||
}
|
||||
|
||||
v8::Local<v8::External> CreateExternal() {
|
||||
@@ -366,7 +372,7 @@ class V8FunctionData {
|
||||
|
||||
v8::Isolate* isolate_;
|
||||
CefString function_name_;
|
||||
CefV8Handler* handler_;
|
||||
CefRefPtr<CefV8Handler> handler_;
|
||||
v8::Persistent<v8::External> handle_;
|
||||
};
|
||||
|
||||
@@ -450,7 +456,11 @@ void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
|
||||
V8FunctionData* data = V8FunctionData::Unwrap(info.Data());
|
||||
|
||||
if (!data->handler()) {
|
||||
// handler has gone away, bail!
|
||||
info.GetReturnValue().SetUndefined();
|
||||
return;
|
||||
}
|
||||
CefV8ValueList params;
|
||||
for (int i = 0; i < info.Length(); i++)
|
||||
params.push_back(new CefV8ValueImpl(isolate, context, info[i]));
|
||||
@@ -1316,7 +1326,7 @@ CefRefPtr<CefV8Value> CefV8Value::CreateFunction(
|
||||
}
|
||||
|
||||
v8::Local<v8::External> function_data =
|
||||
V8FunctionData::Create(isolate, name, handler.get());
|
||||
V8FunctionData::Create(isolate, name, handler);
|
||||
|
||||
// Create a new V8 function template.
|
||||
v8::Local<v8::FunctionTemplate> tmpl =
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=1adf0d1a89ad232ddb0daa468082980906dc5931$
|
||||
// $hash=3980a914cf9a6be45acabff6e35c2849b51b27dd$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/auth_callback_cpptoc.h"
|
||||
@@ -26,11 +26,7 @@ void CEF_CALLBACK auth_callback_cont(struct _cef_auth_callback_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: username; type: string_byref_const
|
||||
DCHECK(username);
|
||||
if (!username)
|
||||
return;
|
||||
// Unverified params: password
|
||||
// Unverified params: username, password
|
||||
|
||||
// Execute
|
||||
CefAuthCallbackCppToC::Get(self)->Continue(CefString(username),
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=0b1ea8f0568d1fbbf7359429d1cab3d0df845e93$
|
||||
// $hash=807ba668c5bc70deae472558afa6e7026ca54de5$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
|
||||
@@ -35,6 +35,16 @@ CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
return CefCookieManagerCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager() {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefCookieManager> _retval = CefCookieManager::GetBlockingManager();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefCookieManagerCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager(
|
||||
const cef_string_t* path,
|
||||
int persist_session_cookies,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=de11e537658b94c48a2d2be344399186bd679f5b$
|
||||
// $hash=0464376fa24627e57280c81408ff70c3c2768021$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/auth_callback_ctocpp.h"
|
||||
@@ -24,11 +24,7 @@ void CefAuthCallbackCToCpp::Continue(const CefString& username,
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: username; type: string_byref_const
|
||||
DCHECK(!username.empty());
|
||||
if (username.empty())
|
||||
return;
|
||||
// Unverified params: password
|
||||
// Unverified params: username, password
|
||||
|
||||
// Execute
|
||||
_struct->cont(_struct, username.GetStruct(), password.GetStruct());
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5a754788197bd0d5e1e18db5dc1643285baa848f$
|
||||
// $hash=5a5ae9a4567ba338efa8477ba1dc53435ada8c6b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
|
||||
@@ -35,6 +35,16 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
|
||||
return CefCookieManagerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_cookie_manager_t* _retval = cef_cookie_manager_get_blocking_manager();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefCookieManagerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
|
@@ -50,6 +50,9 @@ patches = [
|
||||
},
|
||||
{
|
||||
# Enable popups in offscreen rendering on OS X.
|
||||
#
|
||||
# Allow customization of the WebView background color.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2345
|
||||
'name': 'webkit_popups',
|
||||
},
|
||||
{
|
||||
@@ -350,4 +353,9 @@ patches = [
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=781966
|
||||
'name': 'webkit_pointer_event_781966',
|
||||
},
|
||||
{
|
||||
# macOS: Fix undesirable switch to discrete GPU during startup.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2398
|
||||
'name': 'mac_gpu_2398',
|
||||
},
|
||||
]
|
||||
|
@@ -20,7 +20,7 @@ diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/
|
||||
index 8e98fb37c1d4..8dc887eac61b 100644
|
||||
--- content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||
@@ -214,6 +214,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
|
||||
@@ -214,6 +214,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
|
||||
g_spare_recyclable_compositors.Get().clear();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ index 8e98fb37c1d4..8dc887eac61b 100644
|
||||
gfx::AcceleratedWidget BrowserCompositorMac::GetAcceleratedWidget() {
|
||||
if (recyclable_compositor_) {
|
||||
return recyclable_compositor_->accelerated_widget_mac()
|
||||
@@ -473,10 +479,16 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
|
||||
@@ -473,10 +479,16 @@ void BrowserCompositorMac::GetViewProperties(
|
||||
NSView* ns_view =
|
||||
accelerated_widget_mac_ns_view_->AcceleratedWidgetGetNSView();
|
||||
if (bounds_in_dip) {
|
||||
@@ -56,7 +56,7 @@ diff --git ui/accelerated_widget_mac/accelerated_widget_mac.mm ui/accelerated_wi
|
||||
index 7ff59beee63c..48efe5ac93fa 100644
|
||||
--- ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
||||
+++ ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
||||
@@ -66,6 +66,10 @@ - (void)setContentsChanged;
|
||||
@@ -66,6 +66,10 @@ void AcceleratedWidgetMac::SetNSView(AcceleratedWidgetMacNSView* view) {
|
||||
DCHECK(view && !view_);
|
||||
view_ = view;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
index c83e5babe405..92efd9e12561 100644
|
||||
index cb122b1bcdb3..bda0309a6225 100644
|
||||
--- content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
+++ content/browser/browser_plugin/browser_plugin_guest.cc
|
||||
@@ -339,8 +339,11 @@ void BrowserPluginGuest::InitInternal(
|
||||
@@ -340,8 +340,11 @@ void BrowserPluginGuest::InitInternal(
|
||||
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ index c83e5babe405..92efd9e12561 100644
|
||||
|
||||
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to
|
||||
// be attached.
|
||||
@@ -836,10 +839,19 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
@@ -837,10 +840,19 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
|
||||
if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) {
|
||||
web_contents_view->CreateViewForWidget(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index 472d5ea34687..575960cb4a37 100644
|
||||
index c61e8b60b4c4..694ebd91349b 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -7,6 +7,7 @@ import("//build/config/crypto.gni")
|
||||
|
@@ -71,7 +71,7 @@ index e8e76ce5b954..1dd338dd0142 100644
|
||||
content::BrowserContext* GetBrowserContextRedirectedInIncognito(
|
||||
content::BrowserContext* context);
|
||||
diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
|
||||
index c5ab3d4e4d7a..69f54123f2cc 100644
|
||||
index dcd20d5949af..23ba98b0fb7c 100644
|
||||
--- chrome/browser/profiles/profile_manager.cc
|
||||
+++ chrome/browser/profiles/profile_manager.cc
|
||||
@@ -377,7 +377,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
|
||||
|
@@ -93,10 +93,10 @@ index 89a41274745c..586864a9d827 100644
|
||||
}
|
||||
|
||||
diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc
|
||||
index fc3412cb2680..385a7c591689 100644
|
||||
index bbb9f413e994..5eec7c9e1535 100644
|
||||
--- content/browser/frame_host/render_frame_host_impl.cc
|
||||
+++ content/browser/frame_host/render_frame_host_impl.cc
|
||||
@@ -1499,6 +1499,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
|
||||
@@ -1517,6 +1517,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(
|
||||
if (navigation_handle_) {
|
||||
navigation_handle_->set_net_error_code(
|
||||
static_cast<net::Error>(params.error_code));
|
||||
@@ -104,7 +104,7 @@ index fc3412cb2680..385a7c591689 100644
|
||||
}
|
||||
|
||||
frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params);
|
||||
@@ -3515,9 +3516,9 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
@@ -3532,9 +3533,9 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
// however only do this for cross-document navigations, because the
|
||||
// alternative would be redundant effort.
|
||||
network::mojom::URLLoaderFactoryPtr default_factory;
|
||||
@@ -117,19 +117,19 @@ index fc3412cb2680..385a7c591689 100644
|
||||
if (subresource_loader_params &&
|
||||
subresource_loader_params->loader_factory_info.is_valid()) {
|
||||
// If the caller has supplied a default URLLoaderFactory override (for
|
||||
@@ -3652,9 +3653,9 @@ void RenderFrameHostImpl::FailedNavigation(
|
||||
// completing an unload handler.
|
||||
ResetWaitingState();
|
||||
@@ -3672,9 +3673,9 @@ void RenderFrameHostImpl::FailedNavigation(
|
||||
|
||||
- StoragePartitionImpl* storage_partition =
|
||||
- static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
|
||||
- GetSiteInstance()->GetBrowserContext(), GetSiteInstance()));
|
||||
+ StoragePartition* storage_partition =
|
||||
+ BrowserContext::GetStoragePartition(
|
||||
+ GetSiteInstance()->GetBrowserContext(), GetSiteInstance());
|
||||
base::Optional<URLLoaderFactoryBundle> subresource_loader_factories;
|
||||
if (base::FeatureList::IsEnabled(features::kNetworkService)) {
|
||||
- StoragePartitionImpl* storage_partition =
|
||||
- static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
|
||||
- GetSiteInstance()->GetBrowserContext(), GetSiteInstance()));
|
||||
+ StoragePartition* storage_partition =
|
||||
+ BrowserContext::GetStoragePartition(
|
||||
+ GetSiteInstance()->GetBrowserContext(), GetSiteInstance());
|
||||
|
||||
network::mojom::URLLoaderFactoryPtr default_factory;
|
||||
if (g_url_loader_factory_callback_for_test.Get().is_null()) {
|
||||
network::mojom::URLLoaderFactoryPtr default_factory;
|
||||
if (g_url_loader_factory_callback_for_test.Get().is_null()) {
|
||||
diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc
|
||||
index 6e105e13b6c5..99815c49cbc1 100644
|
||||
--- content/browser/frame_host/render_frame_message_filter.cc
|
||||
@@ -263,7 +263,7 @@ index e6de4ca6c8b3..18eea4948e43 100644
|
||||
const std::string& mime_type,
|
||||
bool allow_wildcard,
|
||||
diff --git content/common/frame_messages.h content/common/frame_messages.h
|
||||
index 7bce348a78d4..bc27dbcdda37 100644
|
||||
index 3e4b79cce1af..081366a36f65 100644
|
||||
--- content/common/frame_messages.h
|
||||
+++ content/common/frame_messages.h
|
||||
@@ -1342,8 +1342,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
@@ -377,7 +377,7 @@ index aa77b86eee98..097d26a80aa9 100644
|
||||
virtual void FocusedNodeChanged(const blink::WebNode& node) {}
|
||||
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index f341fb4aec24..28f3105f15c0 100644
|
||||
index 956085eaaf10..d80f38c62dab 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -3468,7 +3468,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
@@ -400,7 +400,7 @@ index f341fb4aec24..28f3105f15c0 100644
|
||||
|
||||
void RenderFrameImpl::WillCommitProvisionalLoad() {
|
||||
diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
|
||||
index f55d956f05ec..ec2292acb1c3 100644
|
||||
index d5f3d130b634..aaa9d6a79306 100644
|
||||
--- content/renderer/render_thread_impl.cc
|
||||
+++ content/renderer/render_thread_impl.cc
|
||||
@@ -822,6 +822,8 @@ void RenderThreadImpl::Init(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc
|
||||
index 5e0eabb..f862908 100644
|
||||
index 5e0eabb4f300..f862908f285c 100644
|
||||
--- chrome/common/crash_keys.cc
|
||||
+++ chrome/common/crash_keys.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
@@ -30,7 +30,7 @@ index 5e0eabb..f862908 100644
|
||||
|
||||
void SetActiveExtensions(const std::set<std::string>& extensions) {
|
||||
diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h
|
||||
index a18c8fc..011bcc2 100644
|
||||
index a18c8fc12b08..011bcc2e8d3f 100644
|
||||
--- chrome/common/crash_keys.h
|
||||
+++ chrome/common/crash_keys.h
|
||||
@@ -16,6 +16,10 @@ class CommandLine;
|
||||
@@ -45,7 +45,7 @@ index a18c8fc..011bcc2 100644
|
||||
// Sets the kNumSwitches key and the set of keys named using kSwitchFormat based
|
||||
// on the given |command_line|.
|
||||
diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn
|
||||
index fd5a28b..df46cb0 100644
|
||||
index fd5a28b120ea..df46cb0e0033 100644
|
||||
--- chrome_elf/BUILD.gn
|
||||
+++ chrome_elf/BUILD.gn
|
||||
@@ -7,6 +7,7 @@
|
||||
@@ -93,7 +93,7 @@ index fd5a28b..df46cb0 100644
|
||||
|
||||
static_library("hook_util") {
|
||||
diff --git chrome_elf/crash/crash_helper.cc chrome_elf/crash/crash_helper.cc
|
||||
index e8e27dc..7cb2149 100644
|
||||
index e8e27dc4ebd7..7cb2149ec41d 100644
|
||||
--- chrome_elf/crash/crash_helper.cc
|
||||
+++ chrome_elf/crash/crash_helper.cc
|
||||
@@ -11,12 +11,17 @@
|
||||
@@ -127,7 +127,7 @@ index e8e27dc..7cb2149 100644
|
||||
g_crash_helper_enabled = true;
|
||||
return true;
|
||||
diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc
|
||||
index c72cd36..e9a79dd 100644
|
||||
index c72cd3622b86..e9a79dd47855 100644
|
||||
--- components/crash/content/app/breakpad_linux.cc
|
||||
+++ components/crash/content/app/breakpad_linux.cc
|
||||
@@ -28,6 +28,7 @@
|
||||
@@ -227,7 +227,7 @@ index c72cd36..e9a79dd 100644
|
||||
void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) {
|
||||
SanitizationInfo sanitization_info;
|
||||
diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h
|
||||
index 9ee8555..7af55dd 100644
|
||||
index 9ee85554812c..7af55ddda8fe 100644
|
||||
--- components/crash/content/app/breakpad_linux.h
|
||||
+++ components/crash/content/app/breakpad_linux.h
|
||||
@@ -19,6 +19,9 @@ extern void InitCrashReporter(const std::string& process_type);
|
||||
@@ -241,7 +241,7 @@ index 9ee8555..7af55dd 100644
|
||||
extern void InitCrashKeysForTesting();
|
||||
|
||||
diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc
|
||||
index a37619c..e13a0f7 100644
|
||||
index a37619c815e3..e13a0f7ade86 100644
|
||||
--- components/crash/content/app/crash_reporter_client.cc
|
||||
+++ components/crash/content/app/crash_reporter_client.cc
|
||||
@@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() {
|
||||
@@ -315,7 +315,7 @@ index a37619c..e13a0f7 100644
|
||||
|
||||
} // namespace crash_reporter
|
||||
diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h
|
||||
index 75d3d6d..aa86f45 100644
|
||||
index 75d3d6d93873..aa86f45c9746 100644
|
||||
--- components/crash/content/app/crash_reporter_client.h
|
||||
+++ components/crash/content/app/crash_reporter_client.h
|
||||
@@ -5,7 +5,9 @@
|
||||
@@ -343,14 +343,14 @@ index 75d3d6d..aa86f45 100644
|
||||
virtual base::FilePath GetReporterLogFilename();
|
||||
|
||||
// Custom crash minidump handler after the minidump is generated.
|
||||
@@ -106,6 +109,7 @@ class CrashReporterClient {
|
||||
@@ -105,6 +108,7 @@ class CrashReporterClient {
|
||||
// WARNING: this handler runs in a compromised context. It may not call into
|
||||
// libc nor allocate memory normally.
|
||||
virtual bool HandleCrashDump(const char* crashdump_filename);
|
||||
#endif
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
// The location where minidump files should be written. Returns true if
|
||||
// |crash_dir| was set. Windows has to use base::string16 because this code
|
||||
@@ -180,6 +184,30 @@ class CrashReporterClient {
|
||||
|
||||
// Returns true if breakpad should run in the given process type.
|
||||
@@ -383,7 +383,7 @@ index 75d3d6d..aa86f45 100644
|
||||
|
||||
} // namespace crash_reporter
|
||||
diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc
|
||||
index dde11ea..1a1f8b0 100644
|
||||
index dde11eab445d..1a1f8b01215f 100644
|
||||
--- components/crash/content/app/crashpad.cc
|
||||
+++ components/crash/content/app/crashpad.cc
|
||||
@@ -133,7 +133,8 @@ void InitializeCrashpadImpl(bool initial_client,
|
||||
@@ -397,7 +397,7 @@ index dde11ea..1a1f8b0 100644
|
||||
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
|
||||
}
|
||||
diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm
|
||||
index 6508c2a..f51ce5a 100644
|
||||
index 6508c2a06760..f51ce5a17e63 100644
|
||||
--- components/crash/content/app/crashpad_mac.mm
|
||||
+++ components/crash/content/app/crashpad_mac.mm
|
||||
@@ -16,11 +16,14 @@
|
||||
@@ -498,7 +498,7 @@ index 6508c2a..f51ce5a 100644
|
||||
handler_path, database_path, metrics_path, url, process_annotations,
|
||||
arguments, true, false);
|
||||
diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc
|
||||
index a5d1afc..91815d9 100644
|
||||
index a5d1afc409f4..dc9917f7eca9 100644
|
||||
--- components/crash/content/app/crashpad_win.cc
|
||||
+++ components/crash/content/app/crashpad_win.cc
|
||||
@@ -34,8 +34,8 @@ void GetPlatformCrashpadAnnotations(
|
||||
@@ -524,16 +524,34 @@ index a5d1afc..91815d9 100644
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
@@ -62,7 +62,9 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
base::FilePath metrics_path; // Only valid in the browser process.
|
||||
|
||||
const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME";
|
||||
+#if defined(GOOGLE_CHROME_BUILD)
|
||||
const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL";
|
||||
+#endif
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
if (initial_client) {
|
||||
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
||||
@@ -82,13 +84,13 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
std::string url = "https://clients2.google.com/cr/report";
|
||||
#else
|
||||
-#else
|
||||
- std::string url;
|
||||
+ std::string url = crash_reporter_client->GetCrashServerURL();
|
||||
#endif
|
||||
-#endif
|
||||
|
||||
// Allow the crash server to be overridden for testing. If the variable
|
||||
@@ -103,13 +103,14 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
// isn't present in the environment then the default URL will remain.
|
||||
env->GetVar(kServerUrlVar, &url);
|
||||
+#else
|
||||
+ std::string url = crash_reporter_client->GetCrashServerURL();
|
||||
+#endif
|
||||
|
||||
wchar_t exe_file_path[MAX_PATH] = {};
|
||||
CHECK(
|
||||
@@ -103,13 +105,14 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
crashpad::TriState::kEnabled, kIndirectMemoryLimit);
|
||||
}
|
||||
|
||||
@@ -553,7 +571,7 @@ index a5d1afc..91815d9 100644
|
||||
if (!user_data_dir.empty()) {
|
||||
start_arguments.push_back(std::string("--user-data-dir=") +
|
||||
user_data_dir);
|
||||
@@ -120,9 +121,12 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
@@ -120,9 +123,12 @@ base::FilePath PlatformCrashpadInitialization(
|
||||
start_arguments.push_back("/prefetch:7");
|
||||
} else {
|
||||
base::FilePath exe_dir = exe_file.DirName();
|
||||
@@ -568,7 +586,7 @@ index a5d1afc..91815d9 100644
|
||||
|
||||
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
|
||||
diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc
|
||||
index 4695432..62a7ce8 100644
|
||||
index 46954327b9c7..62a7ce8d4e46 100644
|
||||
--- content/browser/frame_host/debug_urls.cc
|
||||
+++ content/browser/frame_host/debug_urls.cc
|
||||
@@ -139,7 +139,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git content/browser/frame_host/render_frame_host_manager.cc content/browser/frame_host/render_frame_host_manager.cc
|
||||
index 3263eb9e324a..b5bde4cea8f7 100644
|
||||
index 3866f423e1b5..efe77f976617 100644
|
||||
--- content/browser/frame_host/render_frame_host_manager.cc
|
||||
+++ content/browser/frame_host/render_frame_host_manager.cc
|
||||
@@ -890,10 +890,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation(
|
||||
|
@@ -12,7 +12,7 @@ index 2673c6a79889..ca5726966ac0 100644
|
||||
ldflags += [ "-Wl,--icf=all" ]
|
||||
}
|
||||
diff --git chrome/browser/ui/libgtkui/gtk_util.cc chrome/browser/ui/libgtkui/gtk_util.cc
|
||||
index fc6ffb9d..f6c22e5 100644
|
||||
index fc6ffb9d2eb1..f6c22e57392c 100644
|
||||
--- chrome/browser/ui/libgtkui/gtk_util.cc
|
||||
+++ chrome/browser/ui/libgtkui/gtk_util.cc
|
||||
@@ -56,6 +56,7 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line,
|
||||
|
18
patch/patches/mac_gpu_2398.patch
Normal file
18
patch/patches/mac_gpu_2398.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
diff --git ui/gl/init/gl_initializer_mac.cc ui/gl/init/gl_initializer_mac.cc
|
||||
index 828ce9bb0138..1301e6cc1d14 100644
|
||||
--- ui/gl/init/gl_initializer_mac.cc
|
||||
+++ ui/gl/init/gl_initializer_mac.cc
|
||||
@@ -40,11 +40,8 @@ bool InitializeOneOffForSandbox() {
|
||||
// GPU-related stuff is very slow without this, probably because
|
||||
// the sandbox prevents loading graphics drivers or some such.
|
||||
std::vector<CGLPixelFormatAttribute> attribs;
|
||||
- if (GLContext::SwitchableGPUsSupported()) {
|
||||
- // Avoid switching to the discrete GPU just for this pixel
|
||||
- // format selection.
|
||||
- attribs.push_back(kCGLPFAAllowOfflineRenderers);
|
||||
- }
|
||||
+ // Avoid switching to the discrete GPU just for this pixel format selection.
|
||||
+ attribs.push_back(kCGLPFAAllowOfflineRenderers);
|
||||
if (GetGLImplementation() == kGLImplementationAppleGL) {
|
||||
attribs.push_back(kCGLPFARendererID);
|
||||
attribs.push_back(
|
@@ -11,7 +11,7 @@ index a714130a50d8..2a835d7282b3 100644
|
||||
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
|
||||
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
|
||||
diff --git content/public/common/web_preferences.cc content/public/common/web_preferences.cc
|
||||
index 06069a576dfd..912155ebec7c 100644
|
||||
index dea164853646..f3b69c6b81c9 100644
|
||||
--- content/public/common/web_preferences.cc
|
||||
+++ content/public/common/web_preferences.cc
|
||||
@@ -178,6 +178,7 @@ WebPreferences::WebPreferences()
|
||||
@@ -35,15 +35,14 @@ index 49be57cd2aad..417be7a55184 100644
|
||||
bool record_whole_document;
|
||||
SavePreviousDocumentResources save_previous_document_resources;
|
||||
diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc
|
||||
index 1d136aa56ff4..23c00d73b8ed 100644
|
||||
index fae44e8b7e3e..efaa882cf109 100644
|
||||
--- content/renderer/render_view_impl.cc
|
||||
+++ content/renderer/render_view_impl.cc
|
||||
@@ -1261,6 +1261,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
|
||||
@@ -1263,6 +1263,7 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
|
||||
blink::WebView* web_view,
|
||||
CompositorDependencies* compositor_deps) {
|
||||
ApplyWebPreferences(prefs, web_view);
|
||||
+ if (GetWebFrameWidget())
|
||||
+ GetWebFrameWidget()->SetBaseBackgroundColor(prefs.base_background_color);
|
||||
+ web_view->SetBaseBackgroundColor(prefs.base_background_color);
|
||||
}
|
||||
|
||||
void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) {
|
||||
|
@@ -171,10 +171,10 @@ index 11eb1d3b732a..52962a868999 100644
|
||||
weak_factory_.GetWeakPtr(), site_url, tab_url, tab_referrer_url),
|
||||
base::BindOnce(&DownloadManagerImpl::AddUrlDownloadHandler,
|
||||
diff --git content/browser/loader/navigation_url_loader_network_service.cc content/browser/loader/navigation_url_loader_network_service.cc
|
||||
index d9297fa8365e..38a3fb629a7a 100644
|
||||
index f222194d970f..3c7fd1009494 100644
|
||||
--- content/browser/loader/navigation_url_loader_network_service.cc
|
||||
+++ content/browser/loader/navigation_url_loader_network_service.cc
|
||||
@@ -868,11 +868,12 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
|
||||
@@ -888,11 +888,12 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService(
|
||||
.PassInterface();
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ index b9d2670514c0..004939aa055a 100644
|
||||
partition->GetPaymentAppContext();
|
||||
|
||||
diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
|
||||
index 22c72f3ac929..c12815670521 100644
|
||||
index 0e57990b06a1..494a64798a1a 100644
|
||||
--- content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -497,9 +497,8 @@ class SpareRenderProcessHostManager : public RenderProcessHostObserver {
|
||||
@@ -492,19 +492,16 @@ index 01ba96322f69..6dde251b3d1b 100644
|
||||
parameterized_binder_registry_.AddInterface(
|
||||
base::BindRepeating(&BackgroundFetchServiceImpl::Create));
|
||||
diff --git content/browser/shared_worker/shared_worker_connector_impl.cc content/browser/shared_worker/shared_worker_connector_impl.cc
|
||||
index 1e95910e7168..45adb88b1e96 100644
|
||||
index adcc28c72119..96fef4e3099e 100644
|
||||
--- content/browser/shared_worker/shared_worker_connector_impl.cc
|
||||
+++ content/browser/shared_worker/shared_worker_connector_impl.cc
|
||||
@@ -34,10 +34,9 @@ void SharedWorkerConnectorImpl::Connect(
|
||||
mojom::SharedWorkerClientPtr client,
|
||||
blink::mojom::SharedWorkerCreationContextType creation_context_type,
|
||||
mojo::ScopedMessagePipeHandle message_port) {
|
||||
- SharedWorkerServiceImpl* service =
|
||||
- static_cast<StoragePartitionImpl*>(
|
||||
- RenderProcessHost::FromID(process_id_)->GetStoragePartition())
|
||||
@@ -41,8 +41,8 @@ void SharedWorkerConnectorImpl::Connect(
|
||||
return;
|
||||
}
|
||||
SharedWorkerServiceImpl* service =
|
||||
- static_cast<StoragePartitionImpl*>(host->GetStoragePartition())
|
||||
- ->GetSharedWorkerService();
|
||||
+ SharedWorkerServiceImpl* service = static_cast<SharedWorkerServiceImpl*>(
|
||||
+ RenderProcessHost::FromID(process_id_)->GetStoragePartition()
|
||||
+ static_cast<SharedWorkerServiceImpl*>(host->GetStoragePartition()
|
||||
+ ->GetSharedWorkerService());
|
||||
service->ConnectToWorker(process_id_, frame_id_, std::move(info),
|
||||
std::move(client), creation_context_type,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
||||
index 3484edd85788..42d731e0882e 100644
|
||||
index 829401d64386..678c509c662d 100644
|
||||
--- content/browser/web_contents/web_contents_impl.cc
|
||||
+++ content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -1759,21 +1759,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
@@ -70,7 +70,7 @@ index 3484edd85788..42d731e0882e 100644
|
||||
}
|
||||
// Save the created window associated with the route so we can show it
|
||||
// later.
|
||||
@@ -5531,7 +5549,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() {
|
||||
@@ -5544,7 +5562,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() {
|
||||
void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
|
||||
RenderViewHost* render_view_host) {
|
||||
RenderWidgetHostViewBase* rwh_view =
|
||||
|
@@ -17,18 +17,19 @@ index 8088169f0434..47cf612db044 100644
|
||||
.Top()
|
||||
.GetSecurityContext()
|
||||
diff --git third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp
|
||||
index 0fa2449c7f1c..8adf2d575e66 100644
|
||||
index 9b0ec7152d34..09a7901bf526 100644
|
||||
--- third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp
|
||||
+++ third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp
|
||||
@@ -329,6 +329,7 @@ WebDevToolsAgentImpl::Session::Session(
|
||||
host_ptr_.Bind(std::move(host_ptr_info));
|
||||
host_ptr_.set_connection_error_handler(WTF::Bind(
|
||||
@@ -330,6 +330,8 @@ WebDevToolsAgentImpl::Session::Session(
|
||||
&WebDevToolsAgentImpl::Session::Detach, WrapWeakPersistent(this)));
|
||||
|
||||
InitializeInspectorSession(reattach_state);
|
||||
+
|
||||
+ Platform::Current()->DevToolsAgentAttached();
|
||||
}
|
||||
|
||||
void WebDevToolsAgentImpl::Session::Trace(blink::Visitor* visitor) {
|
||||
@@ -347,6 +348,7 @@ void WebDevToolsAgentImpl::Session::Detach() {
|
||||
WebDevToolsAgentImpl::Session::~Session() {
|
||||
@@ -354,6 +356,7 @@ void WebDevToolsAgentImpl::Session::Detach() {
|
||||
io_session_->DeleteSoon();
|
||||
io_session_ = nullptr;
|
||||
inspector_session_->Dispose();
|
||||
@@ -37,10 +38,10 @@ index 0fa2449c7f1c..8adf2d575e66 100644
|
||||
|
||||
void WebDevToolsAgentImpl::Session::DispatchProtocolMessage(
|
||||
diff --git third_party/WebKit/Source/core/frame/LocalFrame.cpp third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
||||
index b76797e978da..a784ce63c21d 100644
|
||||
index 198244acb3e9..fa3847fcb4d1 100644
|
||||
--- third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
||||
+++ third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
||||
@@ -1084,7 +1084,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() {
|
||||
@@ -1088,7 +1088,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() {
|
||||
PluginData* LocalFrame::GetPluginData() const {
|
||||
if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
|
||||
return nullptr;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git third_party/WebKit/Source/core/exported/WebViewImpl.cpp third_party/WebKit/Source/core/exported/WebViewImpl.cpp
|
||||
index d0c5134a2ad6..1434134d4212 100644
|
||||
index 8ab197693ed8..3423391d420e 100644
|
||||
--- third_party/WebKit/Source/core/exported/WebViewImpl.cpp
|
||||
+++ third_party/WebKit/Source/core/exported/WebViewImpl.cpp
|
||||
@@ -258,8 +258,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) {
|
||||
@@ -253,8 +253,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) {
|
||||
g_should_use_external_popup_menus = use_external_popup_menus;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ index d0c5134a2ad6..1434134d4212 100644
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -350,6 +355,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client,
|
||||
@@ -345,6 +350,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client,
|
||||
enable_fake_page_scale_animation_for_testing_(false),
|
||||
fake_page_scale_animation_page_scale_factor_(0),
|
||||
fake_page_scale_animation_use_anchor_(false),
|
||||
@@ -27,11 +27,11 @@ index d0c5134a2ad6..1434134d4212 100644
|
||||
suppress_next_keypress_event_(false),
|
||||
ime_accept_events_(true),
|
||||
diff --git third_party/WebKit/Source/core/exported/WebViewImpl.h third_party/WebKit/Source/core/exported/WebViewImpl.h
|
||||
index 79a702679fec..f50dca632eb4 100644
|
||||
index a17a3af5ec27..810293b7ac44 100644
|
||||
--- third_party/WebKit/Source/core/exported/WebViewImpl.h
|
||||
+++ third_party/WebKit/Source/core/exported/WebViewImpl.h
|
||||
@@ -107,7 +107,8 @@ class CORE_EXPORT WebViewImpl final
|
||||
static const WebInputEvent* CurrentInputEvent();
|
||||
@@ -106,7 +106,8 @@ class CORE_EXPORT WebViewImpl final
|
||||
static HashSet<WebViewImpl*>& AllInstances();
|
||||
// Returns true if popup menus should be rendered by the browser, false if
|
||||
// they should be rendered by WebKit (which is the default).
|
||||
- static bool UseExternalPopupMenus();
|
||||
@@ -40,7 +40,16 @@ index 79a702679fec..f50dca632eb4 100644
|
||||
|
||||
// WebWidget methods:
|
||||
void Close() override;
|
||||
@@ -608,6 +609,8 @@ class CORE_EXPORT WebViewImpl final
|
||||
@@ -255,7 +256,7 @@ class CORE_EXPORT WebViewImpl final
|
||||
HitTestResult CoreHitTestResultAt(const WebPoint&);
|
||||
void InvalidateRect(const IntRect&);
|
||||
|
||||
- void SetBaseBackgroundColor(WebColor);
|
||||
+ void SetBaseBackgroundColor(WebColor) override;
|
||||
void SetBaseBackgroundColorOverride(WebColor);
|
||||
void ClearBaseBackgroundColorOverride();
|
||||
void SetBackgroundColorOverride(WebColor);
|
||||
@@ -605,6 +606,8 @@ class CORE_EXPORT WebViewImpl final
|
||||
float fake_page_scale_animation_page_scale_factor_;
|
||||
bool fake_page_scale_animation_use_anchor_;
|
||||
|
||||
@@ -63,7 +72,7 @@ index 98618289cfab..ec154753a350 100644
|
||||
|
||||
DCHECK(RuntimeEnabledFeatures::PagePopupEnabled());
|
||||
diff --git third_party/WebKit/public/web/WebView.h third_party/WebKit/public/web/WebView.h
|
||||
index 8f30d3c30bac..6d156c7837fb 100644
|
||||
index 8f30d3c30bac..062ae5e643bb 100644
|
||||
--- third_party/WebKit/public/web/WebView.h
|
||||
+++ third_party/WebKit/public/web/WebView.h
|
||||
@@ -360,6 +360,7 @@ class WebView : protected WebWidget {
|
||||
@@ -74,3 +83,12 @@ index 8f30d3c30bac..6d156c7837fb 100644
|
||||
|
||||
// Hides any popup (suggestions, selects...) that might be showing.
|
||||
virtual void HidePopups() = 0;
|
||||
@@ -390,6 +391,8 @@ class WebView : protected WebWidget {
|
||||
unsigned inactive_background_color,
|
||||
unsigned inactive_foreground_color) = 0;
|
||||
|
||||
+ virtual void SetBaseBackgroundColor(WebColor color) = 0;
|
||||
+
|
||||
// Modal dialog support ------------------------------------------------
|
||||
|
||||
// Call these methods before and after running a nested, modal event loop
|
||||
|
@@ -1,8 +1,16 @@
|
||||
diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
|
||||
index e3a222a90f33..24298a7423f1 100644
|
||||
index e3a222a90f33..8b909deef05d 100644
|
||||
--- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
|
||||
+++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
|
||||
@@ -164,6 +164,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "chrome/browser/profiles/profile_manager.h"
|
||||
#include "chrome/browser/sync/profile_sync_service_factory.h"
|
||||
#include "chrome/common/channel_info.h"
|
||||
+#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/browser_sync/profile_sync_service.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
@@ -164,6 +165,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
|
||||
}
|
||||
|
||||
void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) {
|
||||
@@ -13,6 +21,44 @@ index e3a222a90f33..24298a7423f1 100644
|
||||
// We are only interested in sync logs for the primary user profile.
|
||||
Profile* profile = ProfileManager::GetPrimaryUserProfile();
|
||||
if (!profile ||
|
||||
@@ -208,6 +213,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs(
|
||||
if (!profile)
|
||||
return;
|
||||
|
||||
+ // CEF should avoid accessing ExtensionRegistry when extensions are disabled.
|
||||
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ switches::kDisableExtensions)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
extensions::ExtensionRegistry* extension_registry =
|
||||
extensions::ExtensionRegistry::Get(profile);
|
||||
std::string extensions_list;
|
||||
diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc
|
||||
index 5ef6e7292f5f..2884102c28e8 100644
|
||||
--- chrome/browser/memory_details.cc
|
||||
+++ chrome/browser/memory_details.cc
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "base/task_scheduler/post_task.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
+#include "chrome/common/chrome_switches.h"
|
||||
#include "components/nacl/common/nacl_process_type.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "content/public/browser/browser_child_process_host_iterator.h"
|
||||
@@ -253,8 +254,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// Determine if this is an extension process.
|
||||
+ // CEF should avoid accessing ExtensionRegistry when extensions are disabled.
|
||||
bool process_is_for_extensions = false;
|
||||
- if (render_process_host) {
|
||||
+ if (render_process_host &&
|
||||
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
+ switches::kDisableExtensions)) {
|
||||
content::BrowserContext* context =
|
||||
render_process_host->GetBrowserContext();
|
||||
extensions::ExtensionRegistry* extension_registry =
|
||||
diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc
|
||||
index 158173bac8eb..26af7ef2e14b 100644
|
||||
--- chrome/browser/ui/webui/net_internals/net_internals_ui.cc
|
||||
|
@@ -5,16 +5,13 @@
|
||||
#include "tests/cefclient/browser/browser_window_osr_win.h"
|
||||
|
||||
#include "tests/shared/browser/main_message_loop.h"
|
||||
#include "tests/shared/browser/util_win.h"
|
||||
|
||||
namespace client {
|
||||
|
||||
BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
|
||||
const std::string& startup_url,
|
||||
const OsrRenderer::Settings& settings)
|
||||
: BrowserWindow(delegate),
|
||||
osr_hwnd_(NULL),
|
||||
device_scale_factor_(client::GetDeviceScaleFactor()) {
|
||||
: BrowserWindow(delegate), osr_hwnd_(NULL), device_scale_factor_(0) {
|
||||
osr_window_ = new OsrWindowWin(this, settings);
|
||||
client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url);
|
||||
}
|
||||
@@ -92,6 +89,7 @@ void BrowserWindowOsrWin::SetDeviceScaleFactor(float device_scale_factor) {
|
||||
|
||||
float BrowserWindowOsrWin::GetDeviceScaleFactor() const {
|
||||
REQUIRE_MAIN_THREAD();
|
||||
DCHECK_GT(device_scale_factor_, 0);
|
||||
return device_scale_factor_;
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate,
|
||||
hwnd_(NULL),
|
||||
hdc_(NULL),
|
||||
hrc_(NULL),
|
||||
device_scale_factor_(client::GetDeviceScaleFactor()),
|
||||
device_scale_factor_(0),
|
||||
painting_popup_(false),
|
||||
render_task_pending_(false),
|
||||
hidden_(false),
|
||||
@@ -872,6 +872,7 @@ bool OsrWindowWin::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
|
||||
|
||||
bool OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect& rect) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
DCHECK_GT(device_scale_factor_, 0);
|
||||
|
||||
rect.x = rect.y = 0;
|
||||
rect.width = DeviceToLogical(client_rect_.right - client_rect_.left,
|
||||
@@ -887,6 +888,7 @@ bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||
int& screenX,
|
||||
int& screenY) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
DCHECK_GT(device_scale_factor_, 0);
|
||||
|
||||
if (!::IsWindow(hwnd_))
|
||||
return false;
|
||||
@@ -903,6 +905,7 @@ bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,
|
||||
bool OsrWindowWin::GetScreenInfo(CefRefPtr<CefBrowser> browser,
|
||||
CefScreenInfo& screen_info) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
DCHECK_GT(device_scale_factor_, 0);
|
||||
|
||||
if (!::IsWindow(hwnd_))
|
||||
return false;
|
||||
|
@@ -513,7 +513,11 @@ struct ClientPrintHandlerGtk::PrintHandler {
|
||||
}
|
||||
|
||||
void OnJobCompleted(GtkPrintJob* print_job, GError* error) {
|
||||
job_callback_->Continue();
|
||||
// Continue() will result in a call to ClientPrintHandlerGtk::OnPrintReset
|
||||
// which deletes |this|. Execute it asnychronously so the call stack has a
|
||||
// chance to unwind.
|
||||
CefPostTask(TID_UI, base::Bind(&CefPrintJobCallback::Continue,
|
||||
job_callback_.get()));
|
||||
job_callback_ = NULL;
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,14 @@ namespace {
|
||||
class ClientRequestContextHandler : public CefRequestContextHandler,
|
||||
public CefExtensionHandler {
|
||||
public:
|
||||
ClientRequestContextHandler() {}
|
||||
ClientRequestContextHandler() {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
if (command_line->HasSwitch(switches::kRequestContextBlockCookies)) {
|
||||
// Use a cookie manager that neither stores nor retrieves cookies.
|
||||
cookie_manager_ = CefCookieManager::GetBlockingManager();
|
||||
}
|
||||
}
|
||||
|
||||
// CefRequestContextHandler methods:
|
||||
bool OnBeforePluginLoad(const CefString& mime_type,
|
||||
@@ -73,6 +80,10 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManager> GetCookieManager() OVERRIDE {
|
||||
return cookie_manager_;
|
||||
}
|
||||
|
||||
// CefExtensionHandler methods:
|
||||
void OnExtensionLoaded(CefRefPtr<CefExtension> extension) OVERRIDE {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
@@ -99,6 +110,8 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefCookieManager> cookie_manager_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientRequestContextHandler);
|
||||
DISALLOW_COPY_AND_ASSIGN(ClientRequestContextHandler);
|
||||
};
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "tests/cefclient/browser/root_window_win.h"
|
||||
|
||||
#include <shellscalingapi.h>
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_build.h"
|
||||
#include "include/cef_app.h"
|
||||
@@ -46,30 +48,55 @@ INT_PTR CALLBACK AboutWndProc(HWND hDlg,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int GetButtonWidth() {
|
||||
static int button_width = BUTTON_WIDTH;
|
||||
static bool initialized = false;
|
||||
|
||||
if (!initialized) {
|
||||
button_width =
|
||||
LogicalToDevice(BUTTON_WIDTH, client::GetDeviceScaleFactor());
|
||||
initialized = true;
|
||||
// Returns true if the process is per monitor DPI aware.
|
||||
bool IsProcessPerMonitorDpiAware() {
|
||||
enum class PerMonitorDpiAware {
|
||||
UNKNOWN = 0,
|
||||
PER_MONITOR_DPI_UNAWARE,
|
||||
PER_MONITOR_DPI_AWARE,
|
||||
};
|
||||
static PerMonitorDpiAware per_monitor_dpi_aware = PerMonitorDpiAware::UNKNOWN;
|
||||
if (per_monitor_dpi_aware == PerMonitorDpiAware::UNKNOWN) {
|
||||
per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_UNAWARE;
|
||||
HMODULE shcore_dll = ::LoadLibrary(L"shcore.dll");
|
||||
if (shcore_dll) {
|
||||
typedef HRESULT(WINAPI * GetProcessDpiAwarenessPtr)(
|
||||
HANDLE, PROCESS_DPI_AWARENESS*);
|
||||
GetProcessDpiAwarenessPtr func_ptr =
|
||||
reinterpret_cast<GetProcessDpiAwarenessPtr>(
|
||||
::GetProcAddress(shcore_dll, "GetProcessDpiAwareness"));
|
||||
if (func_ptr) {
|
||||
PROCESS_DPI_AWARENESS awareness;
|
||||
if (SUCCEEDED(func_ptr(nullptr, &awareness)) &&
|
||||
awareness == PROCESS_PER_MONITOR_DPI_AWARE)
|
||||
per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return button_width;
|
||||
return per_monitor_dpi_aware == PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
|
||||
}
|
||||
|
||||
int GetURLBarHeight() {
|
||||
static int urlbar_height = URLBAR_HEIGHT;
|
||||
static bool initialized = false;
|
||||
// DPI value for 1x scale factor.
|
||||
#define DPI_1X 96.0f
|
||||
|
||||
if (!initialized) {
|
||||
urlbar_height =
|
||||
LogicalToDevice(URLBAR_HEIGHT, client::GetDeviceScaleFactor());
|
||||
initialized = true;
|
||||
float GetWindowScaleFactor(HWND hwnd) {
|
||||
if (hwnd && IsProcessPerMonitorDpiAware()) {
|
||||
typedef UINT(WINAPI * GetDpiForWindowPtr)(HWND);
|
||||
static GetDpiForWindowPtr func_ptr = reinterpret_cast<GetDpiForWindowPtr>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow"));
|
||||
if (func_ptr)
|
||||
return static_cast<float>(func_ptr(hwnd)) / DPI_1X;
|
||||
}
|
||||
|
||||
return urlbar_height;
|
||||
return client::GetDeviceScaleFactor();
|
||||
}
|
||||
|
||||
int GetButtonWidth(HWND hwnd) {
|
||||
return LogicalToDevice(BUTTON_WIDTH, GetWindowScaleFactor(hwnd));
|
||||
}
|
||||
|
||||
int GetURLBarHeight(HWND hwnd) {
|
||||
return LogicalToDevice(URLBAR_HEIGHT, GetWindowScaleFactor(hwnd));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -84,6 +111,7 @@ RootWindowWin::RootWindowWin()
|
||||
hwnd_(NULL),
|
||||
draggable_region_(NULL),
|
||||
font_(NULL),
|
||||
font_height_(0),
|
||||
back_hwnd_(NULL),
|
||||
forward_hwnd_(NULL),
|
||||
reload_hwnd_(NULL),
|
||||
@@ -97,7 +125,8 @@ RootWindowWin::RootWindowWin()
|
||||
find_next_(false),
|
||||
find_match_case_last_(false),
|
||||
window_destroyed_(false),
|
||||
browser_destroyed_(false) {
|
||||
browser_destroyed_(false),
|
||||
called_enable_non_client_dpi_scaling_(false) {
|
||||
find_buff_[0] = 0;
|
||||
|
||||
// Create a HRGN representing the draggable window area.
|
||||
@@ -313,8 +342,6 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings,
|
||||
// Adjust the window size to account for window frame and controls.
|
||||
RECT window_rect = start_rect_;
|
||||
::AdjustWindowRectEx(&window_rect, dwStyle, with_controls_, 0);
|
||||
if (with_controls_)
|
||||
window_rect.bottom += GetURLBarHeight();
|
||||
|
||||
x = start_rect_.left;
|
||||
y = start_rect_.top;
|
||||
@@ -322,110 +349,23 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings,
|
||||
height = window_rect.bottom - window_rect.top;
|
||||
}
|
||||
|
||||
browser_settings_ = settings;
|
||||
|
||||
// Create the main window initially hidden.
|
||||
hwnd_ = CreateWindow(window_class.c_str(), window_title.c_str(), dwStyle, x,
|
||||
y, width, height, NULL, NULL, hInstance, NULL);
|
||||
CreateWindow(window_class.c_str(), window_title.c_str(), dwStyle, x, y, width,
|
||||
height, NULL, NULL, hInstance, this);
|
||||
CHECK(hwnd_);
|
||||
|
||||
// Associate |this| with the main window.
|
||||
SetUserDataPtr(hwnd_, this);
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(hwnd_, &rect);
|
||||
|
||||
if (with_controls_) {
|
||||
// Create the child controls.
|
||||
int x_offset = 0;
|
||||
|
||||
const int button_width = GetButtonWidth();
|
||||
const int urlbar_height = GetURLBarHeight();
|
||||
const int font_height = LogicalToDevice(14, client::GetDeviceScaleFactor());
|
||||
|
||||
// Create a scaled font.
|
||||
font_ =
|
||||
::CreateFont(-font_height, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
|
||||
|
||||
back_hwnd_ = CreateWindow(
|
||||
L"BUTTON", L"Back", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_BACK), hInstance, 0);
|
||||
CHECK(back_hwnd_);
|
||||
SendMessage(back_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_), TRUE);
|
||||
x_offset += button_width;
|
||||
|
||||
forward_hwnd_ =
|
||||
CreateWindow(L"BUTTON", L"Forward",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_FORWARD), hInstance, 0);
|
||||
CHECK(forward_hwnd_);
|
||||
SendMessage(forward_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
x_offset += button_width;
|
||||
|
||||
reload_hwnd_ =
|
||||
CreateWindow(L"BUTTON", L"Reload",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_RELOAD), hInstance, 0);
|
||||
CHECK(reload_hwnd_);
|
||||
SendMessage(reload_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
x_offset += button_width;
|
||||
|
||||
stop_hwnd_ = CreateWindow(
|
||||
L"BUTTON", L"Stop", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_STOP), hInstance, 0);
|
||||
CHECK(stop_hwnd_);
|
||||
SendMessage(stop_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_), TRUE);
|
||||
x_offset += button_width;
|
||||
|
||||
edit_hwnd_ = CreateWindow(L"EDIT", 0,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
||||
ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED,
|
||||
x_offset, 0, rect.right - button_width * 4,
|
||||
urlbar_height, hwnd_, 0, hInstance, 0);
|
||||
SendMessage(edit_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_), TRUE);
|
||||
CHECK(edit_hwnd_);
|
||||
|
||||
// Override the edit control's window procedure.
|
||||
edit_wndproc_old_ = SetWndProcPtr(edit_hwnd_, EditWndProc);
|
||||
|
||||
// Associate |this| with the edit window.
|
||||
SetUserDataPtr(edit_hwnd_, this);
|
||||
|
||||
rect.top += urlbar_height;
|
||||
|
||||
if (!with_osr_) {
|
||||
// Remove the menu items that are only used with OSR.
|
||||
HMENU hMenu = ::GetMenu(hwnd_);
|
||||
if (hMenu) {
|
||||
HMENU hTestMenu = ::GetSubMenu(hMenu, 2);
|
||||
if (hTestMenu) {
|
||||
::RemoveMenu(hTestMenu, ID_TESTS_OSR_FPS, MF_BYCOMMAND);
|
||||
::RemoveMenu(hTestMenu, ID_TESTS_OSR_DSF, MF_BYCOMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No controls so also remove the default menu.
|
||||
::SetMenu(hwnd_, NULL);
|
||||
}
|
||||
|
||||
if (!is_popup_) {
|
||||
// Create the browser window.
|
||||
CefRect cef_rect(rect.left, rect.top, rect.right - rect.left,
|
||||
rect.bottom - rect.top);
|
||||
browser_window_->CreateBrowser(hwnd_, cef_rect, settings,
|
||||
delegate_->GetRequestContext(this));
|
||||
} else {
|
||||
// With popups we already have a browser window. Parent the browser window
|
||||
// to the root window and show it in the correct location.
|
||||
browser_window_->ShowPopup(hwnd_, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top);
|
||||
if (!called_enable_non_client_dpi_scaling_ && IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions < 10.0.14393.0.
|
||||
// Derived signature; not available in headers.
|
||||
typedef LRESULT(WINAPI * EnableChildWindowDpiMessagePtr)(HWND, BOOL);
|
||||
static EnableChildWindowDpiMessagePtr func_ptr =
|
||||
reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
|
||||
if (func_ptr)
|
||||
func_ptr(hwnd_, TRUE);
|
||||
}
|
||||
|
||||
if (!initially_hidden) {
|
||||
@@ -535,12 +475,15 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd,
|
||||
LPARAM lParam) {
|
||||
REQUIRE_MAIN_THREAD();
|
||||
|
||||
RootWindowWin* self = GetUserDataPtr<RootWindowWin*>(hWnd);
|
||||
if (!self)
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
DCHECK(hWnd == self->hwnd_);
|
||||
RootWindowWin* self = NULL;
|
||||
if (message != WM_NCCREATE) {
|
||||
self = GetUserDataPtr<RootWindowWin*>(hWnd);
|
||||
if (!self)
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
DCHECK_EQ(hWnd, self->hwnd_);
|
||||
}
|
||||
|
||||
if (message == self->find_message_id_) {
|
||||
if (self && message == self->find_message_id_) {
|
||||
// Message targeting the find dialog.
|
||||
LPFINDREPLACE lpfr = reinterpret_cast<LPFINDREPLACE>(lParam);
|
||||
CHECK(lpfr == &self->find_state_);
|
||||
@@ -589,6 +532,10 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd,
|
||||
self->OnMove();
|
||||
return 0;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
self->OnDpiChanged(wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if (self->OnEraseBkgnd())
|
||||
break;
|
||||
@@ -629,6 +576,21 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd,
|
||||
return hit;
|
||||
}
|
||||
|
||||
case WM_NCCREATE: {
|
||||
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
self = reinterpret_cast<RootWindowWin*>(cs->lpCreateParams);
|
||||
DCHECK(self);
|
||||
// Associate |self| with the main window.
|
||||
SetUserDataPtr(hWnd, self);
|
||||
self->hwnd_ = hWnd;
|
||||
|
||||
self->OnNCCreate(cs);
|
||||
} break;
|
||||
|
||||
case WM_CREATE:
|
||||
self->OnCreate(reinterpret_cast<CREATESTRUCT*>(lParam));
|
||||
break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
// Clear the reference to |self|.
|
||||
SetUserDataPtr(hWnd, NULL);
|
||||
@@ -670,37 +632,71 @@ void RootWindowWin::OnSize(bool minimized) {
|
||||
RECT rect;
|
||||
GetClientRect(hwnd_, &rect);
|
||||
|
||||
if (with_controls_) {
|
||||
static int button_width = GetButtonWidth();
|
||||
static int urlbar_height = GetURLBarHeight();
|
||||
if (with_controls_ && edit_hwnd_) {
|
||||
const int button_width = GetButtonWidth(hwnd_);
|
||||
const int urlbar_height = GetURLBarHeight(hwnd_);
|
||||
const int font_height = LogicalToDevice(14, GetWindowScaleFactor(hwnd_));
|
||||
|
||||
if (font_height != font_height_) {
|
||||
font_height_ = font_height;
|
||||
if (font_) {
|
||||
DeleteObject(font_);
|
||||
}
|
||||
|
||||
// Create a scaled font.
|
||||
font_ =
|
||||
::CreateFont(-font_height, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial");
|
||||
|
||||
SendMessage(back_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
SendMessage(forward_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
SendMessage(reload_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
SendMessage(stop_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
SendMessage(edit_hwnd_, WM_SETFONT, reinterpret_cast<WPARAM>(font_),
|
||||
TRUE);
|
||||
}
|
||||
|
||||
// Resize the window and address bar to match the new frame size.
|
||||
rect.top += urlbar_height;
|
||||
|
||||
int urloffset = rect.left + button_width * 4;
|
||||
int x_offset = rect.left;
|
||||
|
||||
// |browser_hwnd| may be NULL if the browser has not yet been created.
|
||||
HWND browser_hwnd = NULL;
|
||||
if (browser_window_)
|
||||
browser_hwnd = browser_window_->GetWindowHandle();
|
||||
|
||||
// Resize all controls.
|
||||
HDWP hdwp = BeginDeferWindowPos(browser_hwnd ? 6 : 5);
|
||||
hdwp = DeferWindowPos(hdwp, back_hwnd_, NULL, x_offset, 0, button_width,
|
||||
urlbar_height, SWP_NOZORDER);
|
||||
x_offset += button_width;
|
||||
hdwp = DeferWindowPos(hdwp, forward_hwnd_, NULL, x_offset, 0, button_width,
|
||||
urlbar_height, SWP_NOZORDER);
|
||||
x_offset += button_width;
|
||||
hdwp = DeferWindowPos(hdwp, reload_hwnd_, NULL, x_offset, 0, button_width,
|
||||
urlbar_height, SWP_NOZORDER);
|
||||
x_offset += button_width;
|
||||
hdwp = DeferWindowPos(hdwp, stop_hwnd_, NULL, x_offset, 0, button_width,
|
||||
urlbar_height, SWP_NOZORDER);
|
||||
x_offset += button_width;
|
||||
hdwp = DeferWindowPos(hdwp, edit_hwnd_, NULL, x_offset, 0,
|
||||
rect.right - x_offset, urlbar_height, SWP_NOZORDER);
|
||||
|
||||
if (browser_hwnd) {
|
||||
// Resize both the browser and the URL edit field.
|
||||
HDWP hdwp = BeginDeferWindowPos(2);
|
||||
hdwp =
|
||||
DeferWindowPos(hdwp, edit_hwnd_, NULL, urloffset, 0,
|
||||
rect.right - urloffset, urlbar_height, SWP_NOZORDER);
|
||||
hdwp = DeferWindowPos(hdwp, browser_hwnd, NULL, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOZORDER);
|
||||
BOOL result = EndDeferWindowPos(hdwp);
|
||||
ALLOW_UNUSED_LOCAL(result);
|
||||
DCHECK(result);
|
||||
} else {
|
||||
// Resize just the URL edit field.
|
||||
SetWindowPos(edit_hwnd_, NULL, urloffset, 0, rect.right - urloffset,
|
||||
urlbar_height, SWP_NOZORDER);
|
||||
}
|
||||
|
||||
BOOL result = EndDeferWindowPos(hdwp);
|
||||
ALLOW_UNUSED_LOCAL(result);
|
||||
DCHECK(result);
|
||||
} else if (browser_window_) {
|
||||
// Size the browser window to the whole client area.
|
||||
browser_window_->SetBounds(0, 0, rect.right, rect.bottom);
|
||||
@@ -715,6 +711,25 @@ void RootWindowWin::OnMove() {
|
||||
browser->GetHost()->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
|
||||
void RootWindowWin::OnDpiChanged(WPARAM wParam, LPARAM lParam) {
|
||||
if (LOWORD(wParam) != HIWORD(wParam)) {
|
||||
NOTIMPLEMENTED() << "Received non-square scaling factors";
|
||||
return;
|
||||
}
|
||||
|
||||
if (browser_window_ && with_osr_) {
|
||||
// Scale factor for the new display.
|
||||
const float display_scale_factor =
|
||||
static_cast<float>(LOWORD(wParam)) / DPI_1X;
|
||||
browser_window_->SetDeviceScaleFactor(display_scale_factor);
|
||||
}
|
||||
|
||||
// Suggested size and position of the current window scaled for the new DPI.
|
||||
const RECT* rect = reinterpret_cast<RECT*>(lParam);
|
||||
SetBounds(rect->left, rect->top, rect->right - rect->left,
|
||||
rect->bottom - rect->top);
|
||||
}
|
||||
|
||||
bool RootWindowWin::OnEraseBkgnd() {
|
||||
// Erase the background when the browser does not exist.
|
||||
return (GetBrowser() == NULL);
|
||||
@@ -821,6 +836,112 @@ void RootWindowWin::OnAbout() {
|
||||
AboutWndProc);
|
||||
}
|
||||
|
||||
void RootWindowWin::OnNCCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions >= 10.0.14393.0.
|
||||
typedef BOOL(WINAPI * EnableNonClientDpiScalingPtr)(HWND);
|
||||
static EnableNonClientDpiScalingPtr func_ptr =
|
||||
reinterpret_cast<EnableNonClientDpiScalingPtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableNonClientDpiScaling"));
|
||||
called_enable_non_client_dpi_scaling_ = !!(func_ptr && func_ptr(hwnd_));
|
||||
}
|
||||
}
|
||||
|
||||
void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
const HINSTANCE hInstance = lpCreateStruct->hInstance;
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(hwnd_, &rect);
|
||||
|
||||
if (with_controls_) {
|
||||
// Create the child controls.
|
||||
int x_offset = 0;
|
||||
|
||||
const int button_width = GetButtonWidth(hwnd_);
|
||||
const int urlbar_height = GetURLBarHeight(hwnd_);
|
||||
|
||||
back_hwnd_ = CreateWindow(
|
||||
L"BUTTON", L"Back", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_BACK), hInstance, 0);
|
||||
CHECK(back_hwnd_);
|
||||
x_offset += button_width;
|
||||
|
||||
forward_hwnd_ =
|
||||
CreateWindow(L"BUTTON", L"Forward",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_FORWARD), hInstance, 0);
|
||||
CHECK(forward_hwnd_);
|
||||
x_offset += button_width;
|
||||
|
||||
reload_hwnd_ =
|
||||
CreateWindow(L"BUTTON", L"Reload",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_RELOAD), hInstance, 0);
|
||||
CHECK(reload_hwnd_);
|
||||
x_offset += button_width;
|
||||
|
||||
stop_hwnd_ = CreateWindow(
|
||||
L"BUTTON", L"Stop", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED,
|
||||
x_offset, 0, button_width, urlbar_height, hwnd_,
|
||||
reinterpret_cast<HMENU>(IDC_NAV_STOP), hInstance, 0);
|
||||
CHECK(stop_hwnd_);
|
||||
x_offset += button_width;
|
||||
|
||||
edit_hwnd_ = CreateWindow(L"EDIT", 0,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
||||
ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED,
|
||||
x_offset, 0, rect.right - button_width * 4,
|
||||
urlbar_height, hwnd_, 0, hInstance, 0);
|
||||
CHECK(edit_hwnd_);
|
||||
|
||||
// Override the edit control's window procedure.
|
||||
edit_wndproc_old_ = SetWndProcPtr(edit_hwnd_, EditWndProc);
|
||||
|
||||
// Associate |this| with the edit window.
|
||||
SetUserDataPtr(edit_hwnd_, this);
|
||||
|
||||
rect.top += urlbar_height;
|
||||
|
||||
if (!with_osr_) {
|
||||
// Remove the menu items that are only used with OSR.
|
||||
HMENU hMenu = ::GetMenu(hwnd_);
|
||||
if (hMenu) {
|
||||
HMENU hTestMenu = ::GetSubMenu(hMenu, 2);
|
||||
if (hTestMenu) {
|
||||
::RemoveMenu(hTestMenu, ID_TESTS_OSR_FPS, MF_BYCOMMAND);
|
||||
::RemoveMenu(hTestMenu, ID_TESTS_OSR_DSF, MF_BYCOMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No controls so also remove the default menu.
|
||||
::SetMenu(hwnd_, NULL);
|
||||
}
|
||||
|
||||
const float device_scale_factor = GetWindowScaleFactor(hwnd_);
|
||||
|
||||
if (with_osr_) {
|
||||
browser_window_->SetDeviceScaleFactor(device_scale_factor);
|
||||
}
|
||||
|
||||
if (!is_popup_) {
|
||||
// Create the browser window.
|
||||
CefRect cef_rect(rect.left, rect.top, rect.right - rect.left,
|
||||
rect.bottom - rect.top);
|
||||
browser_window_->CreateBrowser(hwnd_, cef_rect, browser_settings_,
|
||||
delegate_->GetRequestContext(this));
|
||||
} else {
|
||||
// With popups we already have a browser window. Parent the browser window
|
||||
// to the root window and show it in the correct location.
|
||||
browser_window_->ShowPopup(hwnd_, rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top);
|
||||
}
|
||||
}
|
||||
|
||||
bool RootWindowWin::OnClose() {
|
||||
if (browser_window_ && !browser_window_->IsClosing()) {
|
||||
CefRefPtr<CefBrowser> browser = GetBrowser();
|
||||
@@ -915,9 +1036,9 @@ void RootWindowWin::OnAutoResize(const CefSize& new_size) {
|
||||
if (new_width < 200)
|
||||
new_width = 200;
|
||||
|
||||
RECT rect = {
|
||||
0, 0, LogicalToDevice(new_width, client::GetDeviceScaleFactor()),
|
||||
LogicalToDevice(new_size.height, client::GetDeviceScaleFactor())};
|
||||
const float device_scale_factor = GetWindowScaleFactor(hwnd_);
|
||||
RECT rect = {0, 0, LogicalToDevice(new_width, device_scale_factor),
|
||||
LogicalToDevice(new_size.height, device_scale_factor)};
|
||||
DWORD style = GetWindowLong(hwnd_, GWL_STYLE);
|
||||
DWORD ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE);
|
||||
bool has_menu = !(style & WS_CHILD) && (GetMenu(hwnd_) != NULL);
|
||||
|
@@ -83,11 +83,14 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate {
|
||||
void OnActivate(bool active);
|
||||
void OnSize(bool minimized);
|
||||
void OnMove();
|
||||
void OnDpiChanged(WPARAM wParam, LPARAM lParam);
|
||||
bool OnEraseBkgnd();
|
||||
bool OnCommand(UINT id);
|
||||
void OnFind();
|
||||
void OnFindEvent();
|
||||
void OnAbout();
|
||||
void OnNCCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
void OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
bool OnClose();
|
||||
void OnDestroyed();
|
||||
|
||||
@@ -114,6 +117,7 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate {
|
||||
bool is_popup_;
|
||||
RECT start_rect_;
|
||||
scoped_ptr<BrowserWindow> browser_window_;
|
||||
CefBrowserSettings browser_settings_;
|
||||
bool initialized_;
|
||||
|
||||
// Main window.
|
||||
@@ -124,6 +128,7 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate {
|
||||
|
||||
// Font for buttons and text fields.
|
||||
HFONT font_;
|
||||
int font_height_;
|
||||
|
||||
// Buttons.
|
||||
HWND back_hwnd_;
|
||||
@@ -150,6 +155,8 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate {
|
||||
bool window_destroyed_;
|
||||
bool browser_destroyed_;
|
||||
|
||||
bool called_enable_non_client_dpi_scaling_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RootWindowWin);
|
||||
};
|
||||
|
||||
|
@@ -2180,14 +2180,46 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
ALLOW = 0,
|
||||
BLOCK_READ = 1 << 0,
|
||||
BLOCK_WRITE = 1 << 1,
|
||||
BLOCK_ALL = BLOCK_READ | BLOCK_WRITE,
|
||||
BLOCK_READ_WRITE = BLOCK_READ | BLOCK_WRITE,
|
||||
BLOCK_ALL = 1 << 2,
|
||||
};
|
||||
|
||||
class RequestContextHandler : public CefRequestContextHandler {
|
||||
public:
|
||||
explicit RequestContextHandler(CookieAccessTestHandler* handler)
|
||||
: handler_(handler) {}
|
||||
|
||||
CefRefPtr<CefCookieManager> GetCookieManager() override {
|
||||
EXPECT_TRUE(handler_);
|
||||
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
|
||||
|
||||
handler_->got_cookie_manager_.yes();
|
||||
return handler_->cookie_manager_;
|
||||
}
|
||||
|
||||
void Detach() { handler_ = NULL; }
|
||||
|
||||
private:
|
||||
CookieAccessTestHandler* handler_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(RequestContextHandler);
|
||||
};
|
||||
|
||||
CookieAccessTestHandler(TestMode test_mode, bool server_backend)
|
||||
: test_mode_(test_mode), server_backend_(server_backend) {}
|
||||
|
||||
void RunTest() override {
|
||||
cookie_manager_ = CefCookieManager::GetGlobalManager(nullptr);
|
||||
if (test_mode_ == BLOCK_ALL) {
|
||||
cookie_manager_ = CefCookieManager::GetBlockingManager();
|
||||
context_handler_ = new RequestContextHandler(this);
|
||||
|
||||
// Create a request context that uses |context_handler_|.
|
||||
CefRequestContextSettings settings;
|
||||
context_ =
|
||||
CefRequestContext::CreateContext(settings, context_handler_.get());
|
||||
} else {
|
||||
cookie_manager_ = CefCookieManager::GetGlobalManager(nullptr);
|
||||
}
|
||||
SetTestTimeout();
|
||||
|
||||
CefPostTask(TID_UI,
|
||||
@@ -2204,88 +2236,130 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
}
|
||||
|
||||
cookie_manager_ = NULL;
|
||||
|
||||
// Always get a call to CanSetCookie for the 1st network request due to the
|
||||
// network cookie.
|
||||
EXPECT_TRUE(got_can_set_cookie1_);
|
||||
// Always get a call to CanGetCookies for the 2nd network request due to the
|
||||
// JS cookie.
|
||||
EXPECT_TRUE(got_can_get_cookies2_);
|
||||
|
||||
// Always get the JS cookie via JS.
|
||||
EXPECT_TRUE(got_cookie_js1_);
|
||||
EXPECT_TRUE(got_cookie_js2_);
|
||||
EXPECT_TRUE(got_cookie_js3_);
|
||||
|
||||
// Only get the net cookie via JS if cookie write was allowed.
|
||||
if (test_mode_ & BLOCK_WRITE) {
|
||||
EXPECT_FALSE(got_cookie_net1_);
|
||||
EXPECT_FALSE(got_cookie_net2_);
|
||||
EXPECT_FALSE(got_cookie_net3_);
|
||||
} else {
|
||||
EXPECT_TRUE(got_cookie_net1_);
|
||||
EXPECT_TRUE(got_cookie_net2_);
|
||||
EXPECT_TRUE(got_cookie_net3_);
|
||||
if (context_)
|
||||
context_ = NULL;
|
||||
if (context_handler_) {
|
||||
context_handler_->Detach();
|
||||
context_handler_ = NULL;
|
||||
}
|
||||
|
||||
// Got both network requests.
|
||||
EXPECT_TRUE(data1_.got_request_);
|
||||
EXPECT_TRUE(data2_.got_request_);
|
||||
|
||||
// No cookies sent for the 1st network request.
|
||||
EXPECT_FALSE(data1_.got_cookie_js_);
|
||||
EXPECT_FALSE(data1_.got_cookie_net_);
|
||||
if (test_mode_ == BLOCK_ALL) {
|
||||
EXPECT_TRUE(got_cookie_manager_);
|
||||
|
||||
// 2nd network request...
|
||||
if (test_mode_ & BLOCK_READ) {
|
||||
// No cookies sent if reading was blocked.
|
||||
EXPECT_FALSE(data2_.got_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_net_);
|
||||
} else if (test_mode_ & BLOCK_WRITE) {
|
||||
// Only JS cookie sent if writing was blocked.
|
||||
EXPECT_TRUE(data2_.got_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_net_);
|
||||
} else {
|
||||
// All cookies sent.
|
||||
EXPECT_TRUE(data2_.got_cookie_js_);
|
||||
EXPECT_TRUE(data2_.got_cookie_net_);
|
||||
}
|
||||
// The callback to set the cookie comes before the actual storage fails.
|
||||
EXPECT_TRUE(got_can_set_cookie1_);
|
||||
|
||||
if (!server_backend_) {
|
||||
// No query to get cookies with the 1st network request because none have
|
||||
// been set yet.
|
||||
if (!server_backend_) {
|
||||
// The callback to set the cookie comes before the actual storage fails.
|
||||
EXPECT_TRUE(data1_.got_can_set_cookie_net_);
|
||||
} else {
|
||||
EXPECT_FALSE(data1_.got_can_set_cookie_net_);
|
||||
}
|
||||
|
||||
// No cookies stored anywhere.
|
||||
EXPECT_FALSE(got_can_get_cookies2_);
|
||||
EXPECT_FALSE(got_cookie_js1_);
|
||||
EXPECT_FALSE(got_cookie_js2_);
|
||||
EXPECT_FALSE(got_cookie_js3_);
|
||||
EXPECT_FALSE(got_cookie_net1_);
|
||||
EXPECT_FALSE(got_cookie_net2_);
|
||||
EXPECT_FALSE(got_cookie_net3_);
|
||||
EXPECT_FALSE(data1_.got_cookie_js_);
|
||||
EXPECT_FALSE(data1_.got_cookie_net_);
|
||||
EXPECT_FALSE(data1_.got_can_get_cookie_js_);
|
||||
EXPECT_FALSE(data1_.got_can_get_cookie_net_);
|
||||
|
||||
// JS cookie is not set via a network request.
|
||||
EXPECT_FALSE(data1_.got_can_set_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_net_);
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_net_);
|
||||
EXPECT_FALSE(data2_.got_can_set_cookie_js_);
|
||||
|
||||
// No query to set the net cookie for the 1st network request if write was
|
||||
// blocked.
|
||||
if (test_mode_ & BLOCK_WRITE) {
|
||||
EXPECT_FALSE(data1_.got_can_set_cookie_net_);
|
||||
} else {
|
||||
EXPECT_TRUE(data1_.got_can_set_cookie_net_);
|
||||
}
|
||||
|
||||
// Net cookie is not set via the 2nd network request.
|
||||
EXPECT_FALSE(data2_.got_can_set_cookie_net_);
|
||||
} else {
|
||||
EXPECT_FALSE(got_cookie_manager_);
|
||||
|
||||
// No query to get the JS cookie for the 2nd network request if read was
|
||||
// blocked.
|
||||
if (test_mode_ & BLOCK_READ) {
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_js_);
|
||||
// Always get a call to CanSetCookie for the 1st network request due to
|
||||
// the network cookie.
|
||||
EXPECT_TRUE(got_can_set_cookie1_);
|
||||
// Always get a call to CanGetCookies for the 2nd network request due to
|
||||
// the JS cookie.
|
||||
EXPECT_TRUE(got_can_get_cookies2_);
|
||||
|
||||
// Always get the JS cookie via JS.
|
||||
EXPECT_TRUE(got_cookie_js1_);
|
||||
EXPECT_TRUE(got_cookie_js2_);
|
||||
EXPECT_TRUE(got_cookie_js3_);
|
||||
|
||||
// Only get the net cookie via JS if cookie write was allowed.
|
||||
if (test_mode_ & BLOCK_WRITE) {
|
||||
EXPECT_FALSE(got_cookie_net1_);
|
||||
EXPECT_FALSE(got_cookie_net2_);
|
||||
EXPECT_FALSE(got_cookie_net3_);
|
||||
} else {
|
||||
EXPECT_TRUE(data2_.got_can_get_cookie_js_);
|
||||
EXPECT_TRUE(got_cookie_net1_);
|
||||
EXPECT_TRUE(got_cookie_net2_);
|
||||
EXPECT_TRUE(got_cookie_net3_);
|
||||
}
|
||||
|
||||
// No query to get the net cookie for the 2nd network request if read or
|
||||
// write (of the net cookie) was blocked.
|
||||
if (test_mode_ & (BLOCK_READ | BLOCK_WRITE)) {
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_net_);
|
||||
// No cookies sent for the 1st network request.
|
||||
EXPECT_FALSE(data1_.got_cookie_js_);
|
||||
EXPECT_FALSE(data1_.got_cookie_net_);
|
||||
|
||||
// 2nd network request...
|
||||
if (test_mode_ & BLOCK_READ) {
|
||||
// No cookies sent if reading was blocked.
|
||||
EXPECT_FALSE(data2_.got_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_net_);
|
||||
} else if (test_mode_ & BLOCK_WRITE) {
|
||||
// Only JS cookie sent if writing was blocked.
|
||||
EXPECT_TRUE(data2_.got_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_cookie_net_);
|
||||
} else {
|
||||
EXPECT_TRUE(data2_.got_can_get_cookie_net_);
|
||||
// All cookies sent.
|
||||
EXPECT_TRUE(data2_.got_cookie_js_);
|
||||
EXPECT_TRUE(data2_.got_cookie_net_);
|
||||
}
|
||||
|
||||
if (!server_backend_) {
|
||||
// No query to get cookies with the 1st network request because none
|
||||
// have been set yet.
|
||||
EXPECT_FALSE(data1_.got_can_get_cookie_js_);
|
||||
EXPECT_FALSE(data1_.got_can_get_cookie_net_);
|
||||
|
||||
// JS cookie is not set via a network request.
|
||||
EXPECT_FALSE(data1_.got_can_set_cookie_js_);
|
||||
EXPECT_FALSE(data2_.got_can_set_cookie_js_);
|
||||
|
||||
// No query to set the net cookie for the 1st network request if write
|
||||
// was blocked.
|
||||
if (test_mode_ & BLOCK_WRITE) {
|
||||
EXPECT_FALSE(data1_.got_can_set_cookie_net_);
|
||||
} else {
|
||||
EXPECT_TRUE(data1_.got_can_set_cookie_net_);
|
||||
}
|
||||
|
||||
// Net cookie is not set via the 2nd network request.
|
||||
EXPECT_FALSE(data2_.got_can_set_cookie_net_);
|
||||
|
||||
// No query to get the JS cookie for the 2nd network request if read was
|
||||
// blocked.
|
||||
if (test_mode_ & BLOCK_READ) {
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_js_);
|
||||
} else {
|
||||
EXPECT_TRUE(data2_.got_can_get_cookie_js_);
|
||||
}
|
||||
|
||||
// No query to get the net cookie for the 2nd network request if read or
|
||||
// write (of the net cookie) was blocked.
|
||||
if (test_mode_ & (BLOCK_READ | BLOCK_WRITE)) {
|
||||
EXPECT_FALSE(data2_.got_can_get_cookie_net_);
|
||||
} else {
|
||||
EXPECT_TRUE(data2_.got_can_get_cookie_net_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2413,8 +2487,13 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
// Add the factory registration.
|
||||
scheme_factory_ = new CookieAccessSchemeHandlerFactory();
|
||||
AddResponses(scheme_factory_.get());
|
||||
CefRegisterSchemeHandlerFactory(kCookieAccessScheme, kCookieAccessDomain,
|
||||
scheme_factory_.get());
|
||||
if (context_) {
|
||||
context_->RegisterSchemeHandlerFactory(
|
||||
kCookieAccessScheme, kCookieAccessDomain, scheme_factory_.get());
|
||||
} else {
|
||||
CefRegisterSchemeHandlerFactory(kCookieAccessScheme, kCookieAccessDomain,
|
||||
scheme_factory_.get());
|
||||
}
|
||||
|
||||
complete_callback.Run();
|
||||
}
|
||||
@@ -2426,7 +2505,7 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
CreateBrowser(GetCookieAccessUrl1(server_backend_));
|
||||
CreateBrowser(GetCookieAccessUrl1(server_backend_), context_);
|
||||
}
|
||||
|
||||
void FinishTest() {
|
||||
@@ -2487,14 +2566,21 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
void ShutdownSchemeHandler(const base::Closure& complete_callback) {
|
||||
EXPECT_TRUE(scheme_factory_);
|
||||
|
||||
CefRegisterSchemeHandlerFactory(kCookieAccessScheme, kCookieAccessDomain,
|
||||
nullptr);
|
||||
if (context_) {
|
||||
context_->RegisterSchemeHandlerFactory(kCookieAccessScheme,
|
||||
kCookieAccessDomain, nullptr);
|
||||
} else {
|
||||
CefRegisterSchemeHandlerFactory(kCookieAccessScheme, kCookieAccessDomain,
|
||||
nullptr);
|
||||
}
|
||||
scheme_factory_->Shutdown(complete_callback);
|
||||
scheme_factory_ = nullptr;
|
||||
}
|
||||
|
||||
TestMode test_mode_;
|
||||
bool server_backend_;
|
||||
CefRefPtr<RequestContextHandler> context_handler_;
|
||||
CefRefPtr<CefRequestContext> context_;
|
||||
CefRefPtr<CefCookieManager> cookie_manager_;
|
||||
|
||||
CefRefPtr<CookieAccessServerHandler> server_handler_;
|
||||
@@ -2503,6 +2589,8 @@ class CookieAccessTestHandler : public RoutingTestHandler {
|
||||
CookieAccessData data1_;
|
||||
CookieAccessData data2_;
|
||||
|
||||
TrackCallback got_cookie_manager_;
|
||||
|
||||
// 1st request.
|
||||
TrackCallback got_can_set_cookie1_;
|
||||
TrackCallback got_cookie_js1_;
|
||||
@@ -2548,6 +2636,14 @@ TEST(RequestHandlerTest, CookieAccessServerBlockWrite) {
|
||||
}
|
||||
|
||||
// Block reading and writing of cookies with server backend.
|
||||
TEST(RequestHandlerTest, CookieAccessServerBlockReadWrite) {
|
||||
CefRefPtr<CookieAccessTestHandler> handler = new CookieAccessTestHandler(
|
||||
CookieAccessTestHandler::BLOCK_READ_WRITE, true);
|
||||
handler->ExecuteTest();
|
||||
ReleaseAndWaitForDestructor(handler);
|
||||
}
|
||||
|
||||
// Block all cookies with server backend.
|
||||
TEST(RequestHandlerTest, CookieAccessServerBlockAll) {
|
||||
CefRefPtr<CookieAccessTestHandler> handler =
|
||||
new CookieAccessTestHandler(CookieAccessTestHandler::BLOCK_ALL, true);
|
||||
@@ -2580,6 +2676,14 @@ TEST(RequestHandlerTest, CookieAccessSchemeBlockWrite) {
|
||||
}
|
||||
|
||||
// Block reading and writing of cookies with scheme handler backend.
|
||||
TEST(RequestHandlerTest, CookieAccessSchemeBlockReadWrite) {
|
||||
CefRefPtr<CookieAccessTestHandler> handler = new CookieAccessTestHandler(
|
||||
CookieAccessTestHandler::BLOCK_READ_WRITE, false);
|
||||
handler->ExecuteTest();
|
||||
ReleaseAndWaitForDestructor(handler);
|
||||
}
|
||||
|
||||
// Block all cookies with scheme handler backend.
|
||||
TEST(RequestHandlerTest, CookieAccessSchemeBlockAll) {
|
||||
CefRefPtr<CookieAccessTestHandler> handler =
|
||||
new CookieAccessTestHandler(CookieAccessTestHandler::BLOCK_ALL, false);
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "tests/ceftests/test_handler.h"
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/cef_command_line.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/wrapper/cef_closure_task.h"
|
||||
@@ -283,6 +284,11 @@ CefRefPtr<CefResourceHandler> TestHandler::GetResourceHandler(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TestHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {
|
||||
LOG(WARNING) << "OnRenderProcessTerminated: status = " << status << ".";
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowser> TestHandler::GetBrowser() {
|
||||
return first_browser_;
|
||||
}
|
||||
|
@@ -182,6 +182,9 @@ class TestHandler : public CefClient,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) override;
|
||||
|
||||
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) override;
|
||||
|
||||
// These methods should only be used if at most one non-popup browser exists.
|
||||
CefRefPtr<CefBrowser> GetBrowser();
|
||||
int GetBrowserId();
|
||||
|
@@ -37,6 +37,10 @@ const char kV8ContextEvalCspBypassSandbox[] =
|
||||
"http://tests/V8Test.ContextEvalCspBypassSandbox";
|
||||
const char kV8OnUncaughtExceptionTestUrl[] =
|
||||
"http://tests/V8Test.OnUncaughtException";
|
||||
const char kV8HandlerCallOnReleasedContextUrl[] =
|
||||
"http://tests/V8Test.HandlerCallOnReleasedContext/main.html";
|
||||
const char kV8HandlerCallOnReleasedContextChildUrl[] =
|
||||
"http://tests/V8Test.HandlerCallOnReleasedContext/child.html";
|
||||
const char kV8TestMsg[] = "V8Test.Test";
|
||||
const char kV8TestCmdArg[] = "v8-test";
|
||||
const char kV8RunTestMsg[] = "V8Test.RunTest";
|
||||
@@ -88,6 +92,7 @@ enum V8TestMode {
|
||||
V8TEST_ON_UNCAUGHT_EXCEPTION,
|
||||
V8TEST_ON_UNCAUGHT_EXCEPTION_DEV_TOOLS,
|
||||
V8TEST_EXTENSION,
|
||||
V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT,
|
||||
};
|
||||
|
||||
// Set to the current test being run in the browser process. Will always be
|
||||
@@ -254,6 +259,8 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
|
||||
case V8TEST_ON_UNCAUGHT_EXCEPTION:
|
||||
RunOnUncaughtExceptionTest();
|
||||
break;
|
||||
case V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT:
|
||||
break;
|
||||
default:
|
||||
// Was a startup test.
|
||||
EXPECT_TRUE(startup_test_success_);
|
||||
@@ -2482,6 +2489,79 @@ class V8RendererTest : public ClientAppRenderer::Delegate,
|
||||
EXPECT_TRUE(object.get());
|
||||
EXPECT_TRUE(object->SetValue("v8_binding_test", CefV8Value::CreateInt(12),
|
||||
V8_PROPERTY_ATTRIBUTE_NONE));
|
||||
} else if (url == kV8HandlerCallOnReleasedContextUrl) {
|
||||
// For V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT
|
||||
class Handler : public CefV8Handler {
|
||||
public:
|
||||
Handler(CefRefPtr<V8RendererTest> renderer_test)
|
||||
: renderer_test_(renderer_test) {}
|
||||
|
||||
bool Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) override {
|
||||
if (name == "notify_test_done") {
|
||||
CefPostDelayedTask(
|
||||
TID_RENDERER,
|
||||
base::Bind(&V8RendererTest::DestroyTest, renderer_test_.get()),
|
||||
1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<V8RendererTest> renderer_test_;
|
||||
IMPLEMENT_REFCOUNTING(Handler);
|
||||
};
|
||||
|
||||
Handler* handler = new Handler(this);
|
||||
CefRefPtr<CefV8Handler> handlerPtr(handler);
|
||||
|
||||
// Function that will be called from the parent frame context.
|
||||
CefRefPtr<CefV8Value> func =
|
||||
CefV8Value::CreateFunction("notify_test_done", handler);
|
||||
EXPECT_TRUE(func.get());
|
||||
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
EXPECT_TRUE(object.get());
|
||||
EXPECT_TRUE(object->SetValue("notify_test_done", func,
|
||||
V8_PROPERTY_ATTRIBUTE_NONE));
|
||||
} else if (url == kV8HandlerCallOnReleasedContextChildUrl) {
|
||||
// For V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT
|
||||
class Handler : public CefV8Handler {
|
||||
public:
|
||||
Handler() {}
|
||||
bool Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) override {
|
||||
if (name == "v8_context_is_alive") {
|
||||
retval = CefV8Value::CreateBool(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(Handler);
|
||||
};
|
||||
|
||||
Handler* handler = new Handler;
|
||||
CefRefPtr<CefV8Handler> handlerPtr(handler);
|
||||
|
||||
// Function that will be called from the parent frame context.
|
||||
CefRefPtr<CefV8Value> func =
|
||||
CefV8Value::CreateFunction("v8_context_is_alive", handler);
|
||||
EXPECT_TRUE(func.get());
|
||||
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
EXPECT_TRUE(object.get());
|
||||
EXPECT_TRUE(object->SetValue("v8_context_is_alive", func,
|
||||
V8_PROPERTY_ATTRIBUTE_NONE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2714,6 +2794,58 @@ class V8TestHandler : public TestHandler {
|
||||
"</body></html>\n",
|
||||
"text/html");
|
||||
CreateBrowser(kV8OnUncaughtExceptionTestUrl);
|
||||
} else if (test_mode_ == V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT) {
|
||||
AddResource(kV8HandlerCallOnReleasedContextUrl,
|
||||
"<html><body onload='createFrame()'>"
|
||||
"(main)"
|
||||
"<script>"
|
||||
"function createFrame() {"
|
||||
" var el = document.createElement('iframe');"
|
||||
" el.id = 'child';"
|
||||
" el.src = '" +
|
||||
std::string(kV8HandlerCallOnReleasedContextChildUrl) +
|
||||
"';"
|
||||
" el.onload = function() {"
|
||||
" setTimeout(function() {"
|
||||
" try {"
|
||||
" el.contentWindow.removeMe();"
|
||||
" window.notify_test_done();"
|
||||
" } catch (e) { alert('Unit test error.\\n' + e); }"
|
||||
" }, 1000);"
|
||||
" };"
|
||||
" document.body.appendChild(el);"
|
||||
"}"
|
||||
""
|
||||
"function removeFrame(id) {"
|
||||
" var el = document.getElementById(id);"
|
||||
" if (el) { el.parentElement.removeChild(el); }"
|
||||
" else { alert('Error in test. No element \"' + id + "
|
||||
"'\" found.'); }"
|
||||
"}"
|
||||
"</script>"
|
||||
"</body></html>",
|
||||
"text/html");
|
||||
AddResource(kV8HandlerCallOnReleasedContextChildUrl,
|
||||
"<html><body>"
|
||||
"(child)"
|
||||
"<script>"
|
||||
"try {"
|
||||
" if (!window.v8_context_is_alive()) {"
|
||||
" throw 'v8_context_is_alive returns non-true value.';"
|
||||
" }"
|
||||
"} catch (e) {"
|
||||
" alert('Unit test error.\\n' + e);"
|
||||
"}"
|
||||
""
|
||||
"function removeMe() {"
|
||||
" var w = window;"
|
||||
" w.parent.removeFrame('child');"
|
||||
" return w.v8_context_is_alive();"
|
||||
"}"
|
||||
"</script>"
|
||||
"</body></html>",
|
||||
"text/html");
|
||||
CreateBrowser(kV8HandlerCallOnReleasedContextUrl);
|
||||
} else {
|
||||
EXPECT_TRUE(test_url_ != NULL);
|
||||
AddResource(test_url_,
|
||||
@@ -2879,3 +3011,6 @@ V8_TEST(StackTrace, V8TEST_STACK_TRACE);
|
||||
V8_TEST(OnUncaughtException, V8TEST_ON_UNCAUGHT_EXCEPTION);
|
||||
V8_TEST(OnUncaughtExceptionDevTools, V8TEST_ON_UNCAUGHT_EXCEPTION_DEV_TOOLS);
|
||||
V8_TEST(Extension, V8TEST_EXTENSION);
|
||||
V8_TEST_EX(HandlerCallOnReleasedContext,
|
||||
V8TEST_HANDLER_CALL_ON_RELEASED_CONTEXT,
|
||||
kV8HandlerCallOnReleasedContextUrl)
|
||||
|
@@ -28,6 +28,7 @@ const char kShowUpdateRect[] = "show-update-rect";
|
||||
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
|
||||
const char kRequestContextPerBrowser[] = "request-context-per-browser";
|
||||
const char kRequestContextSharedCache[] = "request-context-shared-cache";
|
||||
const char kRequestContextBlockCookies[] = "request-context-block-cookies";
|
||||
const char kBackgroundColor[] = "background-color";
|
||||
const char kEnableGPU[] = "enable-gpu";
|
||||
const char kFilterURL[] = "filter-url";
|
||||
|
@@ -22,6 +22,7 @@ extern const char kShowUpdateRect[];
|
||||
extern const char kMouseCursorChangeDisabled[];
|
||||
extern const char kRequestContextPerBrowser[];
|
||||
extern const char kRequestContextSharedCache[];
|
||||
extern const char kRequestContextBlockCookies[];
|
||||
extern const char kBackgroundColor[];
|
||||
extern const char kEnableGPU[];
|
||||
extern const char kFilterURL[];
|
||||
|
@@ -256,8 +256,14 @@ def GetRequiredArgs():
|
||||
if platform == 'linux':
|
||||
# Don't generate Chromium installer packages. This avoids GN dependency
|
||||
# errors with CEF (see issue #2301).
|
||||
# Due to the way this variable is declared in chrome/installer/BUILD.gn it
|
||||
# can't be enforced by assert().
|
||||
result['enable_linux_installer'] = False
|
||||
|
||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
||||
# issue #2424).
|
||||
result['use_bundled_fontconfig'] = False
|
||||
|
||||
if platform == 'macosx':
|
||||
# Always generate dSYM files. The make_distrib script will fail if
|
||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||
|
@@ -274,6 +274,7 @@ def transfer_files(cef_dir, script_dir, transfer_cfg_dir, mode, output_dir,
|
||||
# conditional [optional] Set to True if the path is conditional on build
|
||||
# settings. Missing conditional paths will not be
|
||||
# treated as an error.
|
||||
# delete [optional] Glob pattern of files to delete after the copy.
|
||||
def copy_files_list(build_dir, dst_dir, paths):
|
||||
''' Copy the files listed in |paths| from |build_dir| to |dst_dir|. '''
|
||||
for entry in paths:
|
||||
@@ -284,6 +285,13 @@ def copy_files_list(build_dir, dst_dir, paths):
|
||||
make_dir(os.path.dirname(target_path), options.quiet)
|
||||
if os.path.isdir(source_path):
|
||||
copy_dir(source_path, target_path, options.quiet)
|
||||
if 'delete' in entry:
|
||||
for delete_path in get_files(
|
||||
os.path.join(target_path, entry['delete'])):
|
||||
if not os.path.isdir(delete_path):
|
||||
remove_file(delete_path, options.quiet)
|
||||
else:
|
||||
raise Exception('Refusing to delete directory: %s' % delete_path)
|
||||
else:
|
||||
copy_file(source_path, target_path, options.quiet)
|
||||
else:
|
||||
@@ -714,7 +722,7 @@ if platform == 'windows':
|
||||
{'path': 'cef_extensions.pak'},
|
||||
{'path': 'devtools_resources.pak'},
|
||||
{'path': 'icudtl.dat'},
|
||||
{'path': 'locales'},
|
||||
{'path': 'locales', 'delete': '*.info'},
|
||||
]
|
||||
# yapf: enable
|
||||
|
||||
@@ -971,7 +979,7 @@ elif platform == 'linux':
|
||||
# yapf: enable
|
||||
|
||||
if mode == 'client':
|
||||
binaries.append({'path': 'cefclient'})
|
||||
binaries.append({'path': 'cefsimple'})
|
||||
|
||||
# yapf: disable
|
||||
resources = [
|
||||
@@ -981,7 +989,7 @@ elif platform == 'linux':
|
||||
{'path': 'cef_extensions.pak'},
|
||||
{'path': 'devtools_resources.pak'},
|
||||
{'path': 'icudtl.dat'},
|
||||
{'path': 'locales'},
|
||||
{'path': 'locales', 'delete': '*.info'},
|
||||
]
|
||||
# yapf: enable
|
||||
|
||||
|
Reference in New Issue
Block a user