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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" |
8 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/metrics/statistics_recorder.h" | 12 #include "base/metrics/statistics_recorder.h" |
12 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/process/memory.h" | 15 #include "base/process/memory.h" |
15 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 InitMacCrashReporter(command_line, process_type); | 602 InitMacCrashReporter(command_line, process_type); |
602 #endif | 603 #endif |
603 | 604 |
604 #if defined(OS_WIN) | 605 #if defined(OS_WIN) |
605 child_process_logging::Init(); | 606 child_process_logging::Init(); |
606 #endif | 607 #endif |
607 | 608 |
608 // Notice a user data directory override if any | 609 // Notice a user data directory override if any |
609 base::FilePath user_data_dir = | 610 base::FilePath user_data_dir = |
610 command_line.GetSwitchValuePath(switches::kUserDataDir); | 611 command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 612 #if defined(OS_LINUX) |
| 613 // On Linux, Chrome does not support running multiple copies under different |
| 614 // DISPLAYs, so the profile directory can be specified in the environment to |
| 615 // support the virtual desktop use-case. |
| 616 if (user_data_dir.empty()) { |
| 617 std::string user_data_dir_string; |
| 618 scoped_ptr<base::Environment> environment(base::Environment::Create()); |
| 619 if (environment->GetVar("CHROME_USER_DATA_DIR", &user_data_dir_string) && |
| 620 IsStringUTF8(user_data_dir_string)) { |
| 621 user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); |
| 622 } |
| 623 } |
| 624 #endif |
611 #if defined(OS_MACOSX) || defined(OS_WIN) | 625 #if defined(OS_MACOSX) || defined(OS_WIN) |
612 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | 626 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
613 #endif | 627 #endif |
614 if (!user_data_dir.empty()) { | 628 if (!user_data_dir.empty()) { |
615 CHECK(PathService::OverrideAndCreateIfNeeded( | 629 CHECK(PathService::OverrideAndCreateIfNeeded( |
616 chrome::DIR_USER_DATA, | 630 chrome::DIR_USER_DATA, |
617 user_data_dir, | 631 user_data_dir, |
618 chrome::ProcessNeedsProfileDir(process_type))); | 632 chrome::ProcessNeedsProfileDir(process_type))); |
619 } | 633 } |
620 | 634 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 } | 879 } |
866 | 880 |
867 content::ContentUtilityClient* | 881 content::ContentUtilityClient* |
868 ChromeMainDelegate::CreateContentUtilityClient() { | 882 ChromeMainDelegate::CreateContentUtilityClient() { |
869 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 883 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
870 return NULL; | 884 return NULL; |
871 #else | 885 #else |
872 return &g_chrome_content_utility_client.Get(); | 886 return &g_chrome_content_utility_client.Get(); |
873 #endif | 887 #endif |
874 } | 888 } |
OLD | NEW |