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