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

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: 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/stats_counters.h" 12 #include "base/metrics/stats_counters.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/process/memory.h" 14 #include "base/process/memory.h"
14 #include "base/process/process_handle.h" 15 #include "base/process/process_handle.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 InitMacCrashReporter(command_line, process_type); 589 InitMacCrashReporter(command_line, process_type);
589 #endif 590 #endif
590 591
591 #if defined(OS_WIN) 592 #if defined(OS_WIN)
592 child_process_logging::Init(); 593 child_process_logging::Init();
593 #endif 594 #endif
594 595
595 // Notice a user data directory override if any 596 // Notice a user data directory override if any
596 base::FilePath user_data_dir = 597 base::FilePath user_data_dir =
597 command_line.GetSwitchValuePath(switches::kUserDataDir); 598 command_line.GetSwitchValuePath(switches::kUserDataDir);
599 if (user_data_dir.empty()) {
600 std::string user_data_dir_string;
601 scoped_ptr<base::Environment> environment(base::Environment::Create());
602 if (environment->GetVar("CHROME_USER_DATA_DIR", &user_data_dir_string) &&
603 IsStringUTF8(user_data_dir_string))
604 user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string);
Wez 2013/08/28 21:06:41 nit: Braces around this, since the condition spans
Jamie 2013/09/09 20:13:00 Done.
605 }
598 #if defined(OS_MACOSX) || defined(OS_WIN) 606 #if defined(OS_MACOSX) || defined(OS_WIN)
599 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); 607 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
600 #endif 608 #endif
601 if (!user_data_dir.empty()) { 609 if (!user_data_dir.empty()) {
602 CHECK(PathService::OverrideAndCreateIfNeeded( 610 CHECK(PathService::OverrideAndCreateIfNeeded(
603 chrome::DIR_USER_DATA, 611 chrome::DIR_USER_DATA,
604 user_data_dir, 612 user_data_dir,
605 chrome::ProcessNeedsProfileDir(process_type))); 613 chrome::ProcessNeedsProfileDir(process_type)));
606 } 614 }
607 615
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 858 }
851 859
852 content::ContentUtilityClient* 860 content::ContentUtilityClient*
853 ChromeMainDelegate::CreateContentUtilityClient() { 861 ChromeMainDelegate::CreateContentUtilityClient() {
854 #if defined(CHROME_MULTIPLE_DLL_BROWSER) 862 #if defined(CHROME_MULTIPLE_DLL_BROWSER)
855 return NULL; 863 return NULL;
856 #else 864 #else
857 return &g_chrome_content_utility_client.Get(); 865 return &g_chrome_content_utility_client.Get();
858 #endif 866 #endif
859 } 867 }
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