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/base_paths.h" |
| 8 #include "base/base_paths_posix.h" |
7 #include "base/environment.h" | 9 #include "base/environment.h" |
8 #include "base/file_util.h" | 10 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/nix/xdg_util.h" | 12 #include "base/nix/xdg_util.h" |
11 #include "base/path_service.h" | 13 #include "base/path_service.h" |
12 | 14 |
13 namespace chrome { | 15 namespace chrome { |
14 | 16 |
15 using base::nix::GetXDGDirectory; | 17 using base::nix::GetXDGDirectory; |
16 using base::nix::GetXDGUserDirectory; | 18 using base::nix::GetXDGUserDirectory; |
(...skipping 13 matching lines...) Expand all Loading... |
30 FilePath* result) { | 32 FilePath* result) { |
31 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
32 // No local media directories on CrOS. | 34 // No local media directories on CrOS. |
33 return false; | 35 return false; |
34 #else | 36 #else |
35 *result = GetXDGUserDirectory(xdg_name.c_str(), fallback_name.c_str()); | 37 *result = GetXDGUserDirectory(xdg_name.c_str(), fallback_name.c_str()); |
36 | 38 |
37 FilePath home = file_util::GetHomeDir(); | 39 FilePath home = file_util::GetHomeDir(); |
38 if (*result != home) { | 40 if (*result != home) { |
39 FilePath desktop; | 41 FilePath desktop; |
40 GetUserDesktop(&desktop); | 42 if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop)) |
| 43 return false; |
41 if (*result != desktop) { | 44 if (*result != desktop) { |
42 return true; | 45 return true; |
43 } | 46 } |
44 } | 47 } |
45 | 48 |
46 *result = home.Append(fallback_name); | 49 *result = home.Append(fallback_name); |
47 return true; | 50 return true; |
48 #endif | 51 #endif |
49 } | 52 } |
50 | 53 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool GetUserPicturesDirectory(FilePath* result) { | 138 bool GetUserPicturesDirectory(FilePath* result) { |
136 return GetUserMediaDirectory("PICTURES", kPicturesDir, result); | 139 return GetUserMediaDirectory("PICTURES", kPicturesDir, result); |
137 } | 140 } |
138 | 141 |
139 // We respect the user's preferred pictures location, unless it is | 142 // We respect the user's preferred pictures location, unless it is |
140 // ~ or their desktop directory, in which case we default to ~/Videos. | 143 // ~ or their desktop directory, in which case we default to ~/Videos. |
141 bool GetUserVideosDirectory(FilePath* result) { | 144 bool GetUserVideosDirectory(FilePath* result) { |
142 return GetUserMediaDirectory("VIDEOS", kVideosDir, result); | 145 return GetUserMediaDirectory("VIDEOS", kVideosDir, result); |
143 } | 146 } |
144 | 147 |
145 bool GetUserDesktop(FilePath* result) { | |
146 *result = GetXDGUserDirectory("DESKTOP", "Desktop"); | |
147 return true; | |
148 } | |
149 | |
150 bool ProcessNeedsProfileDir(const std::string& process_type) { | 148 bool ProcessNeedsProfileDir(const std::string& process_type) { |
151 // For now we have no reason to forbid this on Linux as we don't | 149 // 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 | 150 // have the roaming profile troubles there. Moreover the Linux breakpad needs |
153 // profile dir access in all process if enabled on Linux. | 151 // profile dir access in all process if enabled on Linux. |
154 return true; | 152 return true; |
155 } | 153 } |
156 | 154 |
157 } // namespace chrome | 155 } // namespace chrome |
OLD | NEW |