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

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

Issue 722703002: Make "source" a required argument of AppLaunchParams and fill in the argument in all call points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
60 #include "chrome/browser/ui/extensions/application_launch.h" 61 #include "chrome/browser/ui/extensions/application_launch.h"
61 #include "chrome/browser/ui/host_desktop.h" 62 #include "chrome/browser/ui/host_desktop.h"
62 #include "chrome/browser/ui/startup/autolaunch_prompt.h" 63 #include "chrome/browser/ui/startup/autolaunch_prompt.h"
63 #include "chrome/browser/ui/startup/bad_flags_prompt.h" 64 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
64 #include "chrome/browser/ui/startup/default_browser_prompt.h" 65 #include "chrome/browser/ui/startup/default_browser_prompt.h"
65 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h" 66 #include "chrome/browser/ui/startup/google_api_keys_infobar_delegate.h"
66 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" 67 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h"
67 #include "chrome/browser/ui/startup/session_crashed_bubble.h" 68 #include "chrome/browser/ui/startup/session_crashed_bubble.h"
68 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h" 69 #include "chrome/browser/ui/startup/session_crashed_infobar_delegate.h"
69 #include "chrome/browser/ui/startup/startup_browser_creator.h" 70 #include "chrome/browser/ui/startup/startup_browser_creator.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return true; 333 return true;
333 334
334 if (command_line_.HasSwitch(switches::kAppId)) { 335 if (command_line_.HasSwitch(switches::kAppId)) {
335 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId); 336 std::string app_id = command_line_.GetSwitchValueASCII(switches::kAppId);
336 const Extension* extension = GetPlatformApp(profile, app_id); 337 const Extension* extension = GetPlatformApp(profile, app_id);
337 // If |app_id| is a disabled or terminated platform app we handle it 338 // If |app_id| is a disabled or terminated platform app we handle it
338 // specially here, otherwise it will be handled below. 339 // specially here, otherwise it will be handled below.
339 if (extension) { 340 if (extension) {
340 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP); 341 RecordCmdLineAppHistogram(extensions::Manifest::TYPE_PLATFORM_APP);
341 AppLaunchParams params(profile, extension, 342 AppLaunchParams params(profile, extension,
342 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW); 343 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW,
344 extensions::SOURCE_COMMAND_LINE);
343 params.command_line = command_line_; 345 params.command_line = command_line_;
344 params.current_directory = cur_dir_; 346 params.current_directory = cur_dir_;
345 // If we are being launched from the command line, default to native 347 // If we are being launched from the command line, default to native
346 // desktop. 348 // desktop.
347 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; 349 params.desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
348 OpenApplicationWithReenablePrompt(params); 350 OpenApplicationWithReenablePrompt(params);
349 return true; 351 return true;
350 } 352 }
351 } 353 }
352 354
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 const Extension* extension; 422 const Extension* extension;
421 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) 423 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container))
422 return false; 424 return false;
423 425
424 // If the user doesn't want to open a tab, fail. 426 // If the user doesn't want to open a tab, fail.
425 if (launch_container != extensions::LAUNCH_CONTAINER_TAB) 427 if (launch_container != extensions::LAUNCH_CONTAINER_TAB)
426 return false; 428 return false;
427 429
428 RecordCmdLineAppHistogram(extension->GetType()); 430 RecordCmdLineAppHistogram(extension->GetType());
429 431
430 WebContents* app_tab = OpenApplication(AppLaunchParams( 432 WebContents* app_tab = OpenApplication(
431 profile, extension, extensions::LAUNCH_CONTAINER_TAB, 433 AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_TAB,
432 NEW_FOREGROUND_TAB)); 434 NEW_FOREGROUND_TAB, extensions::SOURCE_COMMAND_LINE));
433 return (app_tab != NULL); 435 return (app_tab != NULL);
434 } 436 }
435 437
436 bool StartupBrowserCreatorImpl::OpenApplicationWindow( 438 bool StartupBrowserCreatorImpl::OpenApplicationWindow(
437 Profile* profile, 439 Profile* profile,
438 content::WebContents** out_app_contents) { 440 content::WebContents** out_app_contents) {
439 // Set |out_app_contents| to NULL early on (just in case). 441 // Set |out_app_contents| to NULL early on (just in case).
440 if (out_app_contents) 442 if (out_app_contents)
441 *out_app_contents = NULL; 443 *out_app_contents = NULL;
442 444
(...skipping 13 matching lines...) Expand all
456 458
457 // TODO(skerner): Could pass in |extension| and |launch_container|, 459 // TODO(skerner): Could pass in |extension| and |launch_container|,
458 // and avoid calling GetAppLaunchContainer() both here and in 460 // and avoid calling GetAppLaunchContainer() both here and in
459 // OpenApplicationTab(). 461 // OpenApplicationTab().
460 462
461 if (launch_container == extensions::LAUNCH_CONTAINER_TAB) 463 if (launch_container == extensions::LAUNCH_CONTAINER_TAB)
462 return false; 464 return false;
463 465
464 RecordCmdLineAppHistogram(extension->GetType()); 466 RecordCmdLineAppHistogram(extension->GetType());
465 467
466 AppLaunchParams params(profile, extension, launch_container, NEW_WINDOW); 468 AppLaunchParams params(profile, extension, launch_container, NEW_WINDOW,
469 extensions::SOURCE_COMMAND_LINE);
467 params.command_line = command_line_; 470 params.command_line = command_line_;
468 params.current_directory = cur_dir_; 471 params.current_directory = cur_dir_;
469 WebContents* tab_in_app_window = OpenApplication(params); 472 WebContents* tab_in_app_window = OpenApplication(params);
470 473
471 if (out_app_contents) 474 if (out_app_contents)
472 *out_app_contents = tab_in_app_window; 475 *out_app_contents = tab_in_app_window;
473 476
474 // Platform apps fire off a launch event which may or may not open a window. 477 // Platform apps fire off a launch event which may or may not open a window.
475 return (tab_in_app_window != NULL || CanLaunchViaEvent(extension)); 478 return (tab_in_app_window != NULL || CanLaunchViaEvent(extension));
476 } 479 }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 // behavior is desired because completing or skipping the sync promo 908 // behavior is desired because completing or skipping the sync promo
906 // causes a redirect to the NTP. 909 // causes a redirect to the NTP.
907 if (!startup_urls->empty() && 910 if (!startup_urls->empty() &&
908 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL)) 911 startup_urls->at(0) == GURL(chrome::kChromeUINewTabURL))
909 startup_urls->at(0) = sync_promo_url; 912 startup_urls->at(0) = sync_promo_url;
910 else 913 else
911 startup_urls->insert(startup_urls->begin(), sync_promo_url); 914 startup_urls->insert(startup_urls->begin(), sync_promo_url);
912 } 915 }
913 } 916 }
914 } 917 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698