Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: content/browser/frame_host/frame_tree.cc

Issue 1860743002: Add a flag to change when android's progress bar completes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add flag to include same origin iframes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index a85c7fa3a5adca9163e41f361c7fa367aa728fd9..8a3a246b18ed093351bc860240a7849eca08cd6a 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -21,6 +21,7 @@
#include "content/browser/frame_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/common/content_switches_internal.h"
#include "content/common/input_messages.h"
#include "content/common/site_isolation_policy.h"
#include "third_party/WebKit/public/web/WebSandboxFlags.h"
@@ -369,23 +370,33 @@ void FrameTree::FrameRemoved(FrameTreeNode* frame) {
on_frame_removed_.Run(frame->current_frame_host());
}
-void FrameTree::UpdateLoadProgress() {
+void FrameTree::UpdateLoadProgress(FrameTreeNode* frame) {
double progress = 0.0;
- int frame_count = 0;
-
- for (FrameTreeNode* node : Nodes()) {
- // Ignore the current frame if it has not started loading.
- if (!node->has_started_loading())
- continue;
-
- // Collect progress.
- progress += node->loading_progress();
- frame_count++;
+ ProgressBarCompletionOptions options = GetProgressBarCompletionOptions();
+ if (options == ProgressBarCompletionOptions::DOM_CONTENT_LOADED ||
+ options == ProgressBarCompletionOptions::RESOURCES_BEFORE_DCL) {
kinuko 2016/06/08 14:26:29 nit: slightly prefer switch/case than if/else for
Nate Chapin 2016/06/14 22:51:46 Done.
+ if (frame->IsMainFrame() && frame->has_started_loading())
dcheng 2016/06/08 06:54:17 I wonder if we really need to pass in |frame| here
Nate Chapin 2016/06/14 22:51:46 True. Done.
+ progress = frame->loading_progress();
+ } else {
+ int frame_count = 0;
+ for (FrameTreeNode* node : Nodes()) {
+ // Ignore the current frame if it has not started loading.
+ if (!node->has_started_loading())
+ continue;
+ if (options == ProgressBarCompletionOptions::
+ RESOURCES_BEFORE_DCL_AND_SAME_ORIGIN_IFRAMES &&
+ (!node->HasSameOrigin(*root_) ||
+ node->current_url() == GURL(url::kAboutBlankURL)))
+ continue;
+
+ // Collect progress.
+ progress += node->loading_progress();
+ frame_count++;
+ }
+ if (frame_count != 0)
+ progress /= frame_count;
}
- if (frame_count != 0)
- progress /= frame_count;
-
if (progress <= load_progress_)
return;
load_progress_ = progress;

Powered by Google App Engine
This is Rietveld 408576698