- Don't load URLs twice for popup windows (issue #215).
- Make the |url| parameter to HandleBeforeCreated constant (issue #215). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@227 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
5923d34661
commit
2669a3b6c3
|
@ -728,7 +728,7 @@ public:
|
|||
CefWindowInfo& windowInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
CefString& url,
|
||||
const CefString& url,
|
||||
CefBrowserSettings& settings) =0;
|
||||
|
||||
// Called on the UI thread after a new window is created. The return value is
|
||||
|
|
|
@ -576,7 +576,7 @@ typedef struct _cef_handler_t
|
|||
struct _cef_handler_t* self, struct _cef_browser_t* parentBrowser,
|
||||
struct _cef_window_info_t* windowInfo, int popup,
|
||||
const struct _cef_popup_features_t* popupFeatures,
|
||||
struct _cef_handler_t** handler, cef_string_t* url,
|
||||
struct _cef_handler_t** handler, const cef_string_t* url,
|
||||
struct _cef_browser_settings_t* settings);
|
||||
|
||||
// Called on the UI thread after a new window is created. The return value is
|
||||
|
|
|
@ -128,7 +128,6 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
CefString newUrl = url;
|
||||
CefRefPtr<CefBrowser> alternateBrowser;
|
||||
CefBrowserSettings settings(_Context->browser_defaults());
|
||||
|
||||
|
@ -137,14 +136,14 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||
// Give the handler an opportunity to modify window attributes, handler,
|
||||
// or cancel the window creation.
|
||||
CefHandler::RetVal rv = handler->HandleBeforeCreated(NULL, windowInfo,
|
||||
popup, CefPopupFeatures(), handler, newUrl, settings);
|
||||
popup, CefPopupFeatures(), handler, url, settings);
|
||||
if(rv == RV_HANDLED)
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowser> browser(
|
||||
new CefBrowserImpl(windowInfo, settings, popup, handler));
|
||||
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(newUrl);
|
||||
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url);
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
@ -1054,7 +1053,6 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(
|
|||
info.m_nHeight = features.height;
|
||||
|
||||
CefRefPtr<CefHandler> handler = handler_;
|
||||
CefString newUrl = url;
|
||||
|
||||
// Start with the current browser window's settings.
|
||||
CefBrowserSettings settings(settings_);
|
||||
|
@ -1064,14 +1062,16 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(
|
|||
// Give the handler an opportunity to modify window attributes, handler,
|
||||
// or cancel the window creation.
|
||||
CefHandler::RetVal rv = handler_->HandleBeforeCreated(this, info, true,
|
||||
features, handler, newUrl, settings);
|
||||
features, handler, url, settings);
|
||||
if(rv == RV_HANDLED)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowserImpl> browser(
|
||||
new CefBrowserImpl(info, settings, true, handler));
|
||||
browser->UIT_CreateBrowser(newUrl);
|
||||
// Don't pass the URL to UIT_CreateBrowser for popup windows or the URL will
|
||||
// be loaded twice.
|
||||
browser->UIT_CreateBrowser(CefString());
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_created(
|
|||
struct _cef_handler_t* self, cef_browser_t* parentBrowser,
|
||||
cef_window_info_t* windowInfo, int popup,
|
||||
const struct _cef_popup_features_t* popupFeatures,
|
||||
struct _cef_handler_t** handler, cef_string_t* url,
|
||||
struct _cef_handler_t** handler, const cef_string_t* url,
|
||||
struct _cef_browser_settings_t* settings)
|
||||
{
|
||||
DCHECK(self);
|
||||
|
@ -56,12 +56,11 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_created(
|
|||
if(parentBrowser)
|
||||
browserPtr = CefBrowserCToCpp::Wrap(parentBrowser);
|
||||
|
||||
CefString urlStr(url);
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleBeforeCreated(
|
||||
browserPtr, wndInfo, popup?true:false, features, handlerPtr,
|
||||
urlStr, browserSettings);
|
||||
CefString(url), browserSettings);
|
||||
|
||||
if(handlerPtr.get() != origHandler) {
|
||||
if(handlerPtr.get() != origHandler) {
|
||||
// The handler has been changed.
|
||||
*handler = CefHandlerCppToC::Wrap(handlerPtr);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& windowInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
const CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_before_created))
|
||||
return RV_CONTINUE;
|
||||
|
@ -41,7 +41,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
|
|||
|
||||
cef_retval_t rv = struct_->handle_before_created(struct_,
|
||||
browserStruct, &windowInfo, popup, &popupFeatures, &handlerStruct,
|
||||
url.GetWritableStruct(), &settings);
|
||||
url.GetStruct(), &settings);
|
||||
|
||||
if(handlerStruct && handlerStruct != origHandlerStruct) {
|
||||
// The handler was changed.
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
virtual RetVal HandleBeforeCreated(CefRefPtr<CefBrowser> parentBrowser,
|
||||
CefWindowInfo& windowInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings);
|
||||
const CefString& url, CefBrowserSettings& settings);
|
||||
virtual RetVal HandleAfterCreated(CefRefPtr<CefBrowser> browser);
|
||||
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const CefString& url);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
CefString& url,
|
||||
const CefString& url,
|
||||
CefBrowserSettings& settings);
|
||||
|
||||
// Called on the UI thread after a new window is created. The return value is
|
||||
|
|
|
@ -484,7 +484,7 @@ int main(int argc, char* argv[])
|
|||
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
const CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
CefHandler::RetVal ClientHandler::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
const CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
CefString& url,
|
||||
const CefString& url,
|
||||
CefBrowserSettings& settings)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
CefWindowInfo& createInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures,
|
||||
CefRefPtr<CefHandler>& handler,
|
||||
CefString& url,
|
||||
const CefString& url,
|
||||
CefBrowserSettings& settings)
|
||||
{
|
||||
return RV_CONTINUE;
|
||||
|
|
Loading…
Reference in New Issue