mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Allow for cases where CefBrowserImpl::UIT_CreateBrowser() may fail (issue #322).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@336 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -153,7 +153,8 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(
|
|||||||
|
|
||||||
CefRefPtr<CefBrowser> browser(
|
CefRefPtr<CefBrowser> browser(
|
||||||
new CefBrowserImpl(windowInfo, settings, NULL, client));
|
new CefBrowserImpl(windowInfo, settings, NULL, client));
|
||||||
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url);
|
if (!static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return browser;
|
return browser;
|
||||||
}
|
}
|
||||||
@@ -1142,7 +1143,8 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(
|
|||||||
|
|
||||||
// Don't pass the URL to UIT_CreateBrowser for popup windows or the URL will
|
// Don't pass the URL to UIT_CreateBrowser for popup windows or the URL will
|
||||||
// be loaded twice.
|
// be loaded twice.
|
||||||
browser->UIT_CreateBrowser(CefString());
|
if (!browser->UIT_CreateBrowser(CefString()))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return browser;
|
return browser;
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the native browser window and populate browser members.
|
// Create the native browser window and populate browser members.
|
||||||
void UIT_CreateBrowser(const CefString& url);
|
bool UIT_CreateBrowser(const CefString& url);
|
||||||
|
|
||||||
// Destroy the browser members. This method should only be called after the
|
// Destroy the browser members. This method should only be called after the
|
||||||
// native browser window is not longer processing messages.
|
// native browser window is not longer processing messages.
|
||||||
|
@@ -42,7 +42,7 @@ gfx::NativeWindow CefBrowserImpl::UIT_GetMainWndHandle() {
|
|||||||
return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
|
return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
Lock();
|
Lock();
|
||||||
@@ -79,6 +79,8 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||||||
|
|
||||||
if(url.size() > 0)
|
if(url.size() > 0)
|
||||||
UIT_LoadURL(GetMainFrame(), url);
|
UIT_LoadURL(GetMainFrame(), url);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
||||||
|
@@ -41,7 +41,7 @@ gfx::NativeView CefBrowserImpl::UIT_GetMainWndHandle() {
|
|||||||
return window_info_.m_View;
|
return window_info_.m_View;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
Lock();
|
Lock();
|
||||||
@@ -119,6 +119,8 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||||||
|
|
||||||
if(url.size() > 0)
|
if(url.size() > 0)
|
||||||
UIT_LoadURL(GetMainFrame(), url);
|
UIT_LoadURL(GetMainFrame(), url);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
||||||
|
@@ -163,7 +163,7 @@ gfx::NativeWindow CefBrowserImpl::UIT_GetMainWndHandle() {
|
|||||||
window_info_.m_hWndParent : window_info_.m_hWnd;
|
window_info_.m_hWndParent : window_info_.m_hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
Lock();
|
Lock();
|
||||||
@@ -177,7 +177,14 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||||||
window_info_.m_x, window_info_.m_y, window_info_.m_nWidth,
|
window_info_.m_x, window_info_.m_y, window_info_.m_nWidth,
|
||||||
window_info_.m_nHeight, window_info_.m_hWndParent, window_info_.m_hMenu,
|
window_info_.m_nHeight, window_info_.m_hWndParent, window_info_.m_hMenu,
|
||||||
::GetModuleHandle(NULL), NULL);
|
::GetModuleHandle(NULL), NULL);
|
||||||
|
|
||||||
|
// It's possible for CreateWindowEx to fail if the parent window was
|
||||||
|
// destroyed between the call to CreateBrowser and the above one.
|
||||||
DCHECK(window_info_.m_hWnd != NULL);
|
DCHECK(window_info_.m_hWnd != NULL);
|
||||||
|
if (!window_info_.m_hWnd) {
|
||||||
|
Unlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (window_info_.m_bTransparentPainting &&
|
if (window_info_.m_bTransparentPainting &&
|
||||||
!(window_info_.m_dwStyle & WS_CHILD)) {
|
!(window_info_.m_dwStyle & WS_CHILD)) {
|
||||||
@@ -248,6 +255,8 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||||||
|
|
||||||
if(url.length() > 0)
|
if(url.length() > 0)
|
||||||
UIT_LoadURL(GetMainFrame(), url);
|
UIT_LoadURL(GetMainFrame(), url);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
||||||
|
Reference in New Issue
Block a user