- 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

@ -75,6 +75,9 @@ public:
// itself from memory. The resulting reference count value is returned and
// should be used for diagnostic/testing purposes only.
virtual int Release() =0;
// Return the current number of references.
virtual int GetRefCt() = 0;
};
@ -112,18 +115,18 @@ public:
{
m_dwRef = 0L;
}
~CefThreadSafeBase()
virtual ~CefThreadSafeBase()
{
}
// Atomic reference increment.
int AddRef()
virtual int AddRef()
{
return CefAtomicIncrement(&m_dwRef);
}
// Atomic reference decrement. Delete this object when no references remain.
int Release()
virtual int Release()
{
int retval = CefAtomicDecrement(&m_dwRef);
if(retval == 0)
@ -131,6 +134,9 @@ public:
return retval;
}
// Return the current number of references.
virtual int GetRefCt() { return m_dwRef; }
// Use the Lock() and Unlock() methods to protect a section of code from
// simultaneous access by multiple threads.
void Lock() { m_critsec.Lock(); }
@ -166,6 +172,15 @@ public:
CefRefPtr<CefHandler> handler,
const std::wstring& url);
// Create a new browser window using the window parameters specified
// by |windowInfo|. The |popup| parameter should be true if the new window is
// a popup window. This method call will block and can only be used if
// the |multi_threaded_message_loop| parameter to CefInitialize() is false.
static CefRefPtr<CefBrowser> CreateBrowserSync(CefWindowInfo& windowInfo,
bool popup,
CefRefPtr<CefHandler> handler,
const std::wstring& url);
// Returns true if the browser can navigate backwards.
virtual bool CanGoBack() =0;
// Navigate backwards.
@ -198,6 +213,10 @@ public:
// Execute select all in the target frame.
virtual void SelectAll(TargetFrame targetFrame) =0;
// Set focus for the browser window. If |enable| is true focus will be set
// to the window. Otherwise, focus will be removed.
virtual void SetFocus(bool enable) =0;
// Execute printing in the target frame. The user will be prompted with
// the print dialog appropriate to the operating system.
virtual void Print(TargetFrame targetFrame) =0;
@ -420,6 +439,15 @@ public:
bool& retval,
std::wstring& result) =0;
// Called just before a window is closed. The return value is currently
// ignored.
virtual RetVal HandleBeforeWindowClose(CefRefPtr<CefBrowser> browser) =0;
// Called when the browser component is about to loose focus. For instance,
// if focus was on the last HTML element and the user pressed the TAB key.
// The return value is currently ignored.
virtual RetVal HandleTakeFocus(CefRefPtr<CefBrowser> browser,
bool reverse) =0;
};

View File

@ -73,6 +73,8 @@ typedef struct _cef_base_t
// Decrement the reference count. Delete this object when no references
// remain.
int (CEF_CALLBACK *release)(struct _cef_base_t* base);
// Returns the current number of references.
int (CEF_CALLBACK *get_refct)(struct _cef_base_t* base);
} cef_base_t;
@ -125,6 +127,10 @@ typedef struct _cef_browser_t
void (CEF_CALLBACK *select_all)(struct _cef_browser_t* browser,
enum cef_targetframe_t targetFrame);
// Set focus for the browser window. If |enable| is true (1) focus will be
// set to the window. Otherwise, focus will be removed.
void (CEF_CALLBACK *set_focus)(struct _cef_browser_t* browser, int enable);
// Execute printing in the target frame. The user will be prompted with
// the print dialog appropriate to the operating system.
void (CEF_CALLBACK *print)(struct _cef_browser_t* browser,
@ -348,6 +354,17 @@ typedef struct _cef_handler_t
const wchar_t* message, const wchar_t* defaultValue, int* retval,
cef_string_t* result);
// Called just before a window is closed. The return value is currently
// ignored.
enum cef_retval_t (CEF_CALLBACK *handle_before_window_close)(
struct _cef_handler_t* handler, cef_browser_t* browser);
// Called when the browser component is about to loose focus. For instance,
// if focus was on the last HTML element and the user pressed the TAB key.
// The return value is currently ignored.
enum cef_retval_t (CEF_CALLBACK *handle_take_focus)(
struct _cef_handler_t* handler, cef_browser_t* browser, int reverse);
} cef_handler_t;
@ -599,6 +616,15 @@ typedef struct _cef_variant_t
CEF_EXPORT int cef_create_browser(cef_window_info_t* windowInfo, int popup,
cef_handler_t* handler, const wchar_t* url);
// Create a new browser window using the window parameters specified
// by |windowInfo|. The |popup| parameter should be true (1) if the new window
// is a popup window. This method call will block and can only be used if
// the |multi_threaded_message_loop| parameter to CefInitialize() is false.
CEF_EXPORT cef_browser_t* cef_create_browser_sync(cef_window_info_t* windowInfo,
int popup,
cef_handler_t* handler,
const wchar_t* url);
// Create a new request structure.
CEF_EXPORT cef_request_t* cef_create_request();

View File

@ -78,6 +78,11 @@ public:
cef_string_free(m_windowName);
}
CefWindowInfo(const CefWindowInfo& r)
{
Init();
*this = r;
}
CefWindowInfo(const cef_window_info_t& r)
{
Init();
@ -98,6 +103,10 @@ public:
m_hWnd = NULL;
}
CefWindowInfo& operator=(const CefWindowInfo& r)
{
return operator=(static_cast<const cef_window_info_t&>(r));
}
CefWindowInfo& operator=(const cef_window_info_t& r)
{
m_dwExStyle = r.m_dwExStyle;
@ -159,6 +168,11 @@ public:
{
}
CefPrintInfo(const CefPrintInfo& r)
{
Init();
*this = r;
}
CefPrintInfo(const cef_print_info_t& r)
{
Init();
@ -172,6 +186,10 @@ public:
m_Scale = 0;
}
CefPrintInfo& operator=(const CefPrintInfo& r)
{
return operator=(static_cast<const cef_print_info_t&>(r));
}
CefPrintInfo& operator=(const cef_print_info_t& r)
{
m_hDC = r.m_hDC;