| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 const Extension* extension; | 425 const Extension* extension; |
| 426 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) | 426 if (!GetAppLaunchContainer(profile, app_id, &extension, &launch_container)) |
| 427 return false; | 427 return false; |
| 428 | 428 |
| 429 // If the user doesn't want to open a tab, fail. | 429 // If the user doesn't want to open a tab, fail. |
| 430 if (launch_container != extension_misc::LAUNCH_TAB) | 430 if (launch_container != extension_misc::LAUNCH_TAB) |
| 431 return false; | 431 return false; |
| 432 | 432 |
| 433 RecordCmdLineAppHistogram(); | 433 RecordCmdLineAppHistogram(); |
| 434 | 434 |
| 435 WebContents* app_tab = application_launch::OpenApplicationTab( | 435 WebContents* app_tab = application_launch::OpenApplication( |
| 436 profile, extension, GURL(), NEW_FOREGROUND_TAB); | 436 application_launch::LaunchParams(profile, extension, |
| 437 extension_misc::LAUNCH_TAB, NEW_FOREGROUND_TAB)); |
| 437 return (app_tab != NULL); | 438 return (app_tab != NULL); |
| 438 } | 439 } |
| 439 | 440 |
| 440 bool StartupBrowserCreatorImpl::OpenApplicationWindow( | 441 bool StartupBrowserCreatorImpl::OpenApplicationWindow( |
| 441 Profile* profile, | 442 Profile* profile, |
| 442 content::WebContents** out_app_contents) { | 443 content::WebContents** out_app_contents) { |
| 443 // Set |out_app_contents| to NULL early on (just in case). | 444 // Set |out_app_contents| to NULL early on (just in case). |
| 444 if (out_app_contents) | 445 if (out_app_contents) |
| 445 *out_app_contents = NULL; | 446 *out_app_contents = NULL; |
| 446 | 447 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 460 | 461 |
| 461 // TODO(skerner): Could pass in |extension| and |launch_container|, | 462 // TODO(skerner): Could pass in |extension| and |launch_container|, |
| 462 // and avoid calling GetAppLaunchContainer() both here and in | 463 // and avoid calling GetAppLaunchContainer() both here and in |
| 463 // OpenApplicationTab(). | 464 // OpenApplicationTab(). |
| 464 | 465 |
| 465 if (launch_container == extension_misc::LAUNCH_TAB) | 466 if (launch_container == extension_misc::LAUNCH_TAB) |
| 466 return false; | 467 return false; |
| 467 | 468 |
| 468 RecordCmdLineAppHistogram(); | 469 RecordCmdLineAppHistogram(); |
| 469 | 470 |
| 471 application_launch::LaunchParams params(profile, extension, |
| 472 launch_container, NEW_WINDOW); |
| 473 params.command_line = &command_line_; |
| 470 WebContents* tab_in_app_window = application_launch::OpenApplication( | 474 WebContents* tab_in_app_window = application_launch::OpenApplication( |
| 471 profile, extension, launch_container, GURL(), NEW_WINDOW, | 475 params); |
| 472 &command_line_); | |
| 473 | 476 |
| 474 if (out_app_contents) | 477 if (out_app_contents) |
| 475 *out_app_contents = tab_in_app_window; | 478 *out_app_contents = tab_in_app_window; |
| 476 | 479 |
| 477 // Platform apps fire off a launch event which may or may not open a window. | 480 // Platform apps fire off a launch event which may or may not open a window. |
| 478 return (tab_in_app_window != NULL || extension->is_platform_app()); | 481 return (tab_in_app_window != NULL || extension->is_platform_app()); |
| 479 } | 482 } |
| 480 | 483 |
| 481 if (url_string.empty()) | 484 if (url_string.empty()) |
| 482 return false; | 485 return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 494 url.SchemeIs(chrome::kFileScheme)) { | 497 url.SchemeIs(chrome::kFileScheme)) { |
| 495 if (profile->GetExtensionService()->IsInstalledApp(url)) { | 498 if (profile->GetExtensionService()->IsInstalledApp(url)) { |
| 496 RecordCmdLineAppHistogram(); | 499 RecordCmdLineAppHistogram(); |
| 497 } else { | 500 } else { |
| 498 AppLauncherHandler::RecordAppLaunchType( | 501 AppLauncherHandler::RecordAppLaunchType( |
| 499 extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY); | 502 extension_misc::APP_LAUNCH_CMD_LINE_APP_LEGACY); |
| 500 } | 503 } |
| 501 | 504 |
| 502 WebContents* app_tab = application_launch::OpenAppShortcutWindow( | 505 WebContents* app_tab = application_launch::OpenAppShortcutWindow( |
| 503 profile, | 506 profile, |
| 504 url, | 507 url); |
| 505 true); // Update app info. | |
| 506 | 508 |
| 507 if (out_app_contents) | 509 if (out_app_contents) |
| 508 *out_app_contents = app_tab; | 510 *out_app_contents = app_tab; |
| 509 | 511 |
| 510 return (app_tab != NULL); | 512 return (app_tab != NULL); |
| 511 } | 513 } |
| 512 } | 514 } |
| 513 return false; | 515 return false; |
| 514 } | 516 } |
| 515 | 517 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 // New: | 903 // New: |
| 902 prefs->GetString(prefs::kHomePage), | 904 prefs->GetString(prefs::kHomePage), |
| 903 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), | 905 prefs->GetBoolean(prefs::kHomePageIsNewTabPage), |
| 904 prefs->GetBoolean(prefs::kShowHomeButton), | 906 prefs->GetBoolean(prefs::kShowHomeButton), |
| 905 // Backup: | 907 // Backup: |
| 906 backup_homepage, | 908 backup_homepage, |
| 907 backup_homepage_is_ntp, | 909 backup_homepage_is_ntp, |
| 908 backup_show_home_button)); | 910 backup_show_home_button)); |
| 909 } | 911 } |
| 910 } | 912 } |
| OLD | NEW |