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 #include "content/browser/frame_host/frame_tree_node.h" | 5 #include "content/browser/frame_host/frame_tree_node.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 : frame_tree_(frame_tree), | 28 : frame_tree_(frame_tree), |
29 navigator_(navigator), | 29 navigator_(navigator), |
30 render_manager_(this, | 30 render_manager_(this, |
31 render_frame_delegate, | 31 render_frame_delegate, |
32 render_view_delegate, | 32 render_view_delegate, |
33 render_widget_delegate, | 33 render_widget_delegate, |
34 manager_delegate), | 34 manager_delegate), |
35 frame_tree_node_id_(next_frame_tree_node_id_++), | 35 frame_tree_node_id_(next_frame_tree_node_id_++), |
36 parent_(NULL), | 36 parent_(NULL), |
37 replication_state_(name), | 37 replication_state_(name), |
38 effective_sandbox_flags_(SandboxFlags::NONE), | 38 effective_sandbox_flags_(SandboxFlags::NONE) { |
39 is_loading_(false) { | |
40 } | 39 } |
41 | 40 |
42 FrameTreeNode::~FrameTreeNode() { | 41 FrameTreeNode::~FrameTreeNode() { |
43 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 42 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
44 switches::kEnableBrowserSideNavigation)) { | 43 switches::kEnableBrowserSideNavigation)) { |
45 navigator_->CancelNavigation(this); | 44 navigator_->CancelNavigation(this); |
46 } | 45 } |
47 } | 46 } |
48 | 47 |
49 bool FrameTreeNode::IsMainFrame() const { | 48 bool FrameTreeNode::IsMainFrame() const { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return false; | 115 return false; |
117 | 116 |
118 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 117 for (FrameTreeNode* node = parent(); node; node = node->parent()) { |
119 if (node == other) | 118 if (node == other) |
120 return true; | 119 return true; |
121 } | 120 } |
122 | 121 |
123 return false; | 122 return false; |
124 } | 123 } |
125 | 124 |
| 125 bool FrameTreeNode::IsLoading() const { |
| 126 RenderFrameHostImpl* current_frame_host = |
| 127 render_manager_.current_frame_host(); |
| 128 RenderFrameHostImpl* pending_frame_host = |
| 129 render_manager_.pending_frame_host(); |
| 130 |
| 131 DCHECK(current_frame_host); |
| 132 // TODO(fdegans): Change the implementation logic for PlzNavigate once |
| 133 // DidStartLoading and DidStopLoading are properly called. |
| 134 if (pending_frame_host && pending_frame_host->is_loading()) |
| 135 return true; |
| 136 return current_frame_host->is_loading(); |
| 137 } |
| 138 |
| 139 double FrameTreeNode::GetLoadingProgress() const { |
| 140 RenderFrameHostImpl* current_frame_host = |
| 141 render_manager_.current_frame_host(); |
| 142 |
| 143 DCHECK(current_frame_host); |
| 144 return current_frame_host->loading_progress(); |
| 145 } |
| 146 |
126 bool FrameTreeNode::CommitPendingSandboxFlags() { | 147 bool FrameTreeNode::CommitPendingSandboxFlags() { |
127 bool did_change_flags = | 148 bool did_change_flags = |
128 effective_sandbox_flags_ != replication_state_.sandbox_flags; | 149 effective_sandbox_flags_ != replication_state_.sandbox_flags; |
129 effective_sandbox_flags_ = replication_state_.sandbox_flags; | 150 effective_sandbox_flags_ = replication_state_.sandbox_flags; |
130 return did_change_flags; | 151 return did_change_flags; |
131 } | 152 } |
132 | 153 |
133 } // namespace content | 154 } // namespace content |
OLD | NEW |