Commit 38b59917 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

cef update

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64330 954022d7-b5bf-4e40-9824-e11837661b57
parent 00b1eede
......@@ -26,6 +26,8 @@ set(CEFCLIENT_BROWSER_BROWSER_SRCS
browser/client_types.h
browser/dialog_test.cc
browser/dialog_test.h
browser/geometry_util.cc
browser/geometry_util.h
browser/main_context.cc
browser/main_context.h
browser/main_context_impl.cc
......
......@@ -15,6 +15,13 @@ BrowserWindow::BrowserWindow(Delegate* delegate)
DCHECK(delegate_);
}
void BrowserWindow::SetDeviceScaleFactor(float device_scale_factor) {
}
float BrowserWindow::GetDeviceScaleFactor() const {
return 1.0f;
}
CefRefPtr<CefBrowser> BrowserWindow::GetBrowser() const {
REQUIRE_MAIN_THREAD();
return browser_;
......
......@@ -82,6 +82,14 @@ class BrowserWindow : public ClientHandler::Delegate {
// Set focus to the window.
virtual void SetFocus(bool focus) = 0;
// Set the device scale factor. Only used in combination with off-screen
// rendering.
virtual void SetDeviceScaleFactor(float device_scale_factor);
// Returns the device scale factor. Only used in combination with off-screen
// rendering.
virtual float GetDeviceScaleFactor() const;
// Returns the window handle.
virtual ClientWindowHandle GetWindowHandle() const = 0;
......
......@@ -5,6 +5,7 @@
#include "cefclient/browser/browser_window_osr_win.h"
#include "cefclient/browser/main_message_loop.h"
#include "cefclient/browser/util_win.h"
namespace client {
......@@ -13,7 +14,8 @@ BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate,
const OsrRenderer::Settings& settings)
: BrowserWindow(delegate),
transparent_(settings.transparent),
osr_hwnd_(NULL) {
osr_hwnd_(NULL),
device_scale_factor_(client::GetDeviceScaleFactor()) {
osr_window_ = new OsrWindowWin(this, settings);
client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), startup_url);
}
......@@ -71,6 +73,25 @@ void BrowserWindowOsrWin::SetFocus(bool focus) {
osr_window_->SetFocus();
}
void BrowserWindowOsrWin::SetDeviceScaleFactor(float device_scale_factor) {
REQUIRE_MAIN_THREAD();
if (device_scale_factor == device_scale_factor_)
return;
// Apply some sanity checks.
if (device_scale_factor < 1.0f || device_scale_factor > 4.0f)
return;
device_scale_factor_ = device_scale_factor;
if (osr_window_)
osr_window_->SetDeviceScaleFactor(device_scale_factor);
}
float BrowserWindowOsrWin::GetDeviceScaleFactor() const {
REQUIRE_MAIN_THREAD();
return device_scale_factor_;
}
ClientWindowHandle BrowserWindowOsrWin::GetWindowHandle() const {
REQUIRE_MAIN_THREAD();
return osr_hwnd_;
......
......@@ -38,6 +38,8 @@ class BrowserWindowOsrWin : public BrowserWindow,
void Hide() OVERRIDE;
void SetBounds(int x, int y, size_t width, size_t height) OVERRIDE;
void SetFocus(bool focus) OVERRIDE;
void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
float GetDeviceScaleFactor() const OVERRIDE;
ClientWindowHandle GetWindowHandle() const OVERRIDE;
private:
......@@ -53,6 +55,8 @@ class BrowserWindowOsrWin : public BrowserWindow,
scoped_refptr<OsrWindowWin> osr_window_;
HWND osr_hwnd_;
float device_scale_factor_;
DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin);
};
......
......@@ -6,12 +6,49 @@
#include "include/base/cef_logging.h"
#include "include/cef_cookie.h"
#include "cefclient/common/client_switches.h"
namespace client {
ClientAppBrowser::ClientAppBrowser() {
}
void ClientAppBrowser::OnBeforeCommandLineProcessing(
const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) {
// Pass additional command-line flags to the browser process.
if (process_type.empty()) {
// Pass additional command-line flags when off-screen rendering is enabled.
if (command_line->HasSwitch(switches::kOffScreenRenderingEnabled)) {
// If the PDF extension is enabled then cc Surfaces must be disabled for
// PDFs to render correctly.
// See https://bitbucket.org/chromiumembedded/cef/issues/1689 for details.
if (!command_line->HasSwitch("disable-extensions") &&
!command_line->HasSwitch("disable-pdf-extension")) {
command_line->AppendSwitch("disable-surfaces");
}
// Use software rendering and compositing (disable GPU) for increased FPS
// and decreased CPU usage. This will also disable WebGL so remove these
// switches if you need that capability.
// See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
if (!command_line->HasSwitch(switches::kEnableGPU)) {
command_line->AppendSwitch("disable-gpu");
command_line->AppendSwitch("disable-gpu-compositing");
}
// Synchronize the frame rate between all processes. This results in
// decreased CPU usage by avoiding the generation of extra frames that
// would otherwise be discarded. The frame rate can be set at browser
// creation time via CefBrowserSettings.windowless_frame_rate or changed
// dynamically using CefBrowserHost::SetWindowlessFrameRate. In cefclient
// it can be set via the command-line using `--off-screen-frame-rate=XX`.
// See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details.
command_line->AppendSwitch("enable-begin-frame-scheduling");
}
}
}
void ClientAppBrowser::OnContextInitialized() {
CreateDelegates(delegates_);
......
......@@ -46,6 +46,9 @@ class ClientAppBrowser : public ClientApp,
static CefRefPtr<CefPrintHandler> CreatePrintHandler();
// CefApp methods.
void OnBeforeCommandLineProcessing(
const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() OVERRIDE {
return this;
}
......
......@@ -260,7 +260,7 @@ class ClientHandler : public CefClient,
// Returns true if this handler uses off-screen rendering.
bool is_osr() const { return is_osr_; }
protected:
private:
// Create a new popup window using the specified information. |is_devtools|
// will be true if the window will be used for DevTools. Return true to
// proceed with popup browser creation or false to cancel the popup browser.
......
......@@ -336,9 +336,9 @@ CefRefPtr<CefDragData> DataObjectToDragData(IDataObject* data_object) {
HDROP hdrop = (HDROP)hGlobal;
const int kMaxFilenameLen = 4096;
const unsigned num_files = DragQueryFileW(hdrop, 0xffffffff, 0, 0);
for (unsigned int i = 0; i < num_files; ++i) {
for (unsigned int x = 0; x < num_files; ++x) {
wchar_t filename[kMaxFilenameLen];
if (!DragQueryFileW(hdrop, i, filename, kMaxFilenameLen))
if (!DragQueryFileW(hdrop, x, filename, kMaxFilenameLen))
continue;
WCHAR* name = wcsrchr(filename, '\\');
drag_data->AddFile(filename, (name ? name + 1 : filename));
......
......@@ -80,7 +80,7 @@ class DropTargetWin : public IDropTarget {
DWORD* effect);
DEFAULT_QUERY_INTERFACE(IDropTarget)
IUNKNOWN_IMPLEMENTATION()
IUNKNOWN_IMPLEMENTATION
protected:
DropTargetWin(OsrDragEvents* callback, HWND hWnd)
......@@ -106,7 +106,8 @@ class DropSourceWin : public IDropSource {
HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
DEFAULT_QUERY_INTERFACE(IDropSource)
IUNKNOWN_IMPLEMENTATION()
IUNKNOWN_IMPLEMENTATION
protected:
explicit DropSourceWin() : ref_count_(0) {}
virtual ~DropSourceWin() {}
......@@ -137,7 +138,7 @@ class DragEnumFormatEtc : public IEnumFORMATETC {
static void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source);
DEFAULT_QUERY_INTERFACE(IEnumFORMATETC)
IUNKNOWN_IMPLEMENTATION()
IUNKNOWN_IMPLEMENTATION
private:
ULONG m_nIndex; // current enumerator index
......@@ -171,7 +172,7 @@ class DataObjectWin : public IDataObject {
HRESULT __stdcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium);
DEFAULT_QUERY_INTERFACE(IDataObject)
IUNKNOWN_IMPLEMENTATION()
IUNKNOWN_IMPLEMENTATION
protected:
int m_nNumFormats;
......
......@@ -7,6 +7,7 @@
#include <windowsx.h>
#include "include/base/cef_build.h"
#include "cefclient/browser/geometry_util.h"
#include "cefclient/browser/main_message_loop.h"
#include "cefclient/browser/resource.h"
#include "cefclient/browser/util_win.h"
......@@ -55,6 +56,7 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate,
hdc_(NULL),
hrc_(NULL),
client_rect_(),
device_scale_factor_(client::GetDeviceScaleFactor()),
painting_popup_(false),
render_task_pending_(false),
hidden_(false),
......@@ -199,6 +201,24 @@ void OsrWindowWin::SetFocus() {
}
}
void OsrWindowWin::SetDeviceScaleFactor(float device_scale_factor) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute this method on the UI thread.
CefPostTask(TID_UI, base::Bind(&OsrWindowWin::SetDeviceScaleFactor, this,
device_scale_factor));
return;
}
if (device_scale_factor == device_scale_factor_)
return;
device_scale_factor_ = device_scale_factor;
if (browser_) {
browser_->GetHost()->NotifyScreenInfoChanged();
browser_->GetHost()->WasResized();
}
}
void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) {
CEF_REQUIRE_UI_THREAD();
DCHECK(!hwnd_ && !hdc_ && !hrc_);
......@@ -489,13 +509,13 @@ void OsrWindowWin::OnMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
last_click_time_ = currentTime;
last_click_button_ = btnType;
CefRefPtr<CefBrowserHost> browser_host = browser_->GetHost();
if (browser_host) {
CefMouseEvent mouse_event;
mouse_event.x = x;
mouse_event.y = y;
last_mouse_down_on_view_ = !IsOverPopupWidget(x, y);
ApplyPopupOffset(mouse_event.x, mouse_event.y);
DeviceToLogical(mouse_event, device_scale_factor_);
mouse_event.modifiers = GetCefMouseModifiers(wParam);
browser_host->SendMouseClickEvent(mouse_event, btnType, false,
last_click_count_);
......@@ -529,6 +549,7 @@ void OsrWindowWin::OnMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
break;
}
ApplyPopupOffset(mouse_event.x, mouse_event.y);
DeviceToLogical(mouse_event, device_scale_factor_);
mouse_event.modifiers = GetCefMouseModifiers(wParam);
browser_host->SendMouseClickEvent(mouse_event, btnType, true,
last_click_count_);
......@@ -566,6 +587,7 @@ void OsrWindowWin::OnMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
mouse_event.x = x;
mouse_event.y = y;
ApplyPopupOffset(mouse_event.x, mouse_event.y);
DeviceToLogical(mouse_event, device_scale_factor_);
mouse_event.modifiers = GetCefMouseModifiers(wParam);
browser_host->SendMouseMoveEvent(mouse_event, false);
}
......@@ -593,6 +615,7 @@ void OsrWindowWin::OnMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
CefMouseEvent mouse_event;
mouse_event.x = p.x;
mouse_event.y = p.y;
DeviceToLogical(mouse_event, device_scale_factor_);
mouse_event.modifiers = GetCefMouseModifiers(wParam);
browser_host->SendMouseMoveEvent(mouse_event, true);
}
......@@ -612,8 +635,8 @@ void OsrWindowWin::OnMouseEvent(UINT message, WPARAM wParam, LPARAM lParam) {
mouse_event.x = screen_point.x;
mouse_event.y = screen_point.y;
ApplyPopupOffset(mouse_event.x, mouse_event.y);
DeviceToLogical(mouse_event, device_scale_factor_);
mouse_event.modifiers = GetCefMouseModifiers(wParam);
browser_host->SendMouseWheelEvent(mouse_event,
IsKeyDown(VK_SHIFT) ? delta : 0,
!IsKeyDown(VK_SHIFT) ? delta : 0);
......@@ -731,16 +754,6 @@ void OsrWindowWin::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
bool OsrWindowWin::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
RECT window_rect = {0};
HWND root_window = GetAncestor(hwnd_, GA_ROOT);
if (::GetWindowRect(root_window, &window_rect)) {
rect = CefRect(window_rect.left,
window_rect.top,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top);
return true;
}
return false;
}
......@@ -749,8 +762,10 @@ bool OsrWindowWin::GetViewRect(CefRefPtr<CefBrowser> browser,
CEF_REQUIRE_UI_THREAD();
rect.x = rect.y = 0;
rect.width = client_rect_.right - client_rect_.left;
rect.height = client_rect_.bottom - client_rect_.top;
rect.width = DeviceToLogical(client_rect_.right - client_rect_.left,
device_scale_factor_);
rect.height = DeviceToLogical(client_rect_.bottom - client_rect_.top,
device_scale_factor_);
return true;
}
......@@ -765,7 +780,10 @@ bool OsrWindowWin::GetScreenPoint(CefRefPtr<CefBrowser> browser,
return false;
// Convert the point from view coordinates to actual screen coordinates.
POINT screen_pt = {viewX, viewY};
POINT screen_pt = {
LogicalToDevice(viewX, device_scale_factor_),
LogicalToDevice(viewY, device_scale_factor_)
};
ClientToScreen(hwnd_, &screen_pt);
screenX = screen_pt.x;
screenY = screen_pt.y;
......@@ -776,7 +794,19 @@ bool OsrWindowWin::GetScreenInfo(CefRefPtr<CefBrowser> browser,
CefScreenInfo& screen_info) {
CEF_REQUIRE_UI_THREAD();
if (!::IsWindow(hwnd_))
return false;
CefRect view_rect;
GetViewRect(browser, view_rect);
screen_info.device_scale_factor = device_scale_factor_;
// The screen info rectangles are used by the renderer to create and position
// popups. Keep popups inside the view rectangle.
screen_info.rect = view_rect;
screen_info.available_rect = view_rect;
return true;
}
void OsrWindowWin::OnPopupShow(CefRefPtr<CefBrowser> browser,
......@@ -794,7 +824,7 @@ void OsrWindowWin::OnPopupSize(CefRefPtr<CefBrowser> browser,
const CefRect& rect) {
CEF_REQUIRE_UI_THREAD();
renderer_.OnPopupSize(browser, rect);
renderer_.OnPopupSize(browser, LogicalToDevice(rect, device_scale_factor_));
}
void OsrWindowWin::OnPaint(CefRefPtr<CefBrowser> browser,
......@@ -848,6 +878,7 @@ bool OsrWindowWin::StartDragging(
#if defined(CEF_USE_ATL)
if (!drop_target_)
return false;
current_drag_op_ = DRAG_OPERATION_NONE;
CefBrowserHost::DragOperationsMask result =
drop_target_->StartDragging(browser, drag_data, allowed_ops, x, y);
......@@ -855,7 +886,11 @@ bool OsrWindowWin::StartDragging(
POINT pt = {};
GetCursorPos(&pt);
ScreenToClient(hwnd_, &pt);
browser->GetHost()->DragSourceEndedAt(pt.x, pt.y, result);
browser->GetHost()->DragSourceEndedAt(
DeviceToLogical(pt.x, device_scale_factor_),
DeviceToLogical(pt.y, device_scale_factor_),
result);
browser->GetHost()->DragSourceSystemDragEnded();
return true;
#else
......@@ -881,6 +916,7 @@ OsrWindowWin::OnDragEnter(CefRefPtr<CefDragData> drag_data,
CefMouseEvent ev,
CefBrowserHost::DragOperationsMask effect) {
if (browser_) {
DeviceToLogical(ev, device_scale_factor_);
browser_->GetHost()->DragTargetDragEnter(drag_data, ev, effect);
browser_->GetHost()->DragTargetDragOver(ev, effect);
}
......@@ -890,8 +926,10 @@ OsrWindowWin::OnDragEnter(CefRefPtr<CefDragData> drag_data,
CefBrowserHost::DragOperationsMask
OsrWindowWin::OnDragOver(CefMouseEvent ev,
CefBrowserHost::DragOperationsMask effect) {
if (browser_)
if (browser_) {
DeviceToLogical(ev, device_scale_factor_);
browser_->GetHost()->DragTargetDragOver(ev, effect);
}
return current_drag_op_;
}
......@@ -904,6 +942,7 @@ CefBrowserHost::DragOperationsMask
OsrWindowWin::OnDrop(CefMouseEvent ev,
CefBrowserHost::DragOperationsMask effect) {
if (browser_) {
DeviceToLogical(ev, device_scale_factor_);
browser_->GetHost()->DragTargetDragOver(ev, effect);
browser_->GetHost()->DragTargetDrop(ev);
}
......
......@@ -57,6 +57,7 @@ class OsrWindowWin :
void Hide();
void SetBounds(int x, int y, size_t width, size_t height);
void SetFocus();
void SetDeviceScaleFactor(float device_scale_factor);
private:
// Only allow deletion via scoped_refptr.
......@@ -156,6 +157,7 @@ class OsrWindowWin :
HGLRC hrc_;
RECT client_rect_;
float device_scale_factor_;
CefRefPtr<CefBrowser> browser_;
......
......@@ -38,11 +38,10 @@
#define ID_TESTS_ZOOM_IN 32710
#define ID_TESTS_ZOOM_OUT 32711
#define ID_TESTS_ZOOM_RESET 32712
#define ID_TESTS_FPS_INCREASE 32713
#define ID_TESTS_FPS_DECREASE 32714
#define ID_TESTS_FPS_RESET 32715
#define ID_TESTS_PRINT_TO_PDF 32716
#define ID_TESTS_LAST 32716
#define ID_TESTS_OSR_FPS 32713
#define ID_TESTS_OSR_DSF 32714
#define ID_TESTS_PRINT_TO_PDF 32715
#define ID_TESTS_LAST 32715
#define IDC_STATIC -1
#define IDS_BINDING_HTML 1000
#define IDS_DIALOGS_HTML 1001
......
......@@ -103,6 +103,14 @@ class RootWindow :
// executed.
virtual void Close(bool force) = 0;
// Set the device scale factor. Only used in combination with off-screen
// rendering.
virtual void SetDeviceScaleFactor(float device_scale_factor) = 0;
// Returns the device scale factor. Only used in combination with off-screen
// rendering.
virtual float GetDeviceScaleFactor() const = 0;
// Returns the browser that this window contains, if any.
virtual CefRefPtr<CefBrowser> GetBrowser() const = 0;
......
......@@ -9,6 +9,7 @@
#include "include/cef_app.h"
#include "cefclient/browser/browser_window_osr_win.h"
#include "cefclient/browser/browser_window_std_win.h"
#include "cefclient/browser/geometry_util.h"
#include "cefclient/browser/main_context.h"
#include "cefclient/browser/main_message_loop.h"
#include "cefclient/browser/resource.h"
......@@ -43,6 +44,30 @@ INT_PTR CALLBACK AboutWndProc(HWND hDlg, UINT message,
return FALSE;
}
int GetButtonWidth() {
static int button_width = BUTTON_WIDTH;
static bool initialized = false;
if (!initialized) {
button_width = LogicalToDevice(BUTTON_WIDTH, GetDeviceScaleFactor());
initialized = true;
}
return button_width;
}
int GetURLBarHeight() {
static int urlbar_height = URLBAR_HEIGHT;
static bool initialized = false;
if (!initialized) {
urlbar_height = LogicalToDevice(URLBAR_HEIGHT, GetDeviceScaleFactor());
initialized = true;
}
return urlbar_height;
}
} // namespace
RootWindowWin::RootWindowWin()
......@@ -54,6 +79,7 @@ RootWindowWin::RootWindowWin()
initialized_(false),
hwnd_(NULL),
draggable_region_(NULL),
font_(NULL),
back_hwnd_(NULL),
forward_hwnd_(NULL),
reload_hwnd_(NULL),
......@@ -78,6 +104,7 @@ RootWindowWin::~RootWindowWin() {
REQUIRE_MAIN_THREAD();
::DeleteObject(draggable_region_);
::DeleteObject(font_);
// The window and browser should already have been destroyed.
DCHECK(window_destroyed_);
......@@ -182,8 +209,11 @@ void RootWindowWin::Hide() {
void RootWindowWin::SetBounds(int x, int y, size_t width, size_t height) {
REQUIRE_MAIN_THREAD();
if (hwnd_)
SetWindowPos(hwnd_, NULL, 0, 0, 0, 0, SWP_NOZORDER);
if (hwnd_) {
SetWindowPos(hwnd_, NULL,
x, y, static_cast<int>(width), static_cast<int>(height),
SWP_NOZORDER);
}
}
void RootWindowWin::Close(bool force) {
......@@ -197,6 +227,21 @@ void RootWindowWin::Close(bool force) {
}
}
void RootWindowWin::SetDeviceScaleFactor(float device_scale_factor) {
REQUIRE_MAIN_THREAD();
if (browser_window_)
browser_window_->SetDeviceScaleFactor(device_scale_factor);
}
float RootWindowWin::GetDeviceScaleFactor() const {
REQUIRE_MAIN_THREAD();
if (browser_window_)
return browser_window_->GetDeviceScaleFactor();
return client::GetDeviceScaleFactor();
}
CefRefPtr<CefBrowser> RootWindowWin::GetBrowser() const {
REQUIRE_MAIN_THREAD();
......@@ -254,7 +299,7 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
RECT window_rect = start_rect_;
::AdjustWindowRectEx(&window_rect, dwStyle, with_controls_, 0);
if (with_controls_)
window_rect.bottom += URLBAR_HEIGHT;
window_rect.bottom += GetURLBarHeight();
x = start_rect_.left;
y = start_rect_.top;
......@@ -267,8 +312,6 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
dwStyle,
x, y, width, height,
NULL, NULL, hInstance, NULL);
DWORD dw = GetLastError();
CHECK(hwnd_);
// Associate |this| with the main window.
......@@ -279,46 +322,64 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
if (with_controls_) {
// Create the child controls.
int x = 0;
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, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
x_offset, 0, button_width, urlbar_height,
hwnd_, reinterpret_cast<HMENU>(IDC_NAV_BACK), hInstance, 0);
CHECK(back_hwnd_);
x += BUTTON_WIDTH;
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, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
x_offset, 0, button_width, urlbar_height,
hwnd_, reinterpret_cast<HMENU>(IDC_NAV_FORWARD), hInstance, 0);
CHECK(forward_hwnd_);
x += BUTTON_WIDTH;
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, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
x_offset, 0, button_width, urlbar_height,
hwnd_, reinterpret_cast<HMENU>(IDC_NAV_RELOAD), hInstance, 0);
CHECK(reload_hwnd_);
x += BUTTON_WIDTH;
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, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
x_offset, 0, button_width, urlbar_height,
hwnd_, reinterpret_cast<HMENU>(IDC_NAV_STOP), hInstance, 0);
CHECK(stop_hwnd_);
x += BUTTON_WIDTH;
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, 0, rect.right - BUTTON_WIDTH * 4, URLBAR_HEIGHT,
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.
......@@ -327,7 +388,7 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
// Associate |this| with the edit window.
SetUserDataPtr(edit_hwnd_, this);
rect.top += URLBAR_HEIGHT;
rect.top += urlbar_height;
if (!with_osr_) {
// Remove the menu items that are only used with OSR.
......@@ -335,9 +396,8 @@ void RootWindowWin::CreateRootWindow(const CefBrowserSettings& settings) {
if (hMenu) {
HMENU hTestMenu = ::GetSubMenu(hMenu, 2);
if (hTestMenu) {
::RemoveMenu(hTestMenu, ID_TESTS_FPS_INCREASE, MF_BYCOMMAND);
::RemoveMenu(hTestMenu, ID_TESTS_FPS_DECREASE, MF_BYCOMMAND);
::RemoveMenu(hTestMenu, ID_TESTS_FPS_RESET, MF_BYCOMMAND);
::RemoveMenu(hTestMenu, ID_TESTS_OSR_FPS, MF_BYCOMMAND);
::RemoveMenu(hTestMenu, ID_TESTS_OSR_DSF, MF_BYCOMMAND);
}
}
}
......@@ -575,23 +635,26 @@ void RootWindowWin::OnSize(bool minimized) {
GetClientRect(hwnd_, &rect);
if (with_controls_) {
static int button_width = GetButtonWidth();
static int urlbar_height = GetURLBarHeight();
// Resize the window and address bar to match the new frame size.
rect.top += URLBAR_HEIGHT;
rect.top += urlbar_height;
int urloffset = rect.left + BUTTON_WIDTH * 4;
int urloffset = rect.left + button_width * 4;
if (browser_window_) {
HWND browser_hwnd = browser_window_->GetWindowHandle();
HDWP hdwp = BeginDeferWindowPos(1);
hdwp = DeferWindowPos(hdwp, edit_hwnd_, NULL, urloffset,
0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER);
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);
EndDeferWindowPos(hdwp);
} else {
SetWindowPos(edit_hwnd_, NULL, urloffset,
0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER);
0, rect.right - urloffset, urlbar_height, SWP_NOZORDER);
}
} else if (browser_window_) {
// Size the browser window to the whole client area.
......
......@@ -45,6 +45,8 @@ class RootWindowWin : public RootWindow,
void Hide() OVERRIDE;
void SetBounds(int x, int y, size_t width, size_t height) OVERRIDE;
void Close(bool force) OVERRIDE;
void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
float GetDeviceScaleFactor() const OVERRIDE;
CefRefPtr<CefBrowser> GetBrowser() const OVERRIDE;
ClientWindowHandle GetWindowHandle() const OVERRIDE;
......@@ -112,6 +114,9 @@ class RootWindowWin : public RootWindow,
// Draggable region.
HRGN draggable_region_;
// Font for buttons and text fields.
HFONT font_;
// Buttons.
HWND back_hwnd_;
HWND forward_hwnd_;
......
......@@ -171,27 +171,113 @@ void ModifyZoom(CefRefPtr<CefBrowser> browser, double delta) {
browser->GetHost()->GetZoomLevel() + delta);
}
void ModifyFPS(CefRefPtr<CefBrowser> browser, int fps_delta) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute on the UI thread.
CefPostTask(TID_UI, base::Bind(&ModifyFPS, browser, fps_delta));
return;
const char kPrompt[] = "Prompt.";
const char kPromptFPS[] = "FPS";
const char kPromptDSF[] = "DSF";
// Handles execution of prompt results.
class PromptHandler : public CefMessageRouterBrowserSide::Handler {
public:
PromptHandler() {}
// Called due to cefQuery execution.
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int64 query_id,
const CefString& request,
bool persistent,
CefRefPtr<Callback> callback) OVERRIDE {
// Parse |request| which takes the form "Prompt.[type]:[value]".
const std::string& request_str = request;
if (request_str.find(kPrompt) != 0)
return false;
std::string type = request_str.substr(sizeof(kPrompt) - 1);
size_t delim = type.find(':');
if (delim == std::string::npos)
return false;
const std::string& value = type.substr(delim + 1);
type = type.substr(0, delim);
// Canceling the prompt dialog returns a value of "null".
if (value != "null") {
if (type == kPromptFPS)
SetFPS(browser, atoi(value.c_str()));
else if (type == kPromptDSF)
SetDSF(browser, static_cast<float>(atof(value.c_str())));
}
int fps;
if (fps_delta == 0) {
// Nothing is done with the response.
callback->Success(CefString());
return true;
}
private:
void SetFPS(CefRefPtr<CefBrowser> browser, int fps) {
if (fps <= 0) {
// Reset to the default value.
CefBrowserSettings settings;
MainContext::Get()->PopulateBrowserSettings(&settings);
fps = settings.windowless_frame_rate;
} else {
// Modify the existing value.
fps = browser->GetHost()->GetWindowlessFrameRate() + fps_delta;
if (fps <= 0)
fps = 1;
}
browser->GetHost()->SetWindowlessFrameRate(fps);
}
void SetDSF(CefRefPtr<CefBrowser> browser, float dsf) {
MainMessageLoop::Get()->PostClosure(
base::Bind(&PromptHandler::SetDSFOnMainThread, browser, dsf));
}
static void SetDSFOnMainThread(CefRefPtr<CefBrowser> browser, float dsf) {
RootWindow::GetForBrowser(browser->GetIdentifier())->
SetDeviceScaleFactor(dsf);
}
};
void Prompt(CefRefPtr<CefBrowser> browser,
const std::string& type,
const std::string& label,
const std::string& default_value) {
// Prompt the user for a new value. Works as follows:
// 1. Show a prompt() dialog via JavaScript.
// 2. Pass the result to window.cefQuery().
// 3. Handle the result in PromptHandler::OnQuery.
const std::string& code =
"window.cefQuery({'request': '" + std::string(kPrompt) + type +
":' + prompt('" + label + "', '" + default_value + "')});";
browser->GetMainFrame()->ExecuteJavaScript(
code, browser->GetMainFrame()->GetURL(), 0);
}
void PromptFPS(CefRefPtr<CefBrowser> browser) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute on the UI thread.
CefPostTask(TID_UI, base::Bind(&PromptFPS, browser));
return;
}
// Format the default value string.
std::stringstream ss;
ss << browser->GetHost()->GetWindowlessFrameRate();
Prompt(browser, kPromptFPS, "Enter FPS", ss.str());
}
void PromptDSF(CefRefPtr<CefBrowser> browser) {
if (!MainMessageLoop::Get()->RunsTasksOnCurrentThread()) {
// Execute on the main thread.
MainMessageLoop::Get()->PostClosure(base::Bind(&PromptDSF, browser));
return;
}
// Format the default value string.
std::stringstream ss;
ss << RootWindow::GetForBrowser(browser->GetIdentifier())->
GetDeviceScaleFactor();
Prompt(browser, kPromptDSF, "Enter Device Scale Factor", ss.str());
}
void BeginTracing() {
......@@ -437,14 +523,11 @@ void RunTest(CefRefPtr<CefBrowser> browser, int id) {
case ID_TESTS_ZOOM_RESET:
browser->GetHost()->SetZoomLevel(0.0);
break;
case ID_TESTS_FPS_INCREASE:
ModifyFPS(browser, 10);
case ID_TESTS_OSR_FPS:
PromptFPS(browser);
break;
case ID_TESTS_FPS_DECREASE:
ModifyFPS(browser, -10);
break;
case ID_TESTS_FPS_RESET:
ModifyFPS(browser, 0);
case ID_TESTS_OSR_DSF:
PromptDSF(browser);
break;
case ID_TESTS_TRACING_BEGIN:
BeginTracing();
......@@ -616,6 +699,8 @@ void Alert(CefRefPtr<CefBrowser> browser, const std::string& message) {
}
void CreateMessageHandlers(MessageHandlerSet& handlers) {
handlers.insert(new PromptHandler);
// Create the dialog test handlers.
dialog_test::CreateMessageHandlers(handlers);
......
......@@ -103,13 +103,13 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
CEF_REQUIRE_UI_THREAD();
// Only handle messages from the test URL.
const std::string& url = frame->GetURL();
std::string url = frame->GetURL();
if (url.find(kTestUrl) != 0)
return false;
const std::string& message_name = request;
if (message_name.find(kTestMessageName) == 0) {
const std::string& url = message_name.substr(sizeof(kTestMessageName));
url = message_name.substr(sizeof(kTestMessageName));
CancelPendingRequest();
......@@ -119,20 +119,20 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
callback_ = callback;
// Create a CefRequest for the specified URL.
CefRefPtr<CefRequest> request = CefRequest::Create();
request->SetURL(url);
request->SetMethod("GET");
CefRefPtr<CefRequest> cef_request = CefRequest::Create();
cef_request->SetURL(url);
cef_request->SetMethod("GET");
// Callback to be executed on request completion.
// It's safe to use base::Unretained() here because there is only one
// RequestClient pending at any given time and we explicitly detach the
// callback in the Handler destructor.
const RequestClient::Callback& callback =
const RequestClient::Callback& request_callback =
base::Bind(&Handler::OnRequestComplete, base::Unretained(this));
// Create and start the new CefURLRequest.
urlrequest_ = CefURLRequest::Create(request,
new RequestClient(callback),
urlrequest_ = CefURLRequest::Create(cef_request,
new RequestClient(request_callback),
NULL);
return true;
......
......@@ -5,7 +5,6 @@
#include "cefclient/browser/util_win.h"
#include "include/base/cef_logging.h"
#include "include/internal/cef_types.h"
namespace client {
......@@ -140,4 +139,22 @@ bool IsKeyDown(WPARAM wparam) {
return (GetKeyState(wparam) & 0x8000) != 0;
}
float GetDeviceScaleFactor() {
static float scale_factor = 1.0;
static bool initialized = false;
if (!initialized) {
// This value is safe to cache for the life time of the app since the user
// must logout to change the DPI setting. This value also applies to all
// screens.
HDC screen_dc = ::GetDC(NULL);
int dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX);
scale_factor = static_cast<float>(dpi_x) / 96.0f;
::ReleaseDC(NULL, screen_dc);
initialized = true;
}
return scale_factor;
}
} // namespace client
......@@ -9,6 +9,8 @@
#include <windows.h>
#include <string>
#include "include/internal/cef_types_wrappers.h"
namespace client {
// Set the window's user data pointer.
......@@ -30,6 +32,10 @@ int GetCefMouseModifiers(WPARAM wparam);
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
bool IsKeyDown(WPARAM wparam);
// Returns the device scale factor. For example, 200% display scaling will
// return 2.0.
float GetDeviceScaleFactor();
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_
......@@ -43,10 +43,6 @@ ClientApp::ProcessType ClientApp::GetProcessType(
void ClientApp::OnRegisterCustomSchemes(
CefRefPtr<CefSchemeRegistrar> registrar) {
// Default schemes that support cookies.
cookieable_schemes_.push_back("http");
cookieable_schemes_.push_back("https");
RegisterCustomSchemes(registrar, cookieable_schemes_);
}
......
......@@ -27,6 +27,7 @@ const char kShowUpdateRect[] = "show-update-rect";
const char kMouseCursorChangeDisabled[] = "mouse-cursor-change-disabled";
const char kRequestContextPerBrowser[] = "request-context-per-browser";
const char kBackgroundColor[] = "background-color";
const char kEnableGPU[] = "enable-gpu";
} // namespace switches
} // namespace client
......@@ -21,6 +21,7 @@ extern const char kShowUpdateRect[];
extern const char kMouseCursorChangeDisabled[];
extern const char kRequestContextPerBrowser[];
extern const char kBackgroundColor[];
extern const char kEnableGPU[];
} // namespace switches
} // namespace client
......
......@@ -125,7 +125,7 @@ class ClientAppRenderer : public ClientApp,
CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE;
protected:
private:
// Set of supported Delegates.
DelegateSet delegates_;
......
// Microsoft Visual C++ generated resource script.
//
#include "../../../cefclient/browser/resource.h"
#include "cefclient/browser/resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
......@@ -9,7 +9,7 @@
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#include "../../../include/cef_version.h"
#include "include/cef_version.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
......@@ -82,9 +82,8 @@ BEGIN
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET
MENUITEM "FPS Increase", ID_TESTS_FPS_INCREASE
MENUITEM "FPS Decrease", ID_TESTS_FPS_DECREASE
MENUITEM "FPS Reset", ID_TESTS_FPS_RESET
MENUITEM "Set FPS", ID_TESTS_OSR_FPS
MENUITEM "Set Scale Factor", ID_TESTS_OSR_DSF
MENUITEM "Begin Tracing", ID_TESTS_TRACING_BEGIN
MENUITEM "End Tracing", ID_TESTS_TRACING_END
MENUITEM "Print", ID_TESTS_PRINT
......
......@@ -72,15 +72,16 @@ typedef int int32;
typedef unsigned int uint32;
#endif
// UTF-16 character type
#endif // !BUILDING_CEF_SHARED
// UTF-16 character type.
// This should be kept synchronized with base/strings/string16.h
#ifndef char16
#if defined(WIN32)
#if defined(WCHAR_T_IS_UTF16)
typedef wchar_t char16;
#else
#elif defined(WCHAR_T_IS_UTF32)
typedef unsigned short char16;
#endif
#endif
#endif // !BUILDING_CEF_SHARED
#endif // CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
......@@ -132,22 +132,6 @@
#error Please add support for your compiler in cef_build.h
#endif
// Annotate a virtual method indicating it must be overriding a virtual
// method in the parent class.
// Use like:
// virtual void foo() OVERRIDE;
#ifndef OVERRIDE
#if defined(__clang__) || defined(COMPILER_MSVC)
#define OVERRIDE override
#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
#define OVERRIDE override
#else
#define OVERRIDE
#endif
#endif // OVERRIDE
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() WARN_UNUSED_RESULT;
......@@ -183,4 +167,23 @@
#endif // !BUILDING_CEF_SHARED
// Annotate a virtual method indicating it must be overriding a virtual method
// in the parent class.
// Use like:
// void foo() OVERRIDE;
// NOTE: This define should only be used in classes exposed to the client since
// C++11 support may not be enabled in client applications. CEF internal classes
// should use the `override` keyword directly.
#ifndef OVERRIDE
#if defined(__clang__) || defined(COMPILER_MSVC)
#define OVERRIDE override
#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
#define OVERRIDE override
#else
#define OVERRIDE
#endif
#endif // OVERRIDE
#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_
......@@ -60,7 +60,7 @@ class BindStateBase {
protected:
explicit BindStateBase(void (*destructor)(BindStateBase*))
: ref_count_(0), destructor_(destructor) {}
~BindStateBase() = default;
~BindStateBase() {}
private:
friend class scoped_refptr<BindStateBase>;
......
......@@ -60,10 +60,10 @@ typedef struct _cef_cookie_manager_t {
cef_base_t base;
///
// Set the schemes supported by this manager. By default only "http" and
// "https" schemes are supported. If |callback| is non-NULL it will be
// executed asnychronously on the IO thread after the change has been applied.
// Must be called before any cookies are accessed.
// Set the schemes supported by this manager. The default schemes ("http",
// "https", "ws" and "wss") will always be supported. If |callback| is non-
// NULL it will be executed asnychronously on the IO thread after the change
// has been applied. Must be called before any cookies are accessed.
///
void (CEF_CALLBACK *set_supported_schemes)(struct _cef_cookie_manager_t* self,
cef_string_list_t schemes, struct _cef_completion_callback_t* callback);
......
......@@ -113,17 +113,17 @@ class CefRefCount {
///
#define IMPLEMENT_REFCOUNTING(ClassName) \
public: \
void AddRef() const { \
void AddRef() const OVERRIDE { \
ref_count_.AddRef(); \
} \
bool Release() const { \
bool Release() const OVERRIDE { \
if (ref_count_.Release()) { \
delete static_cast<const ClassName*>(this); \
return true; \
} \
return false; \
} \
bool HasOneRef() const { \
bool HasOneRef() const OVERRIDE { \
return ref_count_.HasOneRef(); \
} \
private: \
......
......@@ -80,10 +80,10 @@ class CefCookieManager : public virtual CefBase {
CefRefPtr<CefCompletionCallback> callback);
///
// Set the schemes supported by this manager. By default only "http" and
// "https" schemes are supported. If |callback| is non-NULL it will be
// executed asnychronously on the IO thread after the change has been applied.
// Must be called before any cookies are accessed.
// Set the schemes supported by this manager. The default schemes ("http",
// "https", "ws" and "wss") will always be supported. If |callback| is non-
// NULL it will be executed asnychronously on the IO thread after the change
// has been applied. Must be called before any cookies are accessed.
///
/*--cef(optional_param=callback)--*/
virtual void SetSupportedSchemes(
......
......@@ -148,7 +148,7 @@ class CefRunnableMethod : public CefTask {
traits_.ReleaseCallee(obj);
}
virtual void Execute() {
void Execute() OVERRIDE {
if (obj_)
DispatchToMethod(obj_, meth_, params_);
}
......@@ -240,7 +240,7 @@ class CefRunnableFunction : public CefTask {
~CefRunnableFunction() {
}
virtual void Execute() {
void Execute() OVERRIDE {
if (function_)
DispatchToFunction(function_, params_);
}
......
......@@ -35,15 +35,15 @@
#ifndef CEF_INCLUDE_CEF_VERSION_H_
#define CEF_INCLUDE_CEF_VERSION_H_
#define CEF_VERSION "3.2454.1301.g9e0d84d"
#define CEF_VERSION "3.2478.1316.gaa72f40"
#define CEF_VERSION_MAJOR 3
#define CEF_COMMIT_NUMBER 1301
#define CEF_COMMIT_HASH "9e0d84d94af8acc5b7af0ee13218c2ed9ba4a021"
#define CEF_COMMIT_NUMBER 1316
#define CEF_COMMIT_HASH "aa72f402ba86d0ef9a9ab53d74967a590c1622ea"
#define COPYRIGHT_YEAR 2015
#define CHROME_VERSION_MAJOR 45
#define CHROME_VERSION_MAJOR 46
#define CHROME_VERSION_MINOR 0
#define CHROME_VERSION_BUILD 2454
#define CHROME_VERSION_BUILD 2478
#define CHROME_VERSION_PATCH 0
#define DO_MAKE_STRING(p) #p
......@@ -63,13 +63,13 @@ extern "C" {
// universal hash value will change if any platform is affected whereas the
// platform hash values will change only if that particular platform is
// affected.
#define CEF_API_HASH_UNIVERSAL "8360fb6e0c46d002707201e118579ebb12d69a23"
#define CEF_API_HASH_UNIVERSAL "2c9a767c027f6380191ab95185ef148baf7ca191"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "646d39359f7076a724890f43afc4255ce5869f7e"
#define CEF_API_HASH_PLATFORM "c47aabf0f73fca45e1d73c9372cb52b1cbede469"
#elif defined(OS_MACOSX)
#define CEF_API_HASH_PLATFORM "c2acbf4aa99c076e1f0439b7b2b99cd291d82969"
#define CEF_API_HASH_PLATFORM "8f78e01cbb250a0b8a7d0b3106535aea66baface"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "7be48c017869e230d97b1795ca6beeb4eaa00d53"
#define CEF_API_HASH_PLATFORM "7a2c00c9da8ad33d101a3462389865beb3cf0b25"
#endif
// Returns CEF version information for the libcef library. The |entry|
......
......@@ -38,26 +38,13 @@
#include <stddef.h>
#include "include/base/cef_build.h"
#include "include/base/cef_basictypes.h"
#include "include/internal/cef_export.h"
#ifdef __cplusplus
extern "C" {
#endif
// CEF character type definitions. wchar_t is 2 bytes on Windows and 4 bytes on
// most other platforms.
#if defined(OS_WIN)
typedef wchar_t char16;
#else // !OS_WIN
typedef unsigned short char16; // NOLINT (runtime/int)
#ifndef WCHAR_T_IS_UTF32
#define WCHAR_T_IS_UTF32
#endif // WCHAR_T_IS_UTF32
#endif // !OS_WIN
// CEF string type definitions. Whomever allocates |str| is responsible for
// providing an appropriate |dtor| implementation that will free the string in
// the same memory space. When reusing an existing string structure make sure
......
......@@ -32,7 +32,7 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
#pragma once
#include "include/base/cef_build.h"
#include "include/base/cef_basictypes.h"
#include "include/internal/cef_string.h"
#include "include/internal/cef_string_list.h"
#include "include/internal/cef_time.h"
......@@ -46,45 +46,6 @@
#include "include/internal/cef_types_linux.h"
#endif
#include <limits.h> // For UINT_MAX
#include <stddef.h> // For size_t
// The NSPR system headers define 64-bit as |long| when possible, except on
// Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
//
// On Mac OS X, |long long| is used for 64-bit types for compatibility with
// <inttypes.h> format macros even in the LP64 model.
#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
typedef long int64; // NOLINT(runtime/int)
typedef unsigned long uint64; // NOLINT(runtime/int)
#else
typedef long long int64; // NOLINT(runtime/int)
typedef unsigned long long uint64; // NOLINT(runtime/int)
#endif
// TODO: Remove these type guards. These are to avoid conflicts with
// obsolete/protypes.h in the Gecko SDK.
#ifndef _INT32
#define _INT32
typedef int int32;
#endif
// TODO: Remove these type guards. These are to avoid conflicts with
// obsolete/protypes.h in the Gecko SDK.
#ifndef _UINT32
#define _UINT32
typedef unsigned int uint32;
#endif
// UTF-16 character type
#ifndef char16
#if defined(WIN32)
typedef wchar_t char16;
#else
typedef unsigned short char16;
#endif
#endif
// 32-bit ARGB color value, not premultiplied. The color components are always
// in a known order. Equivalent to the SkColor type.
typedef uint32 cef_color_t;
......
......@@ -161,8 +161,8 @@ class CefPoint : public CefStructBase<CefPointTraits> {
}
bool IsEmpty() const { return x <= 0 && y <= 0; }
void Set(int x, int y) {
this->x = x, this->y = y;
void Set(int x_val, int y_val) {
x = x_val, y = y_val;
}
};
......@@ -202,8 +202,8 @@ class CefRect : public CefStructBase<CefRectTraits> {
}
bool IsEmpty() const { return width <= 0 || height <= 0; }
void Set(int x, int y, int width, int height) {
this->x = x, this->y = y, this->width = width, this->height = height;
void Set(int x_val, int y_val, int width_val, int height_val) {
x = x_val, y = y_val, width = width_val, height = height_val;
}
};
......@@ -243,8 +243,8 @@ class CefSize : public CefStructBase<CefSizeTraits> {
}
bool IsEmpty() const { return width <= 0 || height <= 0; }
void Set(int width, int height) {
this->width = width, this->height = height;
void Set(int width_val, int height_val) {
width = width_val, height = height_val;
}
};
......@@ -285,8 +285,8 @@ class CefDraggableRegion : public CefStructBase<CefDraggableRegionTraits> {
Set(bounds, draggable);
}
void Set(const CefRect& bounds, bool draggable) {
this->bounds = bounds, this->draggable = draggable;
void Set(const CefRect& bounds_val, bool draggable_val) {
bounds = bounds_val, draggable = draggable_val;
}
};
......@@ -340,18 +340,18 @@ class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
is_monochrome, rect, available_rect);
}
void Set(float device_scale_factor,
int depth,
int depth_per_component,
bool is_monochrome,
const CefRect& rect,
const CefRect& available_rect) {
this->device_scale_factor = device_scale_factor;
this->depth = depth;
this->depth_per_component = depth_per_component;
this->is_monochrome = is_monochrome;
this->rect = rect;
this->available_rect = available_rect;
void Set(float device_scale_factor_val,
int depth_val,
int depth_per_component_val,
bool is_monochrome_val,
const CefRect& rect_val,
const CefRect& available_rect_val) {
device_scale_factor = device_scale_factor_val;
depth = depth_val;
depth_per_component = depth_per_component_val;
is_monochrome = is_monochrome_val;
rect = rect_val;
available_rect = available_rect_val;
}
};
......@@ -827,8 +827,8 @@ class CefPageRange : public CefStructBase<CefPageRangeTraits> {
Set(from, to);
}
void Set(int from, int to) {
this->from = from, this->to = to;
void Set(int from_val, int to_val) {
from = from_val, to = to_val;
}
};
......
......@@ -85,7 +85,6 @@ size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
if (!reader->MoveToFirstFile())
return 0;
CefRefPtr<CefZipFile> contents;
FileMap::iterator it;
size_t count = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment