Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 class FrameTree; | 23 class FrameTree; |
| 24 class Navigator; | 24 class Navigator; |
| 25 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
| 26 | 26 |
| 27 // When a page contains iframes, its renderer process maintains a tree structure | 27 // When a page contains iframes, its renderer process maintains a tree structure |
| 28 // of those frames. We are mirroring this tree in the browser process. This | 28 // of those frames. We are mirroring this tree in the browser process. This |
| 29 // class represents a node in this tree and is a wrapper for all objects that | 29 // class represents a node in this tree and is a wrapper for all objects that |
| 30 // are frame-specific (as opposed to page-specific). | 30 // are frame-specific (as opposed to page-specific). |
| 31 class CONTENT_EXPORT FrameTreeNode { | 31 class CONTENT_EXPORT FrameTreeNode { |
| 32 public: | 32 public: |
| 33 // These values indicate the loading progress status. The minimum progress | |
| 34 // value matches what Blink's ProgressTracker has traditionally used for a | |
| 35 // minimum progress value. | |
| 36 // TODO(fdegans): Move these values to the implementation when the relevant | |
| 37 // IPCs are moved from WebContentsImpl to RenderFrameHost. | |
| 38 static const double kLoadingProgressNotStarted; | |
| 39 static const double kLoadingProgressMinimum; | |
| 40 static const double kLoadingProgressDone; | |
| 41 | |
| 42 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, | 33 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, |
| 43 // regardless of which FrameTree it is in. | 34 // regardless of which FrameTree it is in. |
| 44 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); | 35 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); |
| 45 | 36 |
| 46 FrameTreeNode(FrameTree* frame_tree, | 37 FrameTreeNode(FrameTree* frame_tree, |
| 47 Navigator* navigator, | 38 Navigator* navigator, |
| 48 RenderFrameHostDelegate* render_frame_delegate, | 39 RenderFrameHostDelegate* render_frame_delegate, |
| 49 RenderViewHostDelegate* render_view_delegate, | 40 RenderViewHostDelegate* render_view_delegate, |
| 50 RenderWidgetHostDelegate* render_widget_delegate, | 41 RenderWidgetHostDelegate* render_widget_delegate, |
| 51 RenderFrameHostManager::Delegate* manager_delegate, | 42 RenderFrameHostManager::Delegate* manager_delegate, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 118 |
| 128 RenderFrameHostImpl* current_frame_host() const { | 119 RenderFrameHostImpl* current_frame_host() const { |
| 129 return render_manager_.current_frame_host(); | 120 return render_manager_.current_frame_host(); |
| 130 } | 121 } |
| 131 | 122 |
| 132 bool IsDescendantOf(FrameTreeNode* other) const; | 123 bool IsDescendantOf(FrameTreeNode* other) const; |
| 133 | 124 |
| 134 // Returns true if this node is in a loading state. | 125 // Returns true if this node is in a loading state. |
| 135 bool IsLoading() const; | 126 bool IsLoading() const; |
| 136 | 127 |
| 137 // Sets this node's loading progress (from 0 to 1). | |
| 138 void set_loading_progress(double loading_progress) { | |
| 139 loading_progress_ = loading_progress; | |
| 140 } | |
| 141 | |
| 142 // Returns this node's loading progress. | 128 // Returns this node's loading progress. |
| 143 double loading_progress() const { return loading_progress_; } | 129 double loading_progress() const { return loading_progress_; } |
| 144 | 130 |
| 131 // Returns true if this node is in a state where the loading progress is being | |
| 132 // tracked. | |
| 133 bool HasStartedLoading() const; | |
| 134 | |
| 135 // Resets this node's loading progress. | |
| 136 void ResetLoadingProgress(); | |
| 137 | |
| 138 // A RenderFrameHost in this node started loading. | |
| 139 // |to_different_document| will be true unless the load is a fragment | |
| 140 // navigation, or triggered by history.pushState/replaceState. | |
| 141 void DidStartLoading(bool to_different_document); | |
| 142 | |
| 143 // A RenderFrameHost in this node stopped loading. | |
| 144 void DidStopLoading(); | |
| 145 | |
| 146 // The load progress for a RenderFrameHost in this node was updated to | |
| 147 // |load_progress|. This will notify the FrameTree who will in turn notify | |
|
nasko
2015/04/16 16:23:48
nit: s/who/which/
Fabrice (no longer in Chrome)
2015/04/16 16:33:30
Done.
| |
| 148 // the WebContents. | |
| 149 void DidChangeLoadProgress(double load_progress); | |
| 150 | |
| 145 private: | 151 private: |
| 146 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 152 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
| 147 | 153 |
| 148 // The next available browser-global FrameTreeNode ID. | 154 // The next available browser-global FrameTreeNode ID. |
| 149 static int64 next_frame_tree_node_id_; | 155 static int64 next_frame_tree_node_id_; |
| 150 | 156 |
| 151 // The FrameTree that owns us. | 157 // The FrameTree that owns us. |
| 152 FrameTree* frame_tree_; // not owned. | 158 FrameTree* frame_tree_; // not owned. |
| 153 | 159 |
| 154 // The Navigator object responsible for managing navigations at this node | 160 // The Navigator object responsible for managing navigations at this node |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 200 |
| 195 // Used to track this node's loading progress (from 0 to 1). | 201 // Used to track this node's loading progress (from 0 to 1). |
| 196 double loading_progress_; | 202 double loading_progress_; |
| 197 | 203 |
| 198 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 204 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
| 199 }; | 205 }; |
| 200 | 206 |
| 201 } // namespace content | 207 } // namespace content |
| 202 | 208 |
| 203 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 209 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
| OLD | NEW |