cef/libcef_dll/cpptoc/frame_cpptoc.cc

275 lines
6.3 KiB
C++
Raw Normal View History

// Copyright (c) 2010 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.
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
#include "libcef_dll/ctocpp/domvisitor_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK frame_undo(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Undo();
}
void CEF_CALLBACK frame_redo(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Redo();
}
void CEF_CALLBACK frame_cut(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Cut();
}
void CEF_CALLBACK frame_copy(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Copy();
}
void CEF_CALLBACK frame_paste(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Paste();
}
void CEF_CALLBACK frame_del(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Delete();
}
void CEF_CALLBACK frame_select_all(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->SelectAll();
}
void CEF_CALLBACK frame_print(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->Print();
}
void CEF_CALLBACK frame_view_source(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->ViewSource();
}
cef_string_userfree_t CEF_CALLBACK frame_get_source(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString sourceStr = CefFrameCppToC::Get(self)->GetSource();
return sourceStr.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK frame_get_text(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString textStr = CefFrameCppToC::Get(self)->GetText();
return textStr.DetachToUserFree();
}
void CEF_CALLBACK frame_load_request(struct _cef_frame_t* self,
struct _cef_request_t* request)
{
DCHECK(self);
DCHECK(request);
if(!self || !request)
return;
CefRefPtr<CefRequest> requestPtr = CefRequestCppToC::Unwrap(request);
CefFrameCppToC::Get(self)->LoadRequest(requestPtr);
}
void CEF_CALLBACK frame_load_url(struct _cef_frame_t* self,
const cef_string_t* url)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->LoadURL(CefString(url));
}
void CEF_CALLBACK frame_load_string(struct _cef_frame_t* self,
const cef_string_t* string, const cef_string_t* url)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->LoadString(CefString(string), CefString(url));
}
void CEF_CALLBACK frame_load_stream(struct _cef_frame_t* self,
struct _cef_stream_reader_t* stream, const cef_string_t* url)
{
DCHECK(self);
DCHECK(stream);
if(!self || !stream)
return;
CefFrameCppToC::Get(self)->LoadStream(CefStreamReaderCppToC::Unwrap(stream),
CefString(url));
}
void CEF_CALLBACK frame_execute_java_script(struct _cef_frame_t* self,
const cef_string_t* jsCode, const cef_string_t* scriptUrl, int startLine)
{
DCHECK(self);
if(!self)
return;
CefFrameCppToC::Get(self)->ExecuteJavaScript(CefString(jsCode),
CefString(scriptUrl), startLine);
}
int CEF_CALLBACK frame_is_main(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefFrameCppToC::Get(self)->IsMain();
}
int CEF_CALLBACK frame_is_focused(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return 0;
return CefFrameCppToC::Get(self)->IsFocused();
}
cef_string_userfree_t CEF_CALLBACK frame_get_name(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return 0;
CefString nameStr = CefFrameCppToC::Get(self)->GetName();
return nameStr.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK frame_get_url(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString urlStr = CefFrameCppToC::Get(self)->GetURL();
return urlStr.DetachToUserFree();
}
cef_browser_t* CEF_CALLBACK frame_get_browser(struct _cef_frame_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefRefPtr<CefBrowser> browserPtr =
CefFrameCppToC::Get(self)->GetBrowser();
if(browserPtr.get())
return CefBrowserCppToC::Wrap(browserPtr);
return NULL;
}
void CEF_CALLBACK frame_visit_dom(struct _cef_frame_t* self,
struct _cef_domvisitor_t* visitor)
{
DCHECK(self);
DCHECK(visitor);
if(!self || !visitor)
return;
CefFrameCppToC::Get(self)->VisitDOM(CefDOMVisitorCToCpp::Wrap(visitor));
}
// CONSTRUCTOR - Do not edit by hand.
CefFrameCppToC::CefFrameCppToC(CefFrame* cls)
: CefCppToC<CefFrameCppToC, CefFrame, cef_frame_t>(cls)
{
struct_.struct_.undo = frame_undo;
struct_.struct_.redo = frame_redo;
struct_.struct_.cut = frame_cut;
struct_.struct_.copy = frame_copy;
struct_.struct_.paste = frame_paste;
struct_.struct_.del = frame_del;
struct_.struct_.select_all = frame_select_all;
struct_.struct_.print = frame_print;
struct_.struct_.view_source = frame_view_source;
struct_.struct_.get_source = frame_get_source;
struct_.struct_.get_text = frame_get_text;
struct_.struct_.load_request = frame_load_request;
struct_.struct_.load_url = frame_load_url;
struct_.struct_.load_string = frame_load_string;
struct_.struct_.load_stream = frame_load_stream;
struct_.struct_.execute_java_script = frame_execute_java_script;
struct_.struct_.is_main = frame_is_main;
struct_.struct_.is_focused = frame_is_focused;
struct_.struct_.get_name = frame_get_name;
struct_.struct_.get_url = frame_get_url;
struct_.struct_.get_browser = frame_get_browser;
struct_.struct_.visit_dom = frame_visit_dom;
}
#ifdef _DEBUG
template<> long CefCppToC<CefFrameCppToC, CefFrame, cef_frame_t>::DebugObjCt =
0;
#endif