| 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..7d84438aa58f9a6ed5b2cf9191705951739ca4bd 100644
|
| --- a/extensions/browser/app_window/app_window.cc
|
| +++ b/extensions/browser/app_window/app_window.cc
|
| @@ -11,6 +11,8 @@
|
| #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 +444,26 @@ void AppWindow::DidFirstVisuallyNonEmptyPaint() {
|
| }
|
| }
|
|
|
| +void AppWindow::SetOnFirstCommitCallback(base::Callback<void(void)> callback) {
|
| + on_first_commit_callback_ = callback;
|
| +}
|
| +
|
| +void AppWindow::OnFirstCommit() {
|
| + 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::AboutToCommitNavigation 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,
|
| + on_first_commit_callback_);
|
| + on_first_commit_callback_.Reset();
|
| +}
|
| +
|
| void AppWindow::OnNativeClose() {
|
| AppWindowRegistry::Get(browser_context_)->RemoveAppWindow(this);
|
| if (app_window_contents_) {
|
|
|