mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 07:27:42 +01:00
- HandleAddressChange and HandleTitleChange will always be called for the main frame and only the main frame (issue #200).
- The |frame| parameter to HandleLoadStart and HandleLoadEnd will always be non-empty. The CefFrame::IsMain() method can be used to check if the notification is for the main frame. The |isMainContent| parameter has been removed. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@202 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
11b831119a
commit
327ad9d9de
@ -674,27 +674,26 @@ public:
|
|||||||
CefRefPtr<CefRequest> request,
|
CefRefPtr<CefRequest> request,
|
||||||
NavType navType, bool isRedirect) =0;
|
NavType navType, bool isRedirect) =0;
|
||||||
|
|
||||||
// Called on the UI thread when the browser begins loading a page. The |frame|
|
// Called on the UI thread when the browser begins loading a frame. The
|
||||||
// pointer will be empty if the event represents the overall load status and
|
// |frame| value will never be empty -- call the IsMain() method to check if
|
||||||
// not the load status for a particular frame. |isMainContent| will be true if
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// this load is for the main content area and not an iframe. This method may
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// not be called if the load request fails. The return value is currently
|
// has ended. This method may not be called for a particular frame if the load
|
||||||
// ignored.
|
// request for that frame fails. The return value is currently ignored.
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame) =0;
|
||||||
bool isMainContent) =0;
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser is done loading a page. The
|
// Called on the UI thread when the browser is done loading a frame. The
|
||||||
// |frame| pointer will be empty if the event represents the overall load
|
// |frame| value will never be empty -- call the IsMain() method to check if
|
||||||
// status and not the load status for a particular frame. |isMainContent| will
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// be true if this load is for the main content area and not an iframe. This
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// method will be called irrespective of whether the request completes
|
// has ended. This method will always be called for all frames irrespective of
|
||||||
// successfully. The return value is currently ignored.
|
// whether the request completes successfully. The return value is currently
|
||||||
|
// ignored.
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode) =0;
|
int httpStatusCode) =0;
|
||||||
|
|
||||||
// Supported error code values. See net\base\net_error_list.h for complete
|
// Supported error code values. See net\base\net_error_list.h for complete
|
||||||
|
@ -481,25 +481,26 @@ typedef struct _cef_handler_t
|
|||||||
struct _cef_frame_t* frame, struct _cef_request_t* request,
|
struct _cef_frame_t* frame, struct _cef_request_t* request,
|
||||||
enum cef_handler_navtype_t navType, int isRedirect);
|
enum cef_handler_navtype_t navType, int isRedirect);
|
||||||
|
|
||||||
// Called on the UI thread when the browser begins loading a page. The |frame|
|
// Called on the UI thread when the browser begins loading a frame. The
|
||||||
// pointer will be NULL if the event represents the overall load status and
|
// |frame| value will never be NULL -- call the is_main() function to check if
|
||||||
// not the load status for a particular frame. |isMainContent| will be true
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// (1) if this load is for the main content area and not an iframe. This
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// function may not be called if the load request fails. The return value is
|
// has ended. This function may not be called for a particular frame if the
|
||||||
// currently ignored.
|
// load request for that frame fails. The return value is currently ignored.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||||
struct _cef_frame_t* frame, int isMainContent);
|
struct _cef_frame_t* frame);
|
||||||
|
|
||||||
// Called on the UI thread when the browser is done loading a page. The
|
// Called on the UI thread when the browser is done loading a frame. The
|
||||||
// |frame| pointer will be NULL if the event represents the overall load
|
// |frame| value will never be NULL -- call the is_main() function to check if
|
||||||
// status and not the load status for a particular frame. |isMainContent| will
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// be true (1) if this load is for the main content area and not an iframe.
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// This function will be called irrespective of whether the request completes
|
// has ended. This function will always be called for all frames irrespective
|
||||||
// successfully. The return value is currently ignored.
|
// of whether the request completes successfully. The return value is
|
||||||
|
// currently ignored.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(struct _cef_handler_t* self,
|
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(struct _cef_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
int isMainContent, int httpStatusCode);
|
int httpStatusCode);
|
||||||
|
|
||||||
// Called on the UI thread when the browser fails to load a resource.
|
// Called on the UI thread when the browser fails to load a resource.
|
||||||
// |errorCode| is the error code number and |failedUrl| is the URL that failed
|
// |errorCode| is the error code number and |failedUrl| is the URL that failed
|
||||||
|
@ -100,38 +100,6 @@ v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame)
|
|||||||
return WebCore::V8Proxy::context(core_frame);
|
return WebCore::V8Proxy::context(core_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameLoadType GetFrameLoadType(WebKit::WebFrame* frame)
|
|
||||||
{
|
|
||||||
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
|
||||||
WebCore::FrameLoader* loader = webFrameImpl->frame()->loader();
|
|
||||||
switch(loader->loadType()) {
|
|
||||||
case WebCore::FrameLoadTypeStandard:
|
|
||||||
return FLT_STANDARD;
|
|
||||||
case WebCore::FrameLoadTypeForward:
|
|
||||||
case WebCore::FrameLoadTypeBack:
|
|
||||||
case WebCore::FrameLoadTypeBackWMLDeckNotAccessible:
|
|
||||||
case WebCore::FrameLoadTypeIndexedBackForward:
|
|
||||||
return FLT_HISTORY;
|
|
||||||
case WebCore::FrameLoadTypeRedirectWithLockedBackForwardList:
|
|
||||||
return FLT_REDIRECT;
|
|
||||||
case WebCore::FrameLoadTypeReload:
|
|
||||||
case WebCore::FrameLoadTypeReloadFromOrigin:
|
|
||||||
case WebCore::FrameLoadTypeSame:
|
|
||||||
case WebCore::FrameLoadTypeReplace:
|
|
||||||
return FLT_RELOAD;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FLT_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FrameHasSubsituteData(WebKit::WebFrame* frame)
|
|
||||||
{
|
|
||||||
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
|
||||||
WebCore::DocumentLoader* docLoader =
|
|
||||||
webFrameImpl->frame()->loader()->documentLoader();
|
|
||||||
return docLoader->substituteData().isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CloseIdleConnections() {
|
void CloseIdleConnections() {
|
||||||
// Used in benchmarking, Ignored for CEF.
|
// Used in benchmarking, Ignored for CEF.
|
||||||
}
|
}
|
||||||
|
@ -39,20 +39,6 @@ base::StringPiece NetResourceProvider(int key);
|
|||||||
// Retrieve the V8 context associated with the frame.
|
// Retrieve the V8 context associated with the frame.
|
||||||
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame);
|
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame);
|
||||||
|
|
||||||
enum FrameLoadType {
|
|
||||||
FLT_UNKNOWN = 0,
|
|
||||||
FLT_STANDARD,
|
|
||||||
FLT_HISTORY,
|
|
||||||
FLT_REDIRECT,
|
|
||||||
FLT_RELOAD,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Returns the frame load type.
|
|
||||||
FrameLoadType GetFrameLoadType(WebKit::WebFrame* frame);
|
|
||||||
|
|
||||||
// Returns true if the frame is loading substitute data.
|
|
||||||
bool FrameHasSubsituteData(WebKit::WebFrame* frame);
|
|
||||||
|
|
||||||
// Clear all cached data.
|
// Clear all cached data.
|
||||||
void ClearCache();
|
void ClearCache();
|
||||||
|
|
||||||
|
@ -660,10 +660,6 @@ void BrowserWebViewDelegate::didCreateDataSource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) {
|
void BrowserWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) {
|
||||||
if (!top_loading_frame_) {
|
|
||||||
top_loading_frame_ = frame;
|
|
||||||
is_main_content_ = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::didReceiveServerRedirectForProvisionalLoad(
|
void BrowserWebViewDelegate::didReceiveServerRedirectForProvisionalLoad(
|
||||||
@ -723,29 +719,10 @@ void BrowserWebViewDelegate::didFailProvisionalLoad(
|
|||||||
|
|
||||||
void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
||||||
WebFrame* frame, bool is_new_navigation) {
|
WebFrame* frame, bool is_new_navigation) {
|
||||||
// Determine if this commit represents the main content.
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
if (frame == top_loading_frame_) {
|
if (is_main_frame) {
|
||||||
is_main_content_ = false;
|
// Clear the title so we can tell if it wasn't provided by the page.
|
||||||
if (is_new_navigation) {
|
browser_->UIT_SetTitle(std::wstring());
|
||||||
// New navigations will be the main content.
|
|
||||||
is_main_content_ = true;
|
|
||||||
} else if(webkit_glue::FrameHasSubsituteData(frame)) {
|
|
||||||
// Loading from a string will be main content.
|
|
||||||
is_main_content_ = true;
|
|
||||||
} else {
|
|
||||||
// Session history navigations and reloads will be the main content.
|
|
||||||
webkit_glue::FrameLoadType load_type =
|
|
||||||
webkit_glue::GetFrameLoadType(frame);
|
|
||||||
if (load_type == webkit_glue::FLT_HISTORY ||
|
|
||||||
load_type == webkit_glue::FLT_RELOAD) {
|
|
||||||
is_main_content_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_main_content_) {
|
|
||||||
// Clear the title so we can tell if it wasn't provided by the page.
|
|
||||||
browser_->UIT_SetTitle(std::wstring());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||||
@ -753,13 +730,11 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
|||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
// Notify the handler that loading has started.
|
// Notify the handler that loading has started.
|
||||||
handler->HandleLoadStart(browser_,
|
handler->HandleLoadStart(browser_, browser_->UIT_GetCefFrame(frame));
|
||||||
(frame == top_loading_frame_) ? NULL : browser_->UIT_GetCefFrame(frame),
|
|
||||||
is_main_content_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply zoom settings only on top-level frames.
|
// Apply zoom settings only on top-level frames.
|
||||||
if(frame->parent() == NULL) {
|
if(is_main_frame) {
|
||||||
// Restore the zoom value that we have for this URL, if any.
|
// Restore the zoom value that we have for this URL, if any.
|
||||||
double zoomLevel = 0.0;
|
double zoomLevel = 0.0;
|
||||||
ZoomMap::GetInstance()->get(frame->url(), zoomLevel);
|
ZoomMap::GetInstance()->get(frame->url(), zoomLevel);
|
||||||
@ -786,8 +761,8 @@ void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
|||||||
|
|
||||||
void BrowserWebViewDelegate::didReceiveTitle(
|
void BrowserWebViewDelegate::didReceiveTitle(
|
||||||
WebFrame* frame, const WebString& title) {
|
WebFrame* frame, const WebString& title) {
|
||||||
if (top_loading_frame_ == NULL ||
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
(frame == top_loading_frame_ && is_main_content_)) {
|
if (is_main_frame) {
|
||||||
CefString titleStr = string16(title);
|
CefString titleStr = string16(title);
|
||||||
browser_->UIT_SetTitle(titleStr);
|
browser_->UIT_SetTitle(titleStr);
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
@ -857,8 +832,6 @@ BrowserWebViewDelegate::BrowserWebViewDelegate(CefBrowserImpl* browser)
|
|||||||
policy_delegate_is_permissive_(false),
|
policy_delegate_is_permissive_(false),
|
||||||
policy_delegate_should_notify_done_(false),
|
policy_delegate_should_notify_done_(false),
|
||||||
browser_(browser),
|
browser_(browser),
|
||||||
top_loading_frame_(NULL),
|
|
||||||
is_main_content_(false),
|
|
||||||
page_id_(-1),
|
page_id_(-1),
|
||||||
last_page_id_updated_(-1),
|
last_page_id_updated_(-1),
|
||||||
smart_insert_delete_enabled_(true),
|
smart_insert_delete_enabled_(true),
|
||||||
@ -935,32 +908,23 @@ void BrowserWebViewDelegate::ShowStatus(const WebString& text,
|
|||||||
|
|
||||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
bool is_top_frame = false;
|
if (!handler.get())
|
||||||
|
return;
|
||||||
|
|
||||||
if (frame == top_loading_frame_) {
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
top_loading_frame_ = NULL;
|
if (is_main_frame) {
|
||||||
is_top_frame = true;
|
CefString title = browser_->UIT_GetTitle();
|
||||||
|
if (title.empty()) {
|
||||||
if(is_main_content_ && handler.get()) {
|
// No title was provided by the page, so send a blank string to the
|
||||||
CefString title = browser_->UIT_GetTitle();
|
// client.
|
||||||
if (title.empty()) {
|
handler->HandleTitleChange(browser_, title);
|
||||||
// No title was provided by the page, so send a blank string to the
|
|
||||||
// client.
|
|
||||||
handler->HandleTitleChange(browser_, title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handler.get()) {
|
// Notify the handler that loading has ended.
|
||||||
// Notify the handler that loading has ended.
|
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
||||||
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
handler->HandleLoadEnd(browser_, browser_->UIT_GetCefFrame(frame),
|
||||||
handler->HandleLoadEnd(browser_,
|
httpStatusCode);
|
||||||
(is_top_frame) ? NULL : browser_->UIT_GetCefFrame(frame),
|
|
||||||
is_main_content_, httpStatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_top_frame && is_main_content_)
|
|
||||||
is_main_content_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||||
@ -1020,7 +984,8 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||||||
entry->SetURL(request.url());
|
entry->SetURL(request.url());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_main_content_) {
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
|
if (is_main_frame) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
// Notify the handler of an address change
|
// Notify the handler of an address change
|
||||||
|
@ -209,7 +209,6 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
void SetSelectTrailingWhitespaceEnabled(bool enabled);
|
void SetSelectTrailingWhitespaceEnabled(bool enabled);
|
||||||
|
|
||||||
// Additional accessors
|
// Additional accessors
|
||||||
WebKit::WebFrame* top_loading_frame() { return top_loading_frame_; }
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); }
|
BrowserDragDelegate* drag_delegate() { return drag_delegate_.get(); }
|
||||||
WebDropTarget* drop_target() { return drop_target_.get(); }
|
WebDropTarget* drop_target() { return drop_target_.get(); }
|
||||||
@ -302,11 +301,6 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
// Non-owning pointer. The delegate is owned by the host.
|
// Non-owning pointer. The delegate is owned by the host.
|
||||||
CefBrowserImpl* browser_;
|
CefBrowserImpl* browser_;
|
||||||
|
|
||||||
// This is non-NULL if a load is in progress.
|
|
||||||
WebKit::WebFrame* top_loading_frame_;
|
|
||||||
// This is true if the in-progress load is the main content.
|
|
||||||
bool is_main_content_;
|
|
||||||
|
|
||||||
// For tracking session history. See RenderView.
|
// For tracking session history. See RenderView.
|
||||||
int page_id_;
|
int page_id_;
|
||||||
int last_page_id_updated_;
|
int last_page_id_updated_;
|
||||||
|
@ -135,8 +135,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_browse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame)
|
||||||
int isMainContent)
|
|
||||||
{
|
{
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
DCHECK(browser);
|
DCHECK(browser);
|
||||||
@ -148,12 +147,12 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
|||||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
framePtr = CefFrameCToCpp::Wrap(frame);
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleLoadStart(
|
return CefHandlerCppToC::Get(self)->HandleLoadStart(
|
||||||
CefBrowserCToCpp::Wrap(browser), framePtr, isMainContent?true:false);
|
CefBrowserCToCpp::Wrap(browser), framePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||||
int isMainContent, int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
DCHECK(browser);
|
DCHECK(browser);
|
||||||
@ -165,8 +164,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
|||||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
framePtr = CefFrameCToCpp::Wrap(frame);
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleLoadEnd(
|
return CefHandlerCppToC::Get(self)->HandleLoadEnd(
|
||||||
CefBrowserCToCpp::Wrap(browser), framePtr,
|
CefBrowserCToCpp::Wrap(browser), framePtr, httpStatusCode);
|
||||||
isMainContent?true:false, httpStatusCode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
||||||
|
@ -98,8 +98,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeBrowse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadStart(
|
CefHandler::RetVal CefHandlerCToCpp::HandleLoadStart(
|
||||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame)
|
||||||
bool isMainContent)
|
|
||||||
{
|
{
|
||||||
if(CEF_MEMBER_MISSING(struct_, handle_load_start))
|
if(CEF_MEMBER_MISSING(struct_, handle_load_start))
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
@ -109,12 +108,12 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadStart(
|
|||||||
frameStruct = CefFrameCppToC::Wrap(frame);
|
frameStruct = CefFrameCppToC::Wrap(frame);
|
||||||
|
|
||||||
return struct_->handle_load_start(struct_, CefBrowserCppToC::Wrap(browser),
|
return struct_->handle_load_start(struct_, CefBrowserCppToC::Wrap(browser),
|
||||||
frameStruct, isMainContent);
|
frameStruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
||||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent, int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
if(CEF_MEMBER_MISSING(struct_, handle_load_end))
|
if(CEF_MEMBER_MISSING(struct_, handle_load_end))
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
@ -124,7 +123,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
|||||||
frameStruct = CefFrameCppToC::Wrap(frame);
|
frameStruct = CefFrameCppToC::Wrap(frame);
|
||||||
|
|
||||||
return struct_->handle_load_end(struct_, CefBrowserCppToC::Wrap(browser),
|
return struct_->handle_load_end(struct_, CefBrowserCppToC::Wrap(browser),
|
||||||
frameStruct, isMainContent, httpStatusCode);
|
frameStruct, httpStatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadError(
|
CefHandler::RetVal CefHandlerCToCpp::HandleLoadError(
|
||||||
|
@ -44,9 +44,9 @@ public:
|
|||||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
|
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
|
||||||
NavType navType, bool isRedirect);
|
NavType navType, bool isRedirect);
|
||||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame, bool isMainContent);
|
CefRefPtr<CefFrame> frame);
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame, bool isMainContent, int httpStatusCode);
|
CefRefPtr<CefFrame> frame, int httpStatusCode);
|
||||||
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
|
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
|
||||||
const CefString& failedUrl, CefString& errorText);
|
const CefString& failedUrl, CefString& errorText);
|
||||||
|
@ -63,11 +63,11 @@ CefHandler::RetVal ClientHandler::HandleAfterCreated(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefHandler::RetVal ClientHandler::HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
CefHandler::RetVal ClientHandler::HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame, bool isMainContent)
|
CefRefPtr<CefFrame> frame)
|
||||||
{
|
{
|
||||||
REQUIRE_UI_THREAD();
|
REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if(!browser->IsPopup() && !frame.get())
|
if(!browser->IsPopup() && frame->IsMain())
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
// We've just started loading a page
|
// We've just started loading a page
|
||||||
@ -80,11 +80,11 @@ CefHandler::RetVal ClientHandler::HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefHandler::RetVal ClientHandler::HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
CefHandler::RetVal ClientHandler::HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame, bool isMainContent, int httpStatusCode)
|
CefRefPtr<CefFrame> frame, int httpStatusCode)
|
||||||
{
|
{
|
||||||
REQUIRE_UI_THREAD();
|
REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
if(!browser->IsPopup() && !frame.get())
|
if(!browser->IsPopup() && frame->IsMain())
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
// We've just finished loading a page
|
// We've just finished loading a page
|
||||||
@ -92,7 +92,6 @@ CefHandler::RetVal ClientHandler::HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
|||||||
m_bCanGoBack = browser->CanGoBack();
|
m_bCanGoBack = browser->CanGoBack();
|
||||||
m_bCanGoForward = browser->CanGoForward();
|
m_bCanGoForward = browser->CanGoForward();
|
||||||
|
|
||||||
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
|
|
||||||
CefRefPtr<CefDOMVisitor> visitor = GetDOMVisitor(frame->GetURL());
|
CefRefPtr<CefDOMVisitor> visitor = GetDOMVisitor(frame->GetURL());
|
||||||
if(visitor.get())
|
if(visitor.get())
|
||||||
frame->VisitDOM(visitor);
|
frame->VisitDOM(visitor);
|
||||||
|
@ -80,25 +80,24 @@ public:
|
|||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on the UI thread when the browser begins loading a page. The |frame|
|
// Called on the UI thread when the browser begins loading a frame. The
|
||||||
// pointer will be empty if the event represents the overall load status and
|
// |frame| value will never be empty -- call the IsMain() method to check if
|
||||||
// not the load status for a particular frame. |isMainContent| will be true if
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// this load is for the main content area and not an iframe. This method may
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// not be called if the load request fails. The return value is currently
|
// has ended. This method may not be called for a particular frame if the load
|
||||||
// ignored.
|
// request for that frame fails. The return value is currently ignored.
|
||||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame);
|
||||||
bool isMainContent);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser is done loading a page. The
|
// Called on the UI thread when the browser is done loading a frame. The
|
||||||
// |frame| pointer will be empty if the event represents the overall load
|
// |frame| value will never be empty -- call the IsMain() method to check if
|
||||||
// status and not the load status for a particular frame. |isMainContent| will
|
// this frame is the main frame. Multiple frames may be loading at the same
|
||||||
// be true if this load is for the main content area and not an iframe. This
|
// time. Sub-frames may start or continue loading after the main frame load
|
||||||
// method will be called irrespective of whether the request completes
|
// has ended. This method will always be called for all frames irrespective of
|
||||||
// successfully. The return value is currently ignored.
|
// whether the request completes successfully. The return value is currently
|
||||||
|
// ignored.
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode);
|
int httpStatusCode);
|
||||||
|
|
||||||
// Called on the UI thread when the browser fails to load a resource.
|
// Called on the UI thread when the browser fails to load a resource.
|
||||||
|
@ -228,10 +228,9 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
if(!frame.get()) {
|
if(frame->IsMain()) {
|
||||||
// The page is done loading so visit the DOM.
|
// The page is done loading so visit the DOM.
|
||||||
browser->GetMainFrame()->VisitDOM(visitor_.get());
|
browser->GetMainFrame()->VisitDOM(visitor_.get());
|
||||||
}
|
}
|
||||||
|
@ -273,10 +273,9 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
if(!browser->IsPopup() && !frame.get())
|
if(!browser->IsPopup() && frame->IsMain())
|
||||||
DestroyTest();
|
DestroyTest();
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
@ -386,10 +385,9 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
if(!browser->IsPopup() && !frame.get())
|
if(!browser->IsPopup() && frame->IsMain())
|
||||||
{
|
{
|
||||||
CefString url = browser->GetMainFrame()->GetURL();
|
CefString url = browser->GetMainFrame()->GetURL();
|
||||||
if(url == "http://tests/run.html")
|
if(url == "http://tests/run.html")
|
||||||
|
@ -80,15 +80,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame)
|
||||||
bool isMainContent)
|
|
||||||
{
|
{
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
|
@ -251,10 +251,9 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
if(!browser->IsPopup() && !frame.get())
|
if(!browser->IsPopup() && frame->IsMain())
|
||||||
DestroyTest();
|
DestroyTest();
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
}
|
}
|
||||||
@ -487,7 +486,6 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
return RV_CONTINUE;
|
return RV_CONTINUE;
|
||||||
|
@ -59,7 +59,6 @@ public:
|
|||||||
|
|
||||||
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual RetVal HandleLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
CefRefPtr<CefFrame> frame,
|
CefRefPtr<CefFrame> frame,
|
||||||
bool isMainContent,
|
|
||||||
int httpStatusCode)
|
int httpStatusCode)
|
||||||
{
|
{
|
||||||
StartTest();
|
StartTest();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user