Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index fea916e68d920a2ffc7b2c26ea8388443caaedcf..55f2738d936bd234370377286f792b22ba123274 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -328,6 +328,7 @@ WebContentsImpl::WebContentsImpl( |
frame_tree_(new NavigatorImpl(&controller_, this), |
this, this, this, this), |
is_loading_(false), |
+ is_document_loaded_in_main_frame_(false), |
crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
crashed_error_code_(0), |
waiting_for_response_(false), |
@@ -849,6 +850,10 @@ bool WebContentsImpl::IsLoading() const { |
return is_loading_; |
} |
+bool WebContentsImpl::IsDocumentLoadedInMainFrame() const { |
+ return is_document_loaded_in_main_frame_; |
+} |
+ |
bool WebContentsImpl::IsWaitingForResponse() const { |
return waiting_for_response_; |
} |
@@ -2290,8 +2295,10 @@ void WebContentsImpl::DidStartProvisionalLoad( |
bool is_error_page, |
bool is_iframe_srcdoc) { |
bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
- if (is_main_frame) |
+ if (is_main_frame) { |
DidChangeLoadProgress(0); |
+ is_document_loaded_in_main_frame_ = false; |
+ } |
// Notify observers about the start of the provisional load. |
int render_frame_id = render_frame_host->GetRoutingID(); |
@@ -2568,6 +2575,9 @@ void WebContentsImpl::OnDocumentLoadedInFrame() { |
int render_frame_id = rfh->GetRoutingID(); |
RenderViewHost* render_view_host = rfh->render_view_host(); |
+ if (render_frame_id == GetMainFrame()->GetRoutingID()) { |
+ is_document_loaded_in_main_frame_ = true; |
+ } |
FOR_EACH_OBSERVER(WebContentsObserver, |
observers_, |
DocumentLoadedInFrame(render_frame_id, render_view_host)); |