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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/api/app_window/app_window_api.h" 5 #include "extensions/browser/api/app_window/app_window_api.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 #include "content/public/browser/notification_types.h" 13 #include "content/public/browser/notification_types.h"
14 #include "content/public/browser/render_frame_host.h" 14 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/content_switches.h"
17 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
18 #include "extensions/browser/app_window/app_window.h" 19 #include "extensions/browser/app_window/app_window.h"
19 #include "extensions/browser/app_window/app_window_client.h" 20 #include "extensions/browser/app_window/app_window_client.h"
20 #include "extensions/browser/app_window/app_window_contents.h" 21 #include "extensions/browser/app_window/app_window_contents.h"
21 #include "extensions/browser/app_window/app_window_registry.h" 22 #include "extensions/browser/app_window/app_window_registry.h"
22 #include "extensions/browser/app_window/native_app_window.h" 23 #include "extensions/browser/app_window/native_app_window.h"
23 #include "extensions/browser/extensions_browser_client.h" 24 #include "extensions/browser/extensions_browser_client.h"
24 #include "extensions/common/api/app_window.h" 25 #include "extensions/common/api/app_window.h"
25 #include "extensions/common/features/simple_feature.h" 26 #include "extensions/common/features/simple_feature.h"
26 #include "extensions/common/image_util.h" 27 #include "extensions/common/image_util.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 SetResult(result); 361 SetResult(result);
361 362
362 if (AppWindowRegistry::Get(browser_context()) 363 if (AppWindowRegistry::Get(browser_context())
363 ->HadDevToolsAttached(app_window->web_contents())) { 364 ->HadDevToolsAttached(app_window->web_contents())) {
364 AppWindowClient::Get()->OpenDevToolsWindow( 365 AppWindowClient::Get()->OpenDevToolsWindow(
365 app_window->web_contents(), 366 app_window->web_contents(),
366 base::Bind(&AppWindowCreateFunction::SendResponse, this, true)); 367 base::Bind(&AppWindowCreateFunction::SendResponse, this, true));
367 return true; 368 return true;
368 } 369 }
369 370
371 // PlzNavigate: delay sending the response until the newly created window has
372 // been told to navigate, and blink has been correctly initialized in the
373 // renderer.
374 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
375 ::switches::kEnableBrowserSideNavigation)) {
376 app_window->SetOnFirstCommitCallback(
377 base::Bind(&AppWindowCreateFunction::SendResponse, this, true));
378 return true;
379 }
380
370 SendResponse(true); 381 SendResponse(true);
371 app_window->WindowEventsReady(); 382 app_window->WindowEventsReady();
372 383
373 return true; 384 return true;
374 } 385 }
375 386
376 bool AppWindowCreateFunction::GetBoundsSpec( 387 bool AppWindowCreateFunction::GetBoundsSpec(
377 const app_window::CreateWindowOptions& options, 388 const app_window::CreateWindowOptions& options,
378 AppWindow::CreateParams* params, 389 AppWindow::CreateParams* params,
379 std::string* error) { 390 std::string* error) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 559
549 if (options.frame->as_frame_options->inactive_color.get()) { 560 if (options.frame->as_frame_options->inactive_color.get()) {
550 error_ = app_window_constants::kInactiveColorWithoutColor; 561 error_ = app_window_constants::kInactiveColorWithoutColor;
551 return false; 562 return false;
552 } 563 }
553 564
554 return true; 565 return true;
555 } 566 }
556 567
557 } // namespace extensions 568 } // namespace extensions
OLDNEW
« no previous file with comments | « content/test/web_contents_observer_sanity_checker.cc ('k') | extensions/browser/app_window/app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698