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

Unified Diff: extensions/browser/app_window/app_window.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: Addressed nits 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
« no previous file with comments | « extensions/browser/app_window/app_window.h ('k') | extensions/browser/app_window/app_window_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/app_window/app_window.cc
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc
index b6d7754c56a47124255bc3365a36b470696500b1..5925bcc98ffdce9000076ccfdaefdce2087e83ad 100644
--- a/extensions/browser/app_window/app_window.cc
+++ b/extensions/browser/app_window/app_window.cc
@@ -8,9 +8,12 @@
#include <string>
#include <vector>
+#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_context.h"
@@ -442,6 +445,26 @@ void AppWindow::DidFirstVisuallyNonEmptyPaint() {
}
}
+void AppWindow::SetOnFirstCommitCallback(const base::Closure& callback) {
+ DCHECK(on_first_commit_callback_.is_null());
+ on_first_commit_callback_ = callback;
+}
+
+void AppWindow::OnReadyToCommitFirstNavigation() {
+ CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kEnableBrowserSideNavigation));
+ WindowEventsReady();
+ if (on_first_commit_callback_.is_null())
+ return;
+ // It is important that the callback executes after the calls to
+ // WebContentsObserver::ReadyToCommitNavigation have been processed. The
+ // CommitNavigation IPC that will properly set up the renderer will only be
+ // sent after these, and it must be sent before the callback gets to run,
+ // hence the use of PostTask.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::ResetAndReturn(&on_first_commit_callback_));
+}
+
void AppWindow::OnNativeClose() {
AppWindowRegistry::Get(browser_context_)->RemoveAppWindow(this);
if (app_window_contents_) {
« no previous file with comments | « extensions/browser/app_window/app_window.h ('k') | extensions/browser/app_window/app_window_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698