mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Move frame-related methods from CefBrowser into a new CefFrame class.
- Add CefBrowser::Get*Frame() methods for retrieving the appropriate CefFrame instance. - Add a CefFrame attribute to CefHandler callback methods where appropriate. - Add support for V8 JavaScript extensions and values via CefV8Value and CefV8Handler. Native C++ and user-defined JavaScript object hierarchies may now be created and accessed using the CEF API. - Remove the CefHandler and CefVariant classes and related CefBrowser methods that have been obsoleted by the addition of CEF V8 support. - Add the CefRegisterExtension() function for registering system-wide V8 extensions. - Add the CefHandler::HandleJSBinding() callback method for attaching V8 values to the global frame JavaScript object. This method replaces the previous technique of calling CefBrowser::AddJSHandler(). - Add new wrapper template methods for simplifying DLL wrapper implementations. - Move cef_string* files from libcef_dll to libcef so that projects can link libcef statically without errors. - Fix crashes when CEF exits due to object constructors being executed on non-UI threads if the application is closed while a page is still loading. - Update the cefclient project to reflect changes and demonstrate the new APIs. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@26 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
203
libcef_dll/ctocpp/frame_ctocpp.cc
Normal file
203
libcef_dll/ctocpp/frame_ctocpp.cc
Normal file
@@ -0,0 +1,203 @@
|
||||
// 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.
|
||||
|
||||
#include "../precompiled_libcef.h"
|
||||
#include "ctocpp/frame_ctocpp.h"
|
||||
#include "ctocpp/request_ctocpp.h"
|
||||
#include "ctocpp/stream_ctocpp.h"
|
||||
|
||||
|
||||
void CefFrameCToCpp::Undo()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, undo))
|
||||
return;
|
||||
|
||||
struct_->undo(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Redo()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, redo))
|
||||
return;
|
||||
|
||||
struct_->redo(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Cut()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, cut))
|
||||
return;
|
||||
|
||||
struct_->cut(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Copy()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, copy))
|
||||
return;
|
||||
|
||||
struct_->copy(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Paste()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, paste))
|
||||
return;
|
||||
|
||||
struct_->paste(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Delete()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, del))
|
||||
return;
|
||||
|
||||
struct_->del(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::SelectAll()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, select_all))
|
||||
return;
|
||||
|
||||
struct_->select_all(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::Print()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, print))
|
||||
return;
|
||||
|
||||
struct_->print(struct_);
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::ViewSource()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, view_source))
|
||||
return;
|
||||
|
||||
struct_->view_source(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetSource()
|
||||
{
|
||||
std::wstring str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_source))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_source(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetText()
|
||||
{
|
||||
std::wstring str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_text))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_text(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadRequest(CefRefPtr<CefRequest> request)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_request))
|
||||
return;
|
||||
|
||||
struct_->load_request(struct_, CefRequestCToCpp::Unwrap(request));
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadURL(const std::wstring& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_url))
|
||||
return;
|
||||
|
||||
struct_->load_url(struct_, url.c_str());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadString(const std::wstring& string,
|
||||
const std::wstring& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_string))
|
||||
return;
|
||||
|
||||
struct_->load_string(struct_, string.c_str(), url.c_str());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
const std::wstring& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_stream))
|
||||
return;
|
||||
|
||||
struct_->load_stream(struct_, CefStreamReaderCToCpp::Unwrap(stream),
|
||||
url.c_str());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::ExecuteJavaScript(const std::wstring& js_code,
|
||||
const std::wstring& script_url,
|
||||
int start_line)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, execute_javascript))
|
||||
return;
|
||||
|
||||
struct_->execute_javascript(struct_, js_code.c_str(), script_url.c_str(),
|
||||
start_line);
|
||||
}
|
||||
|
||||
bool CefFrameCToCpp::IsMain()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, is_main))
|
||||
return false;
|
||||
|
||||
return struct_->is_main(struct_);
|
||||
}
|
||||
|
||||
bool CefFrameCToCpp::IsFocused()
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, is_focused))
|
||||
return false;
|
||||
|
||||
return struct_->is_focused(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetName()
|
||||
{
|
||||
std::wstring str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetURL()
|
||||
{
|
||||
std::wstring str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_url))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_url(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
long CefCToCpp<CefFrameCToCpp, CefFrame, cef_frame_t>::DebugObjCt = 0;
|
||||
#endif
|
Reference in New Issue
Block a user