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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 720633003: Revert of CL 722703002 due to build breakage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert Created 6 years, 1 month 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 "chrome/browser/ui/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_restore_service.h" 10 #include "apps/app_restore_service.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/shell_integration.h" 50 #include "chrome/browser/shell_integration.h"
51 #include "chrome/browser/signin/signin_promo.h" 51 #include "chrome/browser/signin/signin_promo.h"
52 #include "chrome/browser/ui/app_list/app_list_service.h" 52 #include "chrome/browser/ui/app_list/app_list_service.h"
53 #include "chrome/browser/ui/browser_commands.h" 53 #include "chrome/browser/ui/browser_commands.h"
54 #include "chrome/browser/ui/browser_finder.h" 54 #include "chrome/browser/ui/browser_finder.h"
55 #include "chrome/browser/ui/browser_list.h" 55 #include "chrome/browser/ui/browser_list.h"
56 #include "chrome/browser/ui/browser_navigator.h" 56 #include "chrome/browser/ui/browser_navigator.h"
57 #include "chrome/browser/ui/browser_tabrestore.h" 57 #include "chrome/browser/ui/browser_tabrestore.h"
58 #include "chrome/browser/ui/browser_tabstrip.h" 58 #include "chrome/browser/ui/browser_tabstrip.h"
59 #include "chrome/browser/ui/browser_window.h" 59 #include "chrome/browser/ui/browser_window.h"
60 #include "chrome/browser/ui/extensions/app_launch_params.h"
61 #include "chrome/browser/ui/extensions/application_launch.h" 60 #include "chrome/browser/ui/extensions/application_launch.h"
62 #include "chrome/browser/ui/host_desktop.h" 61 #include "chrome/browser/ui/host_desktop.h"
63 #include "chrome/browser/ui/startup/autolaunch_prompt.h" 62 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
64 #include "chrome/browser/ui/startup/bad_flags_prompt.h" 63 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
65 #include "chrome/browser/ui/startup/default_browser_prompt.h" 64 #include "chrome/browser/ui/startup/default_browser_prompt.h"
66 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" 65 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h"
67 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" 66 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h"
68 #include "chrome/browser/ui/startup/session_crashed_bubble.h" 67 #include "chrome/browser/ui/startup/session_crashed_bubble.h"
69 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" 68 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h"
70 #include "chrome/browser/ui/startup/startup_browser_creator.h" 69 #include "chrome/browser/ui/startup/startup_browser_creator.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return true; 329 return true;
331 330
332 if (command_line_.HasSwitch(switches::kAppId)) { 331 if (command_line_.HasSwitch(switches::kAppId)) {
333 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); 332 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId);
334 const Extension* extension = GetPlatformApp(profile, app_id); 333 const Extension* extension = GetPlatformApp(profile, app_id);
335 // If |app_id| is a disabled or terminated platform app we handle it 334 // If |app_id| is a disabled or terminated platform app we handle it
336 // specially here, otherwise it will be handled below. 335 // specially here, otherwise it will be handled below.
337 if (extension) { 336 if (extension) {
338 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); 337 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP);
339 AppLaunchParams params(profile, extension, 338 AppLaunchParams params(profile, extension,
340 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW, 339 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW);
341 extensions::SOURCE_COMMAND_LINE);
342 params.command_line = command_line_; 340 params.command_line = command_line_;
343 params.current_directory = cur_dir_; 341 params.current_directory = cur_dir_;
344 // If we are being launched from the command line, default to native 342 // If we are being launched from the command line, default to native
345 // desktop. 343 // desktop.
346 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; 344 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
347 OpenApplicationWithReenablePrompt(params); 345 OpenApplicationWithReenablePrompt(params);
348 return true; 346 return true;
349 } 347 }
350 } 348 }
351 349
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 const Extension* extension; 417 const Extension* extension;
420 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) 418 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container))
421 return false; 419 return false;
422 420
423 // If the user doesn't want to open a tab, fail. 421 // If the user doesn't want to open a tab, fail.
424 if (launch_container != extensions::LAUNCH_CONTAINER_TAB) 422 if (launch_container != extensions::LAUNCH_CONTAINER_TAB)
425 return false; 423 return false;
426 424
427 RecordCmdLineAppHistogram(extension->GetType()); 425 RecordCmdLineAppHistogram(extension->GetType());
428 426
429 WebContents* app_tab = OpenApplication( 427 WebContents* app_tab = OpenApplication(AppLaunchParams(
430 AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_TAB, 428 profile, extension, extensions::LAUNCH_CONTAINER_TAB,
431 NEW_FOREGROUND_TAB, extensions::SOURCE_COMMAND_LINE)); 429 NEW_FOREGROUND_TAB));
432 return (app_tab != NULL); 430 return (app_tab != NULL);
433 } 431 }
434 432
435 bool StartupBrowserCreatorImpl::OpenApplicationWindow( 433 bool StartupBrowserCreatorImpl::OpenApplicationWindow(
436 Profile* profile, 434 Profile* profile,
437 content::WebContents** out_app_contents) { 435 content::WebContents** out_app_contents) {
438 // Set |out_app_contents| to NULL early on (just in case). 436 // Set |out_app_contents| to NULL early on (just in case).
439 if (out_app_contents) 437 if (out_app_contents)
440 *out_app_contents = NULL; 438 *out_app_contents = NULL;
441 439
(...skipping 13 matching lines...) Expand all
455 453
456 // TODO(skerner): Could pass in |extension| and |launch_container|, 454 // TODO(skerner): Could pass in |extension| and |launch_container|,
457 // and avoid calling GetAppLaunchContainer() both here and in 455 // and avoid calling GetAppLaunchContainer() both here and in
458 // OpenApplicationTab(). 456 // OpenApplicationTab().
459 457
460 if (launch_container == extensions::LAUNCH_CONTAINER_TAB) 458 if (launch_container == extensions::LAUNCH_CONTAINER_TAB)
461 return false; 459 return false;
462 460
463 RecordCmdLineAppHistogram(extension->GetType()); 461 RecordCmdLineAppHistogram(extension->GetType());
464 462
465 AppLaunchParams params(profile, extension, launch_container, NEW_WINDOW, 463 AppLaunchParams params(profile, extension, launch_container, NEW_WINDOW);
466 extensions::SOURCE_COMMAND_LINE);
467 params.command_line = command_line_; 464 params.command_line = command_line_;
468 params.current_directory = cur_dir_; 465 params.current_directory = cur_dir_;
469 WebContents* tab_in_app_window = OpenApplication(params); 466 WebContents* tab_in_app_window = OpenApplication(params);
470 467
471 if (out_app_contents) 468 if (out_app_contents)
472 *out_app_contents = tab_in_app_window; 469 *out_app_contents = tab_in_app_window;
473 470
474 // Platform apps fire off a launch event which may or may not open a window. 471 // Platform apps fire off a launch event which may or may not open a window.
475 return (tab_in_app_window != NULL || CanLaunchViaEvent(extension)); 472 return (tab_in_app_window != NULL || CanLaunchViaEvent(extension));
476 } 473 }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 // behavior is desired because completing or skipping the sync promo 902 // behavior is desired because completing or skipping the sync promo
906 // causes a redirect to the NTP. 903 // causes a redirect to the NTP.
907 if (!startup_urls->empty() && 904 if (!startup_urls->empty() &&
908 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) 905 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL))
909 startup_urls->at(0) = sync_promo_url; 906 startup_urls->at(0) = sync_promo_url;
910 else 907 else
911 startup_urls->insert(startup_urls->begin(), sync_promo_url); 908 startup_urls->insert(startup_urls->begin(), sync_promo_url);
912 } 909 }
913 } 910 }
914 } 911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698