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