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/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); | 338 user_data_dir = base::FilePath::FromUTF8Unsafe(user_data_dir_string); |
339 } | 339 } |
340 } | 340 } |
341 #endif | 341 #endif |
342 #if defined(OS_MACOSX) || defined(OS_WIN) | 342 #if defined(OS_MACOSX) || defined(OS_WIN) |
343 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); | 343 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir); |
344 #endif | 344 #endif |
345 | 345 |
346 // On Windows, trailing separators leave Chrome in a bad state. | 346 // On Windows, trailing separators leave Chrome in a bad state. |
347 // See crbug.com/464616. | 347 // See crbug.com/464616. |
348 if (user_data_dir.EndsWithSeparator()) { | 348 if (user_data_dir.EndsWithSeparator()) |
349 user_data_dir = user_data_dir.StripTrailingSeparators(); | 349 user_data_dir = user_data_dir.StripTrailingSeparators(); |
350 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); | |
351 } | |
352 | 350 |
353 const bool specified_directory_was_invalid = !user_data_dir.empty() && | 351 const bool specified_directory_was_invalid = !user_data_dir.empty() && |
354 !PathService::OverrideAndCreateIfNeeded(chrome::DIR_USER_DATA, | 352 !PathService::OverrideAndCreateIfNeeded(chrome::DIR_USER_DATA, |
355 user_data_dir, false, true); | 353 user_data_dir, false, true); |
356 // Save inaccessible or invalid paths so the user may be prompted later. | 354 // Save inaccessible or invalid paths so the user may be prompted later. |
357 if (specified_directory_was_invalid) | 355 if (specified_directory_was_invalid) |
358 chrome::SetInvalidSpecifiedUserDataDir(user_data_dir); | 356 chrome::SetInvalidSpecifiedUserDataDir(user_data_dir); |
359 | 357 |
360 // Warn and fail early if the process fails to get a user data directory. | 358 // Warn and fail early if the process fails to get a user data directory. |
361 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 359 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 case chrome::VersionInfo::CHANNEL_CANARY: | 958 case chrome::VersionInfo::CHANNEL_CANARY: |
961 return true; | 959 return true; |
962 case chrome::VersionInfo::CHANNEL_DEV: | 960 case chrome::VersionInfo::CHANNEL_DEV: |
963 case chrome::VersionInfo::CHANNEL_BETA: | 961 case chrome::VersionInfo::CHANNEL_BETA: |
964 case chrome::VersionInfo::CHANNEL_STABLE: | 962 case chrome::VersionInfo::CHANNEL_STABLE: |
965 default: | 963 default: |
966 // Don't enable instrumentation. | 964 // Don't enable instrumentation. |
967 return false; | 965 return false; |
968 } | 966 } |
969 } | 967 } |
OLD | NEW |