Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/chromeos/file_manager/path_util.h" | 5 #include "chrome/browser/chromeos/file_manager/path_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 FILE_PATH_LITERAL("/home/chronos/user/Downloads"); | 26 FILE_PATH_LITERAL("/home/chronos/user/Downloads"); |
| 27 const base::FilePath::CharType kOldDriveFolderPath[] = | 27 const base::FilePath::CharType kOldDriveFolderPath[] = |
| 28 FILE_PATH_LITERAL("/special/drive"); | 28 FILE_PATH_LITERAL("/special/drive"); |
| 29 // Unintended path introduced in crbug.com/363026. | 29 // Unintended path introduced in crbug.com/363026. |
| 30 const base::FilePath::CharType kBuggyDriveFolderPath[] = | 30 const base::FilePath::CharType kBuggyDriveFolderPath[] = |
| 31 FILE_PATH_LITERAL("/special/drive-user"); | 31 FILE_PATH_LITERAL("/special/drive-user"); |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 base::FilePath GetDownloadsFolderForProfile(Profile* profile) { | 35 base::FilePath GetDownloadsFolderForProfile(Profile* profile) { |
| 36 if (!base::SysInfo::IsRunningOnChromeOS() && | 36 if (!base::SysInfo::IsRunningOnChromeOS()) { |
|
Mr4D (OOO till 08-26)
2014/05/14 16:32:40
Indenting
zel
2014/05/14 17:48:39
Done.
| |
| 37 !chromeos::UserManager::IsMultipleProfilesAllowed()) { | |
| 38 // On the developer run on Linux desktop build, if multiple profiles are | 37 // On the developer run on Linux desktop build, if multiple profiles are |
| 39 // not enabled, use $HOME/Downloads for ease for accessing local files for | 38 // not enabled, use $HOME/Downloads for ease for accessing local files for |
| 40 // debugging. | 39 // debugging. |
| 41 base::FilePath path; | 40 base::FilePath path; |
| 42 CHECK(PathService::Get(base::DIR_HOME, &path)); | 41 CHECK(PathService::Get(base::DIR_HOME, &path)); |
| 43 return path.AppendASCII(kDownloadsFolderName); | 42 return path.AppendASCII(kDownloadsFolderName); |
| 44 } | 43 } |
| 45 | |
| 46 return profile->GetPath().AppendASCII(kDownloadsFolderName); | 44 return profile->GetPath().AppendASCII(kDownloadsFolderName); |
| 47 } | 45 } |
| 48 | 46 |
| 49 bool MigratePathFromOldFormat(Profile* profile, | 47 bool MigratePathFromOldFormat(Profile* profile, |
| 50 const base::FilePath& old_path, | 48 const base::FilePath& old_path, |
| 51 base::FilePath* new_path) { | 49 base::FilePath* new_path) { |
| 52 // M34: | 50 // M34: |
| 53 // /home/chronos/user/Downloads/xxx => /home/chronos/u-hash/Downloads/xxx | 51 // /home/chronos/user/Downloads/xxx => /home/chronos/u-hash/Downloads/xxx |
| 54 // /special/drive => /special/drive-xxx | 52 // /special/drive => /special/drive-xxx |
| 55 // | 53 // |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 chromeos::User* const user = | 106 chromeos::User* const user = |
| 109 chromeos::UserManager::IsInitialized() ? | 107 chromeos::UserManager::IsInitialized() ? |
| 110 chromeos::UserManager::Get()->GetUserByProfile( | 108 chromeos::UserManager::Get()->GetUserByProfile( |
| 111 profile->GetOriginalProfile()) : NULL; | 109 profile->GetOriginalProfile()) : NULL; |
| 112 const std::string id = user ? "-" + user->username_hash() : ""; | 110 const std::string id = user ? "-" + user->username_hash() : ""; |
| 113 return net::EscapePath(kDownloadsFolderName + id); | 111 return net::EscapePath(kDownloadsFolderName + id); |
| 114 } | 112 } |
| 115 | 113 |
| 116 } // namespace util | 114 } // namespace util |
| 117 } // namespace file_manager | 115 } // namespace file_manager |
| OLD | NEW |