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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
| 7 #include "base/base_paths.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/cpu.h" | 9 #include "base/cpu.h" |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
14 #include "base/metrics/stats_counters.h" | 15 #include "base/metrics/stats_counters.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/process/memory.h" | 17 #include "base/process/memory.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 470 |
470 diagnostics::DiagnosticsWriter writer(format); | 471 diagnostics::DiagnosticsWriter writer(format); |
471 *exit_code = diagnostics::DiagnosticsController::GetInstance()->Run( | 472 *exit_code = diagnostics::DiagnosticsController::GetInstance()->Run( |
472 command_line, &writer); | 473 command_line, &writer); |
473 diagnostics::DiagnosticsController::GetInstance()->ClearResults(); | 474 diagnostics::DiagnosticsController::GetInstance()->ClearResults(); |
474 return true; | 475 return true; |
475 } | 476 } |
476 #endif | 477 #endif |
477 | 478 |
478 #if defined(OS_CHROMEOS) | 479 #if defined(OS_CHROMEOS) |
| 480 // Initialize primary user homedir (in multi-profile session) as it may be |
| 481 // passed as a command line switch. |
| 482 base::FilePath homedir; |
| 483 if (command_line.HasSwitch(chromeos::switches::kHomedir)) { |
| 484 homedir = base::FilePath( |
| 485 command_line.GetSwitchValueASCII(chromeos::switches::kHomedir)); |
| 486 PathService::OverrideAndCreateIfNeeded( |
| 487 base::DIR_HOME, homedir, true, false); |
| 488 } |
| 489 |
479 // If we are recovering from a crash on ChromeOS, then we will do some | 490 // If we are recovering from a crash on ChromeOS, then we will do some |
480 // recovery using the diagnostics module, and then continue on. We fake up a | 491 // recovery using the diagnostics module, and then continue on. We fake up a |
481 // command line to tell it that we want it to recover, and to preserve the | 492 // command line to tell it that we want it to recover, and to preserve the |
482 // original command line. | 493 // original command line. |
483 if (command_line.HasSwitch(chromeos::switches::kLoginUser) || | 494 if (command_line.HasSwitch(chromeos::switches::kLoginUser) || |
484 command_line.HasSwitch(switches::kDiagnosticsRecovery)) { | 495 command_line.HasSwitch(switches::kDiagnosticsRecovery)) { |
485 | 496 |
486 // The statistics subsystem needs get initialized soon enough for the | 497 // The statistics subsystem needs get initialized soon enough for the |
487 // statistics to be collected. It's safe to call this more than once. | 498 // statistics to be collected. It's safe to call this more than once. |
488 base::StatisticsRecorder::Initialize(); | 499 base::StatisticsRecorder::Initialize(); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 } | 920 } |
910 | 921 |
911 content::ContentUtilityClient* | 922 content::ContentUtilityClient* |
912 ChromeMainDelegate::CreateContentUtilityClient() { | 923 ChromeMainDelegate::CreateContentUtilityClient() { |
913 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 924 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
914 return NULL; | 925 return NULL; |
915 #else | 926 #else |
916 return g_chrome_content_utility_client.Pointer(); | 927 return g_chrome_content_utility_client.Pointer(); |
917 #endif | 928 #endif |
918 } | 929 } |
OLD | NEW |