- Add the CefBrowser::CreateBrowserSync() method for synchronously creating a browser instance. (Issue #13, Suggested implementation by: vridosh)
- Add CefBrowser::SetFocus() and CefHandler::HandleTakeFocus() methods to deal with keyboard focus changes. (Issue #13, Suggested implementation by: vridosh)
- Add CefHandler::HandleBeforeWindowClose() to perform actions immediately before the browser window is destroyed. (Issue #13, Suggested implementation by: vridosh)
- Replace windows-specific address resolution code with GURL() in CefBrowserImpl::UIT_LoadURLForRequest(), CefBrowserImpl::UIT_LoadHTML() and CefBrowserImpl::UIT_LoadHTMLForStreamRef(), and move the methods from browser_impl_win.cc to browser_impl.cc. (Issue #13, Suggested implementation by: vridosh)
- Fix reference counting bugs, class definition problems and CefContext::Shutdown() bug resulting in Cef object leaks. (Issue #15)
- Add WebKit dependancy to libcef project.
- Add basic object count debugging for CefCToCpp and CefCppToC classes.

cefclient:
- Initialize the strPtr parameter to avoid URLs suffixed with garbage. (Issue #13, Fix by: vridosh)

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@19 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-03-08 02:26:16 +00:00
parent 3aa0d4c0fa
commit 08a19d5384
37 changed files with 628 additions and 195 deletions

View File

@ -115,6 +115,14 @@ void CefBrowserCToCpp::SelectAll(TargetFrame targetFrame)
struct_->select_all(struct_, targetFrame);
}
void CefBrowserCToCpp::SetFocus(bool enable)
{
if(CEF_MEMBER_MISSING(struct_, set_focus))
return;
struct_->set_focus(struct_, enable);
}
void CefBrowserCToCpp::Print(TargetFrame targetFrame)
{
if(CEF_MEMBER_MISSING(struct_, print))
@ -310,3 +318,7 @@ std::wstring CefBrowserCToCpp::GetURL()
}
return str;
}
#ifdef _DEBUG
long CefCToCpp<CefBrowser, cef_browser_t>::DebugObjCt = 0;
#endif

View File

@ -37,6 +37,7 @@ public:
virtual void Paste(TargetFrame targetFrame);
virtual void Delete(TargetFrame targetFrame);
virtual void SelectAll(TargetFrame targetFrame);
virtual void SetFocus(bool enable);
virtual void Print(TargetFrame targetFrame);
virtual void ViewSource(TargetFrame targetFrame);
virtual std::wstring GetSource(TargetFrame targetFrame);

View File

@ -19,9 +19,16 @@ public:
: struct_(str)
{
DCHECK(str);
#ifdef _DEBUG
CefAtomicIncrement(&DebugObjCt);
#endif
}
virtual ~CefCToCpp()
{
#ifdef _DEBUG
CefAtomicDecrement(&DebugObjCt);
#endif
}
// If returning the structure across the DLL boundary you should call
@ -55,6 +62,17 @@ public:
return 0;
return struct_->base.release(&struct_->base);
}
int UnderlyingGetRefCt()
{
if(!struct_->base.get_refct)
return 0;
return struct_->base.get_refct(&struct_->base);
}
#ifdef _DEBUG
// Simple tracking of allocated objects.
static long DebugObjCt;
#endif
protected:
StructName* struct_;

View File

@ -335,3 +335,31 @@ CefHandler::RetVal CefHandlerCToCpp::HandleJSPrompt(
return rv;
}
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeWindowClose(
CefRefPtr<CefBrowser> browser)
{
if(CEF_MEMBER_MISSING(struct_, handle_before_window_close))
return RV_CONTINUE;
CefBrowserCppToC* browserPtr = new CefBrowserCppToC(browser);
browserPtr->AddRef();
return struct_->handle_before_window_close(struct_, browserPtr->GetStruct());
}
CefHandler::RetVal CefHandlerCToCpp::HandleTakeFocus(
CefRefPtr<CefBrowser> browser, bool reverse)
{
if(CEF_MEMBER_MISSING(struct_, handle_take_focus))
return RV_CONTINUE;
CefBrowserCppToC* browserPtr = new CefBrowserCppToC(browser);
browserPtr->AddRef();
return struct_->handle_take_focus(struct_, browserPtr->GetStruct(), reverse);
}
#ifdef _DEBUG
long CefCToCpp<CefHandler, cef_handler_t>::DebugObjCt = 0;
#endif

View File

@ -74,6 +74,9 @@ public:
const std::wstring& default_value,
bool& retval,
std::wstring& result);
virtual RetVal HandleBeforeWindowClose(CefRefPtr<CefBrowser> browser);
virtual RetVal HandleTakeFocus(CefRefPtr<CefBrowser> browser,
bool reverse);
};

View File

@ -101,3 +101,7 @@ bool CefJSHandlerCToCpp::ExecuteMethod(CefRefPtr<CefBrowser> browser,
return rv;
}
#ifdef _DEBUG
long CefCToCpp<CefJSHandler, cef_jshandler_t>::DebugObjCt = 0;
#endif

View File

@ -168,6 +168,10 @@ void CefRequestCToCpp::Set(const std::wstring& url,
cef_string_map_free(map);
}
#ifdef _DEBUG
long CefCToCpp<CefRequest, cef_request_t>::DebugObjCt = 0;
#endif
size_t CefPostDataCToCpp::GetElementCount()
@ -231,6 +235,9 @@ void CefPostDataCToCpp::RemoveElements()
return struct_->remove_elements(struct_);
}
#ifdef _DEBUG
long CefCToCpp<CefPostData, cef_post_data_t>::DebugObjCt = 0;
#endif
void CefPostDataElementCToCpp::SetToEmpty()
@ -295,3 +302,7 @@ size_t CefPostDataElementCToCpp::GetBytes(size_t size, void *bytes)
return struct_->get_bytes(struct_, size, bytes);
}
#ifdef _DEBUG
long CefCToCpp<CefPostDataElement, cef_post_data_element_t>::DebugObjCt = 0;
#endif

View File

@ -39,6 +39,10 @@ int CefStreamReaderCToCpp::Eof()
return struct_->eof(struct_);
}
#ifdef _DEBUG
long CefCToCpp<CefStreamReader, cef_stream_reader_t>::DebugObjCt = 0;
#endif
size_t CefStreamWriterCToCpp::Write(const void *ptr, size_t size, size_t n)
{
@ -71,3 +75,7 @@ int CefStreamWriterCToCpp::Flush()
return struct_->flush(struct_);
}
#ifdef _DEBUG
long CefCToCpp<CefStreamWriter, cef_stream_writer_t>::DebugObjCt = 0;
#endif

View File

@ -295,3 +295,7 @@ int CefVariantCToCpp::GetArraySize()
return struct_->get_array_size(struct_);
}
#ifdef _DEBUG
long CefCToCpp<CefVariant, cef_variant_t>::DebugObjCt = 0;
#endif