| Index: content/browser/frame_host/frame_tree_node.cc
|
| diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
|
| index daf4a71255d6b8a9c6f30493364f25644dd18620..c17a405ac03899c909612d58053220b0227ef9ad 100644
|
| --- a/content/browser/frame_host/frame_tree_node.cc
|
| +++ b/content/browser/frame_host/frame_tree_node.cc
|
| @@ -26,11 +26,14 @@ typedef base::hash_map<int64, FrameTreeNode*> FrameTreeNodeIDMap;
|
| base::LazyInstance<FrameTreeNodeIDMap> g_frame_tree_node_id_map =
|
| LAZY_INSTANCE_INITIALIZER;
|
|
|
| -} // namespace
|
| +// These values indicate the loading progress status. The minimum progress
|
| +// value matches what Blink's ProgressTracker has traditionally used for a
|
| +// minimum progress value.
|
| +static const double kLoadingProgressNotStarted = 0.0;
|
| +static const double kLoadingProgressMinimum = 0.1;
|
| +static const double kLoadingProgressDone = 1.0;
|
|
|
| -const double FrameTreeNode::kLoadingProgressNotStarted = 0.0;
|
| -const double FrameTreeNode::kLoadingProgressMinimum = 0.1;
|
| -const double FrameTreeNode::kLoadingProgressDone = 1.0;
|
| +} // namespace
|
|
|
| int64 FrameTreeNode::next_frame_tree_node_id_ = 1;
|
|
|
| @@ -174,4 +177,51 @@ bool FrameTreeNode::CommitPendingSandboxFlags() {
|
| return did_change_flags;
|
| }
|
|
|
| +bool FrameTreeNode::HasStartedLoading() const {
|
| + return loading_progress_ != kLoadingProgressNotStarted;
|
| +}
|
| +
|
| +void FrameTreeNode::ResetLoadingProgress() {
|
| + loading_progress_ = kLoadingProgressNotStarted;
|
| +}
|
| +
|
| +void FrameTreeNode::DidStartLoading(bool to_different_document) {
|
| + // Any main frame load to a new document should reset the load progress since
|
| + // it will replace the current page and any frames. The WebContents will
|
| + // be notified when UpdateLoadProgress is called.
|
| + if (to_different_document && IsMainFrame())
|
| + frame_tree_->ResetLoadProgress();
|
| +
|
| + // Notify the Navigator.
|
| + if (!frame_tree_->IsLoading())
|
| + navigator()->DidStartLoading(this, to_different_document);
|
| +
|
| + // Notify the RenderFrameHostManager of the event.
|
| + render_manager()->OnDidStartLoading();
|
| +
|
| + // Set initial load progress and update overall progress. This will notify
|
| + // the WebContents of the load progress change.
|
| + loading_progress_ = kLoadingProgressMinimum;
|
| + frame_tree_->UpdateLoadProgress();
|
| +}
|
| +
|
| +void FrameTreeNode::DidStopLoading() {
|
| + // Notify the RenderFrameHostManager of the event.
|
| + render_manager()->OnDidStopLoading();
|
| +
|
| + // Set final load progress and update overall progress. This will notify
|
| + // the WebContents of the load progress change.
|
| + loading_progress_ = kLoadingProgressDone;
|
| + frame_tree_->UpdateLoadProgress();
|
| +
|
| + // Notify the Navigator.
|
| + if (!frame_tree_->IsLoading())
|
| + navigator()->DidStopLoading();
|
| +}
|
| +
|
| +void FrameTreeNode::DidChangeLoadProgress(double load_progress) {
|
| + loading_progress_ = load_progress;
|
| + frame_tree_->UpdateLoadProgress();
|
| +}
|
| +
|
| } // namespace content
|
|
|