| 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 19 matching lines...) Expand all Loading... |
| 30 FilePath* result) { | 30 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 FilePath home = file_util::GetHomeDir(); | 37 FilePath home = file_util::GetHomeDir(); |
| 38 if (*result != home) { | 38 if (*result != home) { |
| 39 FilePath desktop; | 39 FilePath desktop; |
| 40 GetUserDesktop(&desktop); | 40 if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop)) |
| 41 return false; |
| 41 if (*result != desktop) { | 42 if (*result != desktop) { |
| 42 return true; | 43 return true; |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 | 46 |
| 46 *result = home.Append(fallback_name); | 47 *result = home.Append(fallback_name); |
| 47 return true; | 48 return true; |
| 48 #endif | 49 #endif |
| 49 } | 50 } |
| 50 | 51 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 bool GetUserPicturesDirectory(FilePath* result) { | 136 bool GetUserPicturesDirectory(FilePath* result) { |
| 136 return GetUserMediaDirectory("PICTURES", kPicturesDir, result); | 137 return GetUserMediaDirectory("PICTURES", kPicturesDir, result); |
| 137 } | 138 } |
| 138 | 139 |
| 139 // We respect the user's preferred pictures location, unless it is | 140 // We respect the user's preferred pictures location, unless it is |
| 140 // ~ or their desktop directory, in which case we default to ~/Videos. | 141 // ~ or their desktop directory, in which case we default to ~/Videos. |
| 141 bool GetUserVideosDirectory(FilePath* result) { | 142 bool GetUserVideosDirectory(FilePath* result) { |
| 142 return GetUserMediaDirectory("VIDEOS", kVideosDir, result); | 143 return GetUserMediaDirectory("VIDEOS", kVideosDir, result); |
| 143 } | 144 } |
| 144 | 145 |
| 145 bool GetUserDesktop(FilePath* result) { | |
| 146 *result = GetXDGUserDirectory("DESKTOP", "Desktop"); | |
| 147 return true; | |
| 148 } | |
| 149 | |
| 150 bool ProcessNeedsProfileDir(const std::string& process_type) { | 146 bool ProcessNeedsProfileDir(const std::string& process_type) { |
| 151 // For now we have no reason to forbid this on Linux as we don't | 147 // For now we have no reason to forbid this on Linux as we don't |
| 152 // have the roaming profile troubles there. Moreover the Linux breakpad needs | 148 // have the roaming profile troubles there. Moreover the Linux breakpad needs |
| 153 // profile dir access in all process if enabled on Linux. | 149 // profile dir access in all process if enabled on Linux. |
| 154 return true; | 150 return true; |
| 155 } | 151 } |
| 156 | 152 |
| 157 } // namespace chrome | 153 } // namespace chrome |
| OLD | NEW |