| 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/common/chrome_paths_internal.h" | 5 #include "chrome/common/chrome_paths_internal.h" |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/nix/xdg_util.h" | 10 #include "base/nix/xdg_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Generic function for GetUser{Music,Pictures,Video}Directory. | 27 // Generic function for GetUser{Music,Pictures,Video}Directory. |
| 28 bool GetUserMediaDirectory(const std::string& xdg_name, | 28 bool GetUserMediaDirectory(const std::string& xdg_name, |
| 29 const std::string& fallback_name, | 29 const std::string& fallback_name, |
| 30 base::FilePath* result) { | 30 base::FilePath* result) { |
| 31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 32 // No local media directories on CrOS. | 32 // No local media directories on CrOS. |
| 33 return false; | 33 return false; |
| 34 #else | 34 #else |
| 35 *result = GetXDGUserDirectory(xdg_name.c_str(), fallback_name.c_str()); | 35 *result = GetXDGUserDirectory(xdg_name.c_str(), fallback_name.c_str()); |
| 36 | 36 |
| 37 base::FilePath home = file_util::GetHomeDir(); | 37 base::FilePath home = base::GetHomeDir(); |
| 38 if (*result != home) { | 38 if (*result != home) { |
| 39 base::FilePath desktop; | 39 base::FilePath desktop; |
| 40 if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop)) | 40 if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop)) |
| 41 return false; | 41 return false; |
| 42 if (*result != desktop) { | 42 if (*result != desktop) { |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 *result = home.Append(fallback_name); | 47 *result = home.Append(fallback_name); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 #endif | 109 #endif |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool GetUserDocumentsDirectory(base::FilePath* result) { | 113 bool GetUserDocumentsDirectory(base::FilePath* result) { |
| 114 *result = GetXDGUserDirectory("DOCUMENTS", "Documents"); | 114 *result = GetXDGUserDirectory("DOCUMENTS", "Documents"); |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool GetUserDownloadsDirectorySafe(base::FilePath* result) { | 118 bool GetUserDownloadsDirectorySafe(base::FilePath* result) { |
| 119 base::FilePath home = file_util::GetHomeDir(); | 119 base::FilePath home = base::GetHomeDir(); |
| 120 *result = home.Append(kDownloadsDir); | 120 *result = home.Append(kDownloadsDir); |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool GetUserDownloadsDirectory(base::FilePath* result) { | 124 bool GetUserDownloadsDirectory(base::FilePath* result) { |
| 125 *result = base::nix::GetXDGUserDirectory("DOWNLOAD", kDownloadsDir); | 125 *result = base::nix::GetXDGUserDirectory("DOWNLOAD", kDownloadsDir); |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 // We respect the user's preferred pictures location, unless it is | 129 // We respect the user's preferred pictures location, unless it is |
| (...skipping 15 matching lines...) Expand all Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool ProcessNeedsProfileDir(const std::string& process_type) { | 147 bool ProcessNeedsProfileDir(const std::string& process_type) { |
| 148 // For now we have no reason to forbid this on Linux as we don't | 148 // For now we have no reason to forbid this on Linux as we don't |
| 149 // have the roaming profile troubles there. Moreover the Linux breakpad needs | 149 // have the roaming profile troubles there. Moreover the Linux breakpad needs |
| 150 // profile dir access in all process if enabled on Linux. | 150 // profile dir access in all process if enabled on Linux. |
| 151 return true; | 151 return true; |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace chrome | 154 } // namespace chrome |
| OLD | NEW |