| 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_) {
|
|
|