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

Unified Diff: extensions/browser/api/app_window/app_window_api.cc

Issue 1340163002: PlzNavigate: fix timing issue in app window creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-throttle
Patch Set: Created 5 years, 3 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: extensions/browser/api/app_window/app_window_api.cc
diff --git a/extensions/browser/api/app_window/app_window_api.cc b/extensions/browser/api/app_window/app_window_api.cc
index 2cd0710b7f5d05df23e8d0eeea88f9c3d0f538a1..71241923ec8527fe51d6b8d02f165129f9b0eebb 100644
--- a/extensions/browser/api/app_window/app_window_api.cc
+++ b/extensions/browser/api/app_window/app_window_api.cc
@@ -14,6 +14,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_client.h"
@@ -367,6 +368,16 @@ bool AppWindowCreateFunction::RunAsync() {
return true;
}
+ // PlzNavigate: delay sending the response until the newly created window has
+ // been told to navigate, and blink has been correctly initialized in the
+ // renderer.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kEnableBrowserSideNavigation)) {
nasko 2015/09/16 20:19:36 nit: Is the extra :: in front of switches required
clamy 2015/09/16 21:32:34 Yes, otherwise it tries to resolve the namespace t
+ app_window->SetOnFirstCommitCallback(
+ base::Bind(&AppWindowCreateFunction::SendResponse, this, true));
+ return true;
+ }
+
SendResponse(true);
app_window->WindowEventsReady();

Powered by Google App Engine
This is Rietveld 408576698