Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 23651006: Allow user data dir to be specified in the environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback + rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698