mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Use CMake configuration to detect ATL support (issue #1328).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1888 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -480,6 +480,22 @@ if(OS_WINDOWS)
|
|||||||
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.lib")
|
||||||
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Configure use of ATL.
|
||||||
|
option(USE_ATL "Enable or disable use of ATL." ON)
|
||||||
|
if(USE_ATL)
|
||||||
|
# Determine if the Visual Studio install supports ATL.
|
||||||
|
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||||
|
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
|
||||||
|
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||||
|
set(USE_ATL OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(USE_ATL)
|
||||||
|
# Definition used by apps to test if ATL support is enabled.
|
||||||
|
add_definitions(-DCEF_USE_ATL)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -531,6 +547,7 @@ endif()
|
|||||||
|
|
||||||
if(OS_WINDOWS)
|
if(OS_WINDOWS)
|
||||||
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
|
||||||
|
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(LIBRARIES ${CEF_STANDARD_LIBS})
|
set(LIBRARIES ${CEF_STANDARD_LIBS})
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "cefclient/cefclient_osr_dragdrop_win.h"
|
#include "cefclient/cefclient_osr_dragdrop_win.h"
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
@@ -646,3 +648,5 @@ DataObjectWin::DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count)
|
|||||||
m_pStgMedium[i] = stgmed[i];
|
m_pStgMedium[i] = stgmed[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined(CEF_USE_ATL)
|
||||||
|
@@ -6,6 +6,14 @@
|
|||||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// When generating projects with CMake the CEF_USE_ATL value will be defined
|
||||||
|
// automatically if using a supported Visual Studio version. Pass -DUSE_ATL=OFF
|
||||||
|
// to the CMake command-line to disable use of ATL.
|
||||||
|
// Uncomment this line to manually enable ATL support.
|
||||||
|
// #define CEF_USE_ATL 1
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
|
|
||||||
#include <atlcomcli.h>
|
#include <atlcomcli.h>
|
||||||
#include <objidl.h>
|
#include <objidl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -175,4 +183,6 @@ class DataObjectWin : public IDataObject {
|
|||||||
explicit DataObjectWin(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
|
explicit DataObjectWin(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // defined(CEF_USE_ATL)
|
||||||
|
|
||||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_OSR_DRAGDROP_WIN_H_
|
||||||
|
@@ -44,9 +44,12 @@ bool OSRWindow::CreateWidget(HWND hWndParent, const RECT& rect,
|
|||||||
// Reference released in OnDestroyed().
|
// Reference released in OnDestroyed().
|
||||||
AddRef();
|
AddRef();
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
drop_target_ = DropTargetWin::Create(this, hWnd_);
|
drop_target_ = DropTargetWin::Create(this, hWnd_);
|
||||||
HRESULT register_res = RegisterDragDrop(hWnd_, drop_target_);
|
HRESULT register_res = RegisterDragDrop(hWnd_, drop_target_);
|
||||||
DCHECK_EQ(register_res, S_OK);
|
DCHECK_EQ(register_res, S_OK);
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +59,11 @@ void OSRWindow::DestroyWidget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
void OSRWindow::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
RevokeDragDrop(hWnd_);
|
RevokeDragDrop(hWnd_);
|
||||||
drop_target_ = NULL;
|
drop_target_ = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
DisableGL();
|
DisableGL();
|
||||||
::DestroyWindow(hWnd_);
|
::DestroyWindow(hWnd_);
|
||||||
}
|
}
|
||||||
@@ -155,6 +161,7 @@ bool OSRWindow::StartDragging(CefRefPtr<CefBrowser> browser,
|
|||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
CefRenderHandler::DragOperationsMask allowed_ops,
|
CefRenderHandler::DragOperationsMask allowed_ops,
|
||||||
int x, int y) {
|
int x, int y) {
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
if (!drop_target_)
|
if (!drop_target_)
|
||||||
return false;
|
return false;
|
||||||
current_drag_op_ = DRAG_OPERATION_NONE;
|
current_drag_op_ = DRAG_OPERATION_NONE;
|
||||||
@@ -167,11 +174,17 @@ bool OSRWindow::StartDragging(CefRefPtr<CefBrowser> browser,
|
|||||||
browser->GetHost()->DragSourceEndedAt(pt.x, pt.y, result);
|
browser->GetHost()->DragSourceEndedAt(pt.x, pt.y, result);
|
||||||
browser->GetHost()->DragSourceSystemDragEnded();
|
browser->GetHost()->DragSourceSystemDragEnded();
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
// Cancel the drag. The dragging implementation requires ATL support.
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
void OSRWindow::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
|
||||||
CefRenderHandler::DragOperation operation) {
|
CefRenderHandler::DragOperation operation) {
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
current_drag_op_ = operation;
|
current_drag_op_ = operation;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSRWindow::Invalidate() {
|
void OSRWindow::Invalidate() {
|
||||||
@@ -202,6 +215,8 @@ void OSRWindow::WasHidden(bool hidden) {
|
|||||||
hidden_ = hidden;
|
hidden_ = hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
|
|
||||||
CefBrowserHost::DragOperationsMask
|
CefBrowserHost::DragOperationsMask
|
||||||
OSRWindow::OnDragEnter(CefRefPtr<CefDragData> drag_data,
|
OSRWindow::OnDragEnter(CefRefPtr<CefDragData> drag_data,
|
||||||
CefMouseEvent ev,
|
CefMouseEvent ev,
|
||||||
@@ -230,13 +245,17 @@ CefBrowserHost::DragOperationsMask
|
|||||||
return current_drag_op_;
|
return current_drag_op_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined(CEF_USE_ATL)
|
||||||
|
|
||||||
OSRWindow::OSRWindow(OSRBrowserProvider* browser_provider, bool transparent)
|
OSRWindow::OSRWindow(OSRBrowserProvider* browser_provider, bool transparent)
|
||||||
: renderer_(transparent),
|
: renderer_(transparent),
|
||||||
browser_provider_(browser_provider),
|
browser_provider_(browser_provider),
|
||||||
hWnd_(NULL),
|
hWnd_(NULL),
|
||||||
hDC_(NULL),
|
hDC_(NULL),
|
||||||
hRC_(NULL),
|
hRC_(NULL),
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
current_drag_op_(DRAG_OPERATION_NONE),
|
current_drag_op_(DRAG_OPERATION_NONE),
|
||||||
|
#endif
|
||||||
painting_popup_(false),
|
painting_popup_(false),
|
||||||
render_task_pending_(false),
|
render_task_pending_(false),
|
||||||
hidden_(false) {
|
hidden_(false) {
|
||||||
|
@@ -19,8 +19,11 @@ class OSRBrowserProvider {
|
|||||||
virtual ~OSRBrowserProvider() {}
|
virtual ~OSRBrowserProvider() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OSRWindow : public ClientHandler::RenderHandler,
|
class OSRWindow : public ClientHandler::RenderHandler
|
||||||
public DragEvents {
|
#if defined(CEF_USE_ATL)
|
||||||
|
, public DragEvents
|
||||||
|
#endif
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
// Create a new OSRWindow instance. |browser_provider| must outlive this
|
// Create a new OSRWindow instance. |browser_provider| must outlive this
|
||||||
// object.
|
// object.
|
||||||
@@ -75,6 +78,7 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
|||||||
CefRefPtr<CefBrowser> browser,
|
CefRefPtr<CefBrowser> browser,
|
||||||
CefRenderHandler::DragOperation operation) OVERRIDE;
|
CefRenderHandler::DragOperation operation) OVERRIDE;
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
// DragEvents methods
|
// DragEvents methods
|
||||||
virtual CefBrowserHost::DragOperationsMask OnDragEnter(
|
virtual CefBrowserHost::DragOperationsMask OnDragEnter(
|
||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
@@ -85,6 +89,7 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
|||||||
virtual void OnDragLeave() OVERRIDE;
|
virtual void OnDragLeave() OVERRIDE;
|
||||||
virtual CefBrowserHost::DragOperationsMask OnDrop(CefMouseEvent ev,
|
virtual CefBrowserHost::DragOperationsMask OnDrop(CefMouseEvent ev,
|
||||||
CefBrowserHost::DragOperationsMask effect) OVERRIDE;
|
CefBrowserHost::DragOperationsMask effect) OVERRIDE;
|
||||||
|
#endif // defined(CEF_USE_ATL)
|
||||||
|
|
||||||
void Invalidate();
|
void Invalidate();
|
||||||
void WasHidden(bool hidden);
|
void WasHidden(bool hidden);
|
||||||
@@ -115,8 +120,10 @@ class OSRWindow : public ClientHandler::RenderHandler,
|
|||||||
HDC hDC_;
|
HDC hDC_;
|
||||||
HGLRC hRC_;
|
HGLRC hRC_;
|
||||||
|
|
||||||
|
#if defined(CEF_USE_ATL)
|
||||||
CComPtr<DropTargetWin> drop_target_;
|
CComPtr<DropTargetWin> drop_target_;
|
||||||
CefRenderHandler::DragOperation current_drag_op_;
|
CefRenderHandler::DragOperation current_drag_op_;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool painting_popup_;
|
bool painting_popup_;
|
||||||
bool render_task_pending_;
|
bool render_task_pending_;
|
||||||
|
Reference in New Issue
Block a user