mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add DLL build support and wrapper that allows clients to transparently switch between static and dynamic CEF builds.
- The libcef project now builds libcef_static.lib instead of libcef.lib. - The libcef_dll project builds libcef.lib and libcef.dll. This DLL exports the new CEF C API defined in cef_capi.h, cef_nplugin_capi.h, cef_string.h and cef_string_map.h. - The libcef_dll_wrapper project builds libcef_dll_wrapper.lib. This static library wraps the new C API calls with an implementation of the CEF C++ interface as defined in cef.h and cef_nplugin.h. - The cefclient project now uses the DLL instead of the static library. - Type definitions have been moved from cef.h to cef_types.h so that they can be shared by both cef.h and cef_capi.h. This change required some enumeration member name modifications throughout the code base. - Fixed variable naming inconsistencies. - Added CefVariant::GetArraySize() method and _NPN_ArrayObjectGetVectorSize() function. - Remove the ProjectSection(WebsiteProperties) sections from cef.sln to improve VS2005 performance. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@16 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -38,91 +38,91 @@ CefBrowserImpl::~CefBrowserImpl()
|
||||
void CefBrowserImpl::GoBack()
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction, CefHandler::ID_NAV_BACK, TF_MAIN));
|
||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_NAV_BACK, TF_MAIN));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::GoForward()
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_NAV_FORWARD, TF_MAIN));
|
||||
MENU_ID_NAV_FORWARD, TF_MAIN));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Reload()
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_NAV_RELOAD, TF_MAIN));
|
||||
MENU_ID_NAV_RELOAD, TF_MAIN));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::StopLoad()
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_NAV_STOP, TF_MAIN));
|
||||
MENU_ID_NAV_STOP, TF_MAIN));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Undo(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_UNDO, targetFrame));
|
||||
MENU_ID_UNDO, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Redo(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_REDO, targetFrame));
|
||||
MENU_ID_REDO, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Cut(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_CUT, targetFrame));
|
||||
MENU_ID_CUT, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Copy(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_COPY, targetFrame));
|
||||
MENU_ID_COPY, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Paste(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_PASTE, targetFrame));
|
||||
MENU_ID_PASTE, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Delete(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_DELETE, targetFrame));
|
||||
MENU_ID_DELETE, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::SelectAll(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_SELECTALL, targetFrame));
|
||||
MENU_ID_SELECTALL, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::Print(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_PRINT, targetFrame));
|
||||
MENU_ID_PRINT, targetFrame));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::ViewSource(TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_HandleAction,
|
||||
CefHandler::ID_VIEWSOURCE, targetFrame));
|
||||
MENU_ID_VIEWSOURCE, targetFrame));
|
||||
}
|
||||
void CefBrowserImpl::LoadRequest(CefRefPtr<CefRequest> request)
|
||||
{
|
||||
@@ -154,13 +154,13 @@ void CefBrowserImpl::LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
&CefBrowserImpl::UIT_LoadHTMLForStreamRef, stream.get(), url));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::ExecuteJavaScript(const std::wstring& js_code,
|
||||
const std::wstring& script_url,
|
||||
int start_line,
|
||||
void CefBrowserImpl::ExecuteJavaScript(const std::wstring& jsCode,
|
||||
const std::wstring& scriptUrl,
|
||||
int startLine,
|
||||
TargetFrame targetFrame)
|
||||
{
|
||||
PostTask(FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_ExecuteJavaScript, js_code, script_url, start_line,
|
||||
&CefBrowserImpl::UIT_ExecuteJavaScript, jsCode, scriptUrl, startLine,
|
||||
targetFrame));
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
||||
// or cancel the window creation.
|
||||
CefHandler::RetVal rv =
|
||||
handler->HandleBeforeCreated(NULL, windowInfo, popup, handler, newUrl);
|
||||
if(rv == CefHandler::RV_HANDLED)
|
||||
if(rv == RV_HANDLED)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(const std::wstri
|
||||
// or cancel the window creation.
|
||||
CefHandler::RetVal rv =
|
||||
handler_->HandleBeforeCreated(this, info, true, handler, newUrl);
|
||||
if(rv == CefHandler::RV_HANDLED)
|
||||
if(rv == RV_HANDLED)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -465,43 +465,43 @@ void CefBrowserImpl::UIT_HandleAction(CefHandler::MenuId menuId,
|
||||
|
||||
switch(menuId)
|
||||
{
|
||||
case CefHandler::ID_NAV_BACK:
|
||||
case MENU_ID_NAV_BACK:
|
||||
UIT_GoBackOrForward(-1);
|
||||
break;
|
||||
case CefHandler::ID_NAV_FORWARD:
|
||||
case MENU_ID_NAV_FORWARD:
|
||||
UIT_GoBackOrForward(1);
|
||||
break;
|
||||
case CefHandler::ID_NAV_RELOAD:
|
||||
case MENU_ID_NAV_RELOAD:
|
||||
UIT_Reload();
|
||||
break;
|
||||
case CefHandler::ID_NAV_STOP:
|
||||
case MENU_ID_NAV_STOP:
|
||||
UIT_GetWebView()->StopLoading();
|
||||
break;
|
||||
case CefHandler::ID_UNDO:
|
||||
case MENU_ID_UNDO:
|
||||
frame->Undo();
|
||||
break;
|
||||
case CefHandler::ID_REDO:
|
||||
case MENU_ID_REDO:
|
||||
frame->Redo();
|
||||
break;
|
||||
case CefHandler::ID_CUT:
|
||||
case MENU_ID_CUT:
|
||||
frame->Cut();
|
||||
break;
|
||||
case CefHandler::ID_COPY:
|
||||
case MENU_ID_COPY:
|
||||
frame->Copy();
|
||||
break;
|
||||
case CefHandler::ID_PASTE:
|
||||
case MENU_ID_PASTE:
|
||||
frame->Paste();
|
||||
break;
|
||||
case CefHandler::ID_DELETE:
|
||||
case MENU_ID_DELETE:
|
||||
frame->Delete();
|
||||
break;
|
||||
case CefHandler::ID_SELECTALL:
|
||||
case MENU_ID_SELECTALL:
|
||||
frame->SelectAll();
|
||||
break;
|
||||
case CefHandler::ID_PRINT:
|
||||
case MENU_ID_PRINT:
|
||||
UIT_PrintPages(frame);
|
||||
break;
|
||||
case CefHandler::ID_VIEWSOURCE:
|
||||
case MENU_ID_VIEWSOURCE:
|
||||
UIT_ViewDocumentString(frame);
|
||||
break;
|
||||
}
|
||||
|
@@ -58,9 +58,9 @@ public:
|
||||
const std::wstring& url);
|
||||
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
const std::wstring& url);
|
||||
virtual void ExecuteJavaScript(const std::wstring& js_code,
|
||||
const std::wstring& script_url,
|
||||
int start_line, TargetFrame targetFrame);
|
||||
virtual void ExecuteJavaScript(const std::wstring& jsCode,
|
||||
const std::wstring& scriptUrl,
|
||||
int startLine, TargetFrame targetFrame);
|
||||
virtual bool AddJSHandler(const std::wstring& classname,
|
||||
CefRefPtr<CefJSHandler> handler);
|
||||
virtual bool HasJSHandler(const std::wstring& classname);
|
||||
|
@@ -261,7 +261,7 @@ void CefBrowserImpl::UIT_CreateBrowser()
|
||||
|
||||
// Create the new browser window
|
||||
window_info_.m_hWnd = CreateWindowEx(window_info_.m_dwExStyle, GetWndClass(),
|
||||
window_info_.m_windowName.c_str(), window_info_.m_dwStyle,
|
||||
window_info_.m_windowName, window_info_.m_dwStyle,
|
||||
window_info_.m_x, window_info_.m_y, window_info_.m_nWidth,
|
||||
window_info_.m_nHeight, window_info_.m_hWndParent, window_info_.m_hMenu,
|
||||
_Context->GetInstanceHandle(), NULL);
|
||||
@@ -654,7 +654,7 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, WebFrame* frame,
|
||||
url, title, page_number, total_pages, topLeft, topCenter, topRight,
|
||||
bottomLeft, bottomCenter, bottomRight);
|
||||
|
||||
if(rv != CefHandler::RV_HANDLED) {
|
||||
if(rv != RV_HANDLED) {
|
||||
// Draw handler-defined headers and/or footers.
|
||||
LOGFONT lf;
|
||||
memset(&lf, 0, sizeof(lf));
|
||||
|
@@ -231,7 +231,7 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
|
||||
CefHandler::RetVal rv = handler->HandleBeforeResourceLoad(
|
||||
browser_, request, redirectUrl, resourceStream, mimeType, loadFlags);
|
||||
if(rv == CefHandler::RV_HANDLED) {
|
||||
if(rv == RV_HANDLED) {
|
||||
// cancel the resource load
|
||||
handled = true;
|
||||
OnCompletedRequest(URLRequestStatus(URLRequestStatus::CANCELED, 0));
|
||||
|
@@ -139,7 +139,7 @@ WindowOpenDisposition BrowserWebViewDelegate::DispositionForNavigationAction(
|
||||
// Notify the handler of a browse request
|
||||
CefHandler::RetVal rv = handler->HandleBeforeBrowse(browser_, req,
|
||||
(CefHandler::NavType)type, is_redirect);
|
||||
if(rv == CefHandler::RV_HANDLED)
|
||||
if(rv == RV_HANDLED)
|
||||
return IGNORE_ACTION;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
||||
CefHandler::RetVal rv = handler->HandleLoadError(browser_,
|
||||
static_cast<CefHandler::ErrorCode>(error.GetErrorCode()),
|
||||
UTF8ToWide(error.GetFailedURL().spec()), error_str);
|
||||
if(rv == CefHandler::RV_HANDLED && !error_str.empty())
|
||||
if(rv == RV_HANDLED && !error_str.empty())
|
||||
error_text = WideToUTF8(error_str);
|
||||
} else {
|
||||
error_text = StringPrintf("Error loading url: %d", error.GetErrorCode());
|
||||
@@ -313,22 +313,22 @@ void BrowserWebViewDelegate::AddMessageToConsole(WebView* webview,
|
||||
|
||||
void BrowserWebViewDelegate::RunJavaScriptAlert(WebView* webview,
|
||||
const std::wstring& message) {
|
||||
CefHandler::RetVal rv = CefHandler::RV_CONTINUE;
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get())
|
||||
rv = handler->HandleJSAlert(browser_, message);
|
||||
if(rv != CefHandler::RV_HANDLED)
|
||||
if(rv != RV_HANDLED)
|
||||
ShowJavaScriptAlert(webview, message);
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebView* webview,
|
||||
const std::wstring& message) {
|
||||
CefHandler::RetVal rv = CefHandler::RV_CONTINUE;
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
bool retval = false;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get())
|
||||
rv = handler->HandleJSConfirm(browser_, message, retval);
|
||||
if(rv != CefHandler::RV_HANDLED)
|
||||
if(rv != RV_HANDLED)
|
||||
retval = ShowJavaScriptConfirm(webview, message);
|
||||
return retval;
|
||||
}
|
||||
@@ -336,14 +336,14 @@ bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebView* webview,
|
||||
bool BrowserWebViewDelegate::RunJavaScriptPrompt(WebView* webview,
|
||||
const std::wstring& message, const std::wstring& default_value,
|
||||
std::wstring* result) {
|
||||
CefHandler::RetVal rv = CefHandler::RV_CONTINUE;
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
bool retval = false;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
rv = handler->HandleJSPrompt(browser_, message, default_value,
|
||||
retval, *result);
|
||||
}
|
||||
if(rv != CefHandler::RV_HANDLED)
|
||||
if(rv != RV_HANDLED)
|
||||
retval = ShowJavaScriptPrompt(webview, message, default_value, result);
|
||||
return retval;
|
||||
}
|
||||
|
@@ -250,65 +250,73 @@ void BrowserWebViewDelegate::ShowContextMenu(WebView* webview,
|
||||
MessageLoop::current()->SetNestableTasksAllowed(true);
|
||||
|
||||
if(browser_->UIT_CanGoBack())
|
||||
edit_flags |= CefHandler::CAN_GO_BACK;
|
||||
edit_flags |= MENU_CAN_GO_BACK;
|
||||
if(browser_->UIT_CanGoForward())
|
||||
edit_flags |= CefHandler::CAN_GO_FORWARD;
|
||||
edit_flags |= MENU_CAN_GO_FORWARD;
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Gather menu information
|
||||
CefHandler::MenuInfo menuInfo;
|
||||
std::wstring linkstr, imagestr, pagestr, framestr, securitystr;
|
||||
|
||||
linkstr = UTF8ToWide(link_url.spec().c_str());
|
||||
imagestr = UTF8ToWide(image_url.spec().c_str());
|
||||
pagestr = UTF8ToWide(page_url.spec().c_str());
|
||||
framestr = UTF8ToWide(frame_url.spec().c_str());
|
||||
securitystr = UTF8ToWide(security_info);
|
||||
|
||||
menuInfo.typeFlags = in_node.type;
|
||||
menuInfo.x = screen_pt.x;
|
||||
menuInfo.y = screen_pt.y;
|
||||
menuInfo.linkUrl = UTF8ToWide(link_url.spec().c_str()).c_str();
|
||||
menuInfo.imageUrl = UTF8ToWide(image_url.spec().c_str()).c_str();
|
||||
menuInfo.pageUrl = UTF8ToWide(page_url.spec().c_str()).c_str();
|
||||
menuInfo.frameUrl = UTF8ToWide(frame_url.spec().c_str()).c_str();
|
||||
menuInfo.selectionText = selection_text;
|
||||
menuInfo.misspelledWord = misspelled_word;
|
||||
menuInfo.linkUrl = linkstr.c_str();
|
||||
menuInfo.imageUrl = imagestr.c_str();
|
||||
menuInfo.pageUrl = pagestr.c_str();
|
||||
menuInfo.frameUrl = framestr.c_str();
|
||||
menuInfo.selectionText = selection_text.c_str();
|
||||
menuInfo.misspelledWord = misspelled_word.c_str();
|
||||
menuInfo.editFlags = edit_flags;
|
||||
menuInfo.securityInfo = security_info;
|
||||
menuInfo.securityInfo = securitystr.c_str();
|
||||
|
||||
// Notify the handler that a context menu is requested
|
||||
CefHandler::RetVal rv = handler->HandleBeforeMenu(browser_, menuInfo);
|
||||
if(rv == CefHandler::RV_HANDLED)
|
||||
if(rv == RV_HANDLED)
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Build the correct default context menu
|
||||
if (in_node.type & ContextNode::EDITABLE) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_UNDO, L"Undo",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_UNDO, L"Undo",
|
||||
!!(edit_flags & ContextNode::CAN_UNDO), label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_REDO, L"Redo",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_REDO, L"Redo",
|
||||
!!(edit_flags & ContextNode::CAN_REDO), label_list);
|
||||
AddMenuSeparator(menu, -1);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_CUT, L"Cut",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_CUT, L"Cut",
|
||||
!!(edit_flags & ContextNode::CAN_CUT), label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_COPY, L"Copy",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
|
||||
!!(edit_flags & ContextNode::CAN_COPY), label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_PASTE, L"Paste",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_PASTE, L"Paste",
|
||||
!!(edit_flags & ContextNode::CAN_PASTE), label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_DELETE, L"Delete",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_DELETE, L"Delete",
|
||||
!!(edit_flags & ContextNode::CAN_DELETE), label_list);
|
||||
AddMenuSeparator(menu, -1);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_SELECTALL, L"Select All",
|
||||
!!(edit_flags & ContextNode::CAN_SELECT_ALL), label_list);
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_SELECTALL, L"Select All",
|
||||
!!(edit_flags & MENU_CAN_SELECT_ALL), label_list);
|
||||
} else if(in_node.type & ContextNode::SELECTION) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_COPY, L"Copy",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_COPY, L"Copy",
|
||||
!!(edit_flags & ContextNode::CAN_COPY), label_list);
|
||||
} else if(in_node.type & (ContextNode::PAGE | ContextNode::FRAME)) {
|
||||
menu = CreatePopupMenu();
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_NAV_BACK, L"Back",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_NAV_BACK, L"Back",
|
||||
browser_->UIT_CanGoBack(), label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_NAV_FORWARD, L"Forward",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_NAV_FORWARD, L"Forward",
|
||||
browser_->UIT_CanGoForward(), label_list);
|
||||
AddMenuSeparator(menu, -1);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_PRINT, L"Print",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_PRINT, L"Print",
|
||||
true, label_list);
|
||||
AddMenuItem(browser_, menu, -1, CefHandler::ID_VIEWSOURCE, L"View Source",
|
||||
AddMenuItem(browser_, menu, -1, MENU_ID_VIEWSOURCE, L"View Source",
|
||||
true, label_list);
|
||||
}
|
||||
|
||||
@@ -325,12 +333,12 @@ void BrowserWebViewDelegate::ShowContextMenu(WebView* webview,
|
||||
if(handler.get()) {
|
||||
// Ask the handler if it wants to handle the action
|
||||
CefHandler::RetVal rv = handler->HandleMenuAction(browser_, menuId);
|
||||
handled = (rv == CefHandler::RV_HANDLED);
|
||||
handled = (rv == RV_HANDLED);
|
||||
}
|
||||
|
||||
if(!handled) {
|
||||
// Execute the action
|
||||
browser_->UIT_HandleAction(menuId, CefBrowser::TF_FOCUSED);
|
||||
browser_->UIT_HandleAction(menuId, TF_FOCUSED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\lib\libcef_static.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@@ -104,6 +105,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\lib\libcef_static.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
@@ -184,6 +186,10 @@
|
||||
RelativePath="..\include\cef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cef_export.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cef_nplugin.h"
|
||||
>
|
||||
@@ -192,6 +198,14 @@
|
||||
RelativePath="..\include\cef_ptr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cef_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cef_types_win.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\include\cef_win.h"
|
||||
>
|
||||
|
@@ -47,10 +47,10 @@ std::wstring CefRequestImpl::GetFrame()
|
||||
return frame;
|
||||
}
|
||||
|
||||
void CefRequestImpl::SetFrame(const std::wstring& url)
|
||||
void CefRequestImpl::SetFrame(const std::wstring& frame)
|
||||
{
|
||||
Lock();
|
||||
frame_ = url;
|
||||
frame_ = frame;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ CefRefPtr<CefPostDataElement> CefPostDataElement::CreatePostDataElement()
|
||||
|
||||
CefPostDataElementImpl::CefPostDataElementImpl()
|
||||
{
|
||||
type_ = TYPE_EMPTY;
|
||||
type_ = PDE_TYPE_EMPTY;
|
||||
}
|
||||
|
||||
CefPostDataElementImpl::~CefPostDataElementImpl()
|
||||
@@ -269,11 +269,11 @@ CefPostDataElementImpl::~CefPostDataElementImpl()
|
||||
void CefPostDataElementImpl::SetToEmpty()
|
||||
{
|
||||
Lock();
|
||||
if(type_ == TYPE_BYTES)
|
||||
if(type_ == PDE_TYPE_BYTES)
|
||||
free(data_.bytes.bytes);
|
||||
else if(type_ == TYPE_FILE)
|
||||
else if(type_ == PDE_TYPE_FILE)
|
||||
free(data_.filename);
|
||||
type_ = TYPE_EMPTY;
|
||||
type_ = PDE_TYPE_EMPTY;
|
||||
Unlock();
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ void CefPostDataElementImpl::SetToFile(const std::wstring& fileName)
|
||||
data[size] = 0;
|
||||
|
||||
// Assign the new data
|
||||
type_ = TYPE_FILE;
|
||||
type_ = PDE_TYPE_FILE;
|
||||
data_.filename = data;
|
||||
Unlock();
|
||||
}
|
||||
@@ -314,7 +314,7 @@ void CefPostDataElementImpl::SetToBytes(size_t size, const void* bytes)
|
||||
|
||||
memcpy(data, bytes, size);
|
||||
|
||||
type_ = TYPE_BYTES;
|
||||
type_ = PDE_TYPE_BYTES;
|
||||
data_.bytes.bytes = data;
|
||||
data_.bytes.size = size;
|
||||
Unlock();
|
||||
@@ -331,9 +331,9 @@ CefPostDataElement::Type CefPostDataElementImpl::GetType()
|
||||
std::wstring CefPostDataElementImpl::GetFile()
|
||||
{
|
||||
Lock();
|
||||
DCHECK(type_ == TYPE_FILE);
|
||||
DCHECK(type_ == PDE_TYPE_FILE);
|
||||
std::wstring filename;
|
||||
if(type_ == TYPE_FILE)
|
||||
if(type_ == PDE_TYPE_FILE)
|
||||
filename = data_.filename;
|
||||
Unlock();
|
||||
return filename;
|
||||
@@ -342,9 +342,9 @@ std::wstring CefPostDataElementImpl::GetFile()
|
||||
size_t CefPostDataElementImpl::GetBytesCount()
|
||||
{
|
||||
Lock();
|
||||
DCHECK(type_ == TYPE_BYTES);
|
||||
DCHECK(type_ == PDE_TYPE_BYTES);
|
||||
size_t size = 0;
|
||||
if(type_ == TYPE_BYTES)
|
||||
if(type_ == PDE_TYPE_BYTES)
|
||||
size = data_.bytes.size;
|
||||
Unlock();
|
||||
return size;
|
||||
@@ -353,9 +353,9 @@ size_t CefPostDataElementImpl::GetBytesCount()
|
||||
size_t CefPostDataElementImpl::GetBytes(size_t size, void *bytes)
|
||||
{
|
||||
Lock();
|
||||
DCHECK(type_ == TYPE_BYTES);
|
||||
DCHECK(type_ == PDE_TYPE_BYTES);
|
||||
size_t rv = 0;
|
||||
if(type_ == TYPE_BYTES) {
|
||||
if(type_ == PDE_TYPE_BYTES) {
|
||||
rv = (size < data_.bytes.size ? size : data_.bytes.size);
|
||||
memcpy(bytes, data_.bytes.bytes, rv);
|
||||
}
|
||||
@@ -385,9 +385,9 @@ void CefPostDataElementImpl::Get(net::UploadData::Element& element)
|
||||
{
|
||||
Lock();
|
||||
|
||||
if(type_ == TYPE_BYTES) {
|
||||
if(type_ == PDE_TYPE_BYTES) {
|
||||
element.SetToBytes(static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||
} else if(type_ == TYPE_FILE) {
|
||||
} else if(type_ == PDE_TYPE_FILE) {
|
||||
element.SetToFilePath(data_.filename);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
|
@@ -20,7 +20,7 @@ public:
|
||||
virtual std::wstring GetURL();
|
||||
virtual void SetURL(const std::wstring& url);
|
||||
virtual std::wstring GetFrame();
|
||||
virtual void SetFrame(const std::wstring& url);
|
||||
virtual void SetFrame(const std::wstring& frame);
|
||||
virtual std::wstring GetMethod();
|
||||
virtual void SetMethod(const std::wstring& method);
|
||||
virtual CefRefPtr<CefPostData> GetPostData();
|
||||
|
@@ -62,23 +62,23 @@ CefVariantImpl::~CefVariantImpl()
|
||||
|
||||
CefVariant::Type CefVariantImpl::GetType()
|
||||
{
|
||||
CefVariant::Type type = TYPE_NULL;
|
||||
CefVariant::Type type = VARIANT_TYPE_NULL;
|
||||
|
||||
Lock();
|
||||
|
||||
// determine the data type of the underlying NPVariant value
|
||||
switch (variant_.type) {
|
||||
case NPVariantType_Bool:
|
||||
type = TYPE_BOOL;
|
||||
type = VARIANT_TYPE_BOOL;
|
||||
break;
|
||||
case NPVariantType_Int32:
|
||||
type = TYPE_INT;
|
||||
type = VARIANT_TYPE_INT;
|
||||
break;
|
||||
case NPVariantType_Double:
|
||||
type = TYPE_DOUBLE;
|
||||
type = VARIANT_TYPE_DOUBLE;
|
||||
break;
|
||||
case NPVariantType_String:
|
||||
type = TYPE_STRING;
|
||||
type = VARIANT_TYPE_STRING;
|
||||
break;
|
||||
case NPVariantType_Object:
|
||||
{
|
||||
@@ -87,16 +87,16 @@ CefVariant::Type CefVariantImpl::GetType()
|
||||
if(_NPN_ArrayObjectToVectorTypeHint(variant_.value.objectValue, nptype)) {
|
||||
switch(nptype) {
|
||||
case NPVariantType_Bool:
|
||||
type = TYPE_BOOL_ARRAY;
|
||||
type = VARIANT_TYPE_BOOL_ARRAY;
|
||||
break;
|
||||
case NPVariantType_Int32:
|
||||
type = TYPE_INT_ARRAY;
|
||||
type = VARIANT_TYPE_INT_ARRAY;
|
||||
break;
|
||||
case NPVariantType_Double:
|
||||
type = TYPE_DOUBLE_ARRAY;
|
||||
type = VARIANT_TYPE_DOUBLE_ARRAY;
|
||||
break;
|
||||
case NPVariantType_String:
|
||||
type = TYPE_STRING_ARRAY;
|
||||
type = VARIANT_TYPE_STRING_ARRAY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -289,6 +289,15 @@ bool CefVariantImpl::GetStringArray(std::vector<std::wstring>& val)
|
||||
return rv;
|
||||
}
|
||||
|
||||
int CefVariantImpl::GetArraySize()
|
||||
{
|
||||
Lock();
|
||||
DCHECK(variant_.type == NPVariantType_Object);
|
||||
int rv = _NPN_ArrayObjectGetVectorSize(variant_.value.objectValue);
|
||||
Unlock();
|
||||
return rv;
|
||||
}
|
||||
|
||||
void CefVariantImpl::CopyToNPVariant(NPVariant* result)
|
||||
{
|
||||
Lock();
|
||||
@@ -358,4 +367,4 @@ void CefVariantImpl::Set(const NPVariant& val)
|
||||
break;
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ public:
|
||||
virtual bool GetIntArray(std::vector<int>& val);
|
||||
virtual bool GetDoubleArray(std::vector<double>& val);
|
||||
virtual bool GetStringArray(std::vector<std::wstring>& val);
|
||||
virtual int GetArraySize();
|
||||
|
||||
// These three methods all perform deep copies of any string data. This
|
||||
// allows the local CefVariantImpl to be released by the destructor without
|
||||
|
@@ -176,6 +176,19 @@ bool _NPN_ArrayObjectToBooleanVector(NPObject* npobject,
|
||||
return true;
|
||||
}
|
||||
|
||||
int _NPN_ArrayObjectGetVectorSize(NPObject* npobject)
|
||||
{
|
||||
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
|
||||
return -1;
|
||||
|
||||
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
|
||||
if (!object->v8_object->IsArray())
|
||||
return -1;
|
||||
|
||||
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(object->v8_object);
|
||||
return array->Length();
|
||||
}
|
||||
|
||||
bool _NPN_ArrayObjectToVectorTypeHint(NPObject* npobject,
|
||||
NPVariantType &typehint)
|
||||
{
|
||||
|
@@ -44,6 +44,10 @@ bool _NPN_ArrayObjectToDoubleVector(NPObject* npobject,
|
||||
bool _NPN_ArrayObjectToBooleanVector(NPObject* npobject,
|
||||
std::vector<bool>& vec);
|
||||
|
||||
// Return the number of elements in a JavaScript Array. Returns -1 if the
|
||||
// JavaScript object does not represent an array.
|
||||
int _NPN_ArrayObjectGetVectorSize(NPObject* npobject);
|
||||
|
||||
// Evaluate the types of values contained in an NPObject representing a
|
||||
// JavaScript Array and suggest the most restrictive type that can safely store
|
||||
// all of the Array values. For instance, if the Array contains all Int32
|
||||
|
Reference in New Issue
Block a user