2009-06-21 00:09:28 +02:00
|
|
|
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
//
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// A portion of this file was generated by the CEF translator tool. When
|
|
|
|
// making changes by hand only do so within the body of existing function
|
|
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
|
|
// for more information.
|
|
|
|
//
|
|
|
|
|
2009-10-02 19:59:38 +02:00
|
|
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
|
|
|
#include "libcef_dll/ctocpp/handler_ctocpp.h"
|
2009-03-05 02:10:06 +01:00
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
|
|
|
|
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
|
|
|
|
|
|
|
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
|
|
|
struct _cef_handler_t* handler, const wchar_t* url)
|
|
|
|
{
|
|
|
|
DCHECK(windowInfo);
|
|
|
|
|
|
|
|
CefRefPtr<CefHandler> handlerPtr;
|
|
|
|
std::wstring urlStr;
|
|
|
|
CefWindowInfo wi = *windowInfo;
|
|
|
|
|
|
|
|
if(handler)
|
|
|
|
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
|
|
|
if(url)
|
|
|
|
urlStr = url;
|
|
|
|
|
2009-10-02 19:59:38 +02:00
|
|
|
return CefBrowser::CreateBrowser(wi, popup?true:false, handlerPtr, urlStr);
|
2009-06-21 00:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
|
|
|
int popup, struct _cef_handler_t* handler, const wchar_t* url)
|
|
|
|
{
|
|
|
|
DCHECK(windowInfo);
|
|
|
|
|
|
|
|
CefRefPtr<CefHandler> handlerPtr;
|
|
|
|
std::wstring urlStr;
|
|
|
|
CefWindowInfo wi = *windowInfo;
|
|
|
|
|
|
|
|
if(handler)
|
|
|
|
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
|
|
|
if(url)
|
|
|
|
urlStr = url;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr(
|
2009-10-02 19:59:38 +02:00
|
|
|
CefBrowser::CreateBrowserSync(wi, popup?true:false, handlerPtr, urlStr));
|
2009-06-21 00:09:28 +02:00
|
|
|
if(browserPtr.get())
|
|
|
|
return CefBrowserCppToC::Wrap(browserPtr);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
|
|
|
|
int CEF_CALLBACK browser_can_go_back(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return CefBrowserCppToC::Get(self)->CanGoBack();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK browser_go_back(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->GoBack();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
int CEF_CALLBACK browser_can_go_forward(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return CefBrowserCppToC::Get(self)->CanGoForward();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK browser_go_forward(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->GoForward();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK browser_reload(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->Reload();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2010-09-23 18:05:10 +02:00
|
|
|
void CEF_CALLBACK browser_reload_ignore_cache(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->ReloadIgnoreCache();
|
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK browser_stop_load(struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->StopLoad();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK browser_set_focus(struct _cef_browser_t* self, int enable)
|
2009-03-08 03:26:16 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->SetFocus(enable ? true : false);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
cef_window_handle_t CEF_CALLBACK browser_get_window_handle(
|
|
|
|
struct _cef_browser_t* self)
|
2009-05-28 02:31:21 +02:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return CefBrowserCppToC::Get(self)->GetWindowHandle();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
int CEF_CALLBACK browser_is_popup(struct _cef_browser_t* self)
|
2009-05-28 02:31:21 +02:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return CefBrowserCppToC::Get(self)->IsPopup();
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
struct _cef_handler_t* CEF_CALLBACK browser_get_handler(
|
|
|
|
struct _cef_browser_t* self)
|
2009-05-28 02:31:21 +02:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
2009-05-28 02:31:21 +02:00
|
|
|
CefRefPtr<CefHandler> handlerPtr = browserPtr->GetHandler();
|
|
|
|
if(handlerPtr.get())
|
|
|
|
return CefHandlerCToCpp::Unwrap(handlerPtr);
|
2009-03-05 02:10:06 +01:00
|
|
|
|
2009-05-28 02:31:21 +02:00
|
|
|
return NULL;
|
2009-06-21 00:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct _cef_frame_t* CEF_CALLBACK browser_get_main_frame(
|
|
|
|
struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
2009-05-28 02:31:21 +02:00
|
|
|
CefRefPtr<CefFrame> framePtr = browserPtr->GetMainFrame();
|
|
|
|
if(framePtr.get())
|
|
|
|
return CefFrameCppToC::Wrap(framePtr);
|
2009-06-21 00:09:28 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct _cef_frame_t* CEF_CALLBACK browser_get_focused_frame(
|
|
|
|
struct _cef_browser_t* self)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
2009-05-28 02:31:21 +02:00
|
|
|
CefRefPtr<CefFrame> framePtr = browserPtr->GetFocusedFrame();
|
|
|
|
if(framePtr.get())
|
|
|
|
return CefFrameCppToC::Wrap(framePtr);
|
2009-06-21 00:09:28 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct _cef_frame_t* CEF_CALLBACK browser_get_frame(struct _cef_browser_t* self,
|
|
|
|
const wchar_t* name)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
std::wstring nameStr;
|
|
|
|
if(name)
|
|
|
|
nameStr = name;
|
|
|
|
if(nameStr.empty())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
2009-05-28 02:31:21 +02:00
|
|
|
CefRefPtr<CefFrame> framePtr = browserPtr->GetFrame(nameStr);
|
|
|
|
if(framePtr.get())
|
|
|
|
return CefFrameCppToC::Wrap(framePtr);
|
2009-06-21 00:09:28 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self,
|
|
|
|
cef_string_list_t names)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
DCHECK(names);
|
|
|
|
if(!self || !names)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
|
|
|
std::vector<std::wstring> stringList;
|
|
|
|
browserPtr->GetFrameNames(stringList);
|
|
|
|
size_t size = stringList.size();
|
|
|
|
for(size_t i = 0; i < size; ++i)
|
|
|
|
cef_string_list_append(names, stringList[i].c_str());
|
|
|
|
}
|
|
|
|
|
2010-07-20 00:19:30 +02:00
|
|
|
void CEF_CALLBACK browser_find(struct _cef_browser_t* self, int identifier,
|
|
|
|
const wchar_t* searchText, int forward, int matchCase, int findNext)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::wstring searchTextStr;
|
|
|
|
if(searchText)
|
|
|
|
searchTextStr = searchText;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->Find(identifier, searchTextStr,
|
|
|
|
forward?true:false, matchCase?true:false, findNext?true:false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CEF_CALLBACK browser_stop_finding(struct _cef_browser_t* self,
|
|
|
|
int clearSelection)
|
|
|
|
{
|
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CefBrowserCppToC::Get(self)->StopFinding(clearSelection?true:false);
|
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
|
|
|
|
CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls)
|
|
|
|
: CefCppToC<CefBrowserCppToC, CefBrowser, cef_browser_t>(cls)
|
|
|
|
{
|
2009-03-05 02:10:06 +01:00
|
|
|
struct_.struct_.can_go_back = browser_can_go_back;
|
|
|
|
struct_.struct_.go_back = browser_go_back;
|
|
|
|
struct_.struct_.can_go_forward = browser_can_go_forward;
|
|
|
|
struct_.struct_.go_forward = browser_go_forward;
|
|
|
|
struct_.struct_.reload = browser_reload;
|
2010-09-23 18:05:10 +02:00
|
|
|
struct_.struct_.reload_ignore_cache = browser_reload_ignore_cache;
|
2009-03-05 02:10:06 +01:00
|
|
|
struct_.struct_.stop_load = browser_stop_load;
|
2009-03-08 03:26:16 +01:00
|
|
|
struct_.struct_.set_focus = browser_set_focus;
|
2009-03-05 02:10:06 +01:00
|
|
|
struct_.struct_.get_window_handle = browser_get_window_handle;
|
|
|
|
struct_.struct_.is_popup = browser_is_popup;
|
2009-06-21 00:09:28 +02:00
|
|
|
struct_.struct_.get_handler = browser_get_handler;
|
|
|
|
struct_.struct_.get_main_frame = browser_get_main_frame;
|
|
|
|
struct_.struct_.get_focused_frame = browser_get_focused_frame;
|
|
|
|
struct_.struct_.get_frame = browser_get_frame;
|
|
|
|
struct_.struct_.get_frame_names = browser_get_frame_names;
|
2010-07-20 00:19:30 +02:00
|
|
|
struct_.struct_.find = browser_find;
|
|
|
|
struct_.struct_.stop_finding = browser_stop_finding;
|
2009-06-21 00:09:28 +02:00
|
|
|
}
|
|
|
|
|
2009-03-08 03:26:16 +01:00
|
|
|
#ifdef _DEBUG
|
2009-05-28 02:31:21 +02:00
|
|
|
long CefCppToC<CefBrowserCppToC, CefBrowser, cef_browser_t>::DebugObjCt = 0;
|
2009-03-08 03:26:16 +01:00
|
|
|
#endif
|
2009-06-21 00:09:28 +02:00
|
|
|
|