| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } else { | 430 } else { |
| 431 UMA_HISTOGRAM_LONG_TIMES( | 431 UMA_HISTOGRAM_LONG_TIMES( |
| 432 "Startup.WarmStartTimeFromRemoteProcessStart", elapsed); | 432 "Startup.WarmStartTimeFromRemoteProcessStart", elapsed); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 | 436 |
| 437 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( | 437 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( |
| 438 command_line); | 438 command_line); |
| 439 | 439 |
| 440 // TODO(erikwright): Consider removing this - AFAIK it is no longer used. | |
| 441 // Handle the --uninstall-extension startup action. This needs to done here in | |
| 442 // the process that is running with the target profile, otherwise the | |
| 443 // uninstall will fail to unload and remove all components. | |
| 444 if (command_line.HasSwitch(switches::kUninstallExtension)) { | |
| 445 // The uninstall extension switch can't be combined with the profile | |
| 446 // directory switch. | |
| 447 DCHECK(!command_line.HasSwitch(switches::kProfileDirectory)); | |
| 448 | |
| 449 Profile* profile = ProfileManager::GetLastUsedProfile(); | |
| 450 if (!profile) { | |
| 451 // We should never be called before the profile has been created. | |
| 452 NOTREACHED(); | |
| 453 return true; | |
| 454 } | |
| 455 | |
| 456 extensions::StartupHelper extension_startup_helper; | |
| 457 extension_startup_helper.UninstallExtension(command_line, profile); | |
| 458 return true; | |
| 459 } | |
| 460 | |
| 461 base::FilePath user_data_dir = | 440 base::FilePath user_data_dir = |
| 462 g_browser_process->profile_manager()->user_data_dir(); | 441 g_browser_process->profile_manager()->user_data_dir(); |
| 463 base::FilePath startup_profile_dir = | 442 base::FilePath startup_profile_dir = |
| 464 GetStartupProfilePath(user_data_dir, command_line); | 443 GetStartupProfilePath(user_data_dir, command_line); |
| 465 | 444 |
| 466 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | 445 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| 467 command_line, current_directory, startup_profile_dir); | 446 command_line, current_directory, startup_profile_dir); |
| 468 return true; | 447 return true; |
| 469 } | 448 } |
| 470 #endif // !defined(OS_ANDROID) | 449 #endif // !defined(OS_ANDROID) |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 | 1416 |
| 1438 HandleTestParameters(parsed_command_line()); | 1417 HandleTestParameters(parsed_command_line()); |
| 1439 browser_process_->metrics_service()->RecordBreakpadHasDebugger( | 1418 browser_process_->metrics_service()->RecordBreakpadHasDebugger( |
| 1440 base::debug::BeingDebugged()); | 1419 base::debug::BeingDebugged()); |
| 1441 | 1420 |
| 1442 language_usage_metrics::LanguageUsageMetrics::RecordAcceptLanguages( | 1421 language_usage_metrics::LanguageUsageMetrics::RecordAcceptLanguages( |
| 1443 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 1422 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
| 1444 language_usage_metrics::LanguageUsageMetrics::RecordApplicationLanguage( | 1423 language_usage_metrics::LanguageUsageMetrics::RecordApplicationLanguage( |
| 1445 browser_process_->GetApplicationLocale()); | 1424 browser_process_->GetApplicationLocale()); |
| 1446 | 1425 |
| 1447 // The extension service may be available at this point. If the command line | |
| 1448 // specifies --uninstall-extension, attempt the uninstall extension startup | |
| 1449 // action. | |
| 1450 if (parsed_command_line().HasSwitch(switches::kUninstallExtension)) { | |
| 1451 extensions::StartupHelper extension_startup_helper; | |
| 1452 if (extension_startup_helper.UninstallExtension( | |
| 1453 parsed_command_line(), profile_)) | |
| 1454 return content::RESULT_CODE_NORMAL_EXIT; | |
| 1455 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; | |
| 1456 } | |
| 1457 | |
| 1458 // Start watching for hangs during startup. We disarm this hang detector when | 1426 // Start watching for hangs during startup. We disarm this hang detector when |
| 1459 // ThreadWatcher takes over or when browser is shutdown or when | 1427 // ThreadWatcher takes over or when browser is shutdown or when |
| 1460 // startup_watcher_ is deleted. | 1428 // startup_watcher_ is deleted. |
| 1461 MetricsService::SetExecutionPhase(MetricsService::STARTUP_TIMEBOMB_ARM); | 1429 MetricsService::SetExecutionPhase(MetricsService::STARTUP_TIMEBOMB_ARM); |
| 1462 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1430 startup_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
| 1463 | 1431 |
| 1464 // On mobile, need for clean shutdown arises only when the application comes | 1432 // On mobile, need for clean shutdown arises only when the application comes |
| 1465 // to foreground (i.e. MetricsService::OnAppEnterForeground is called). | 1433 // to foreground (i.e. MetricsService::OnAppEnterForeground is called). |
| 1466 // http://crbug.com/179143 | 1434 // http://crbug.com/179143 |
| 1467 #if !defined(OS_ANDROID) | 1435 #if !defined(OS_ANDROID) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 chromeos::CrosSettings::Shutdown(); | 1679 chromeos::CrosSettings::Shutdown(); |
| 1712 #endif | 1680 #endif |
| 1713 #endif | 1681 #endif |
| 1714 } | 1682 } |
| 1715 | 1683 |
| 1716 // Public members: | 1684 // Public members: |
| 1717 | 1685 |
| 1718 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1686 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1719 chrome_extra_parts_.push_back(parts); | 1687 chrome_extra_parts_.push_back(parts); |
| 1720 } | 1688 } |
| OLD | NEW |