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 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #import "base/mac/foundation_util.h" | 14 #import "base/mac/foundation_util.h" |
15 #import "base/mac/mac_util.h" | 15 #import "base/mac/mac_util.h" |
16 #import "base/mac/scoped_nsautorelease_pool.h" | 16 #import "base/mac/scoped_nsautorelease_pool.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
| 22 // TODO(thestig) Remove this once we switch to the 10.6 SDK. |
| 23 #if !defined(MAC_OS_X_VERSION_10_6) || \ |
| 24 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 25 #define NSPicturesDirectory 19 |
| 26 #endif |
| 27 |
22 const FilePath* g_override_versioned_directory = NULL; | 28 const FilePath* g_override_versioned_directory = NULL; |
23 | 29 |
24 // Return a retained (NOT autoreleased) NSBundle* as the internal | 30 // Return a retained (NOT autoreleased) NSBundle* as the internal |
25 // implementation of chrome::OuterAppBundle(), which should be the only | 31 // implementation of chrome::OuterAppBundle(), which should be the only |
26 // caller. | 32 // caller. |
27 NSBundle* OuterAppBundleInternal() { | 33 NSBundle* OuterAppBundleInternal() { |
28 base::mac::ScopedNSAutoreleasePool pool; | 34 base::mac::ScopedNSAutoreleasePool pool; |
29 | 35 |
30 if (!base::mac::AmIBundled()) { | 36 if (!base::mac::AmIBundled()) { |
31 // If unbundled (as in a test), there's no app bundle. | 37 // If unbundled (as in a test), there's no app bundle. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (!app_data_dir.AppendRelativePath(profile_dir, &cache_dir)) | 134 if (!app_data_dir.AppendRelativePath(profile_dir, &cache_dir)) |
129 return; | 135 return; |
130 | 136 |
131 *result = cache_dir; | 137 *result = cache_dir; |
132 } | 138 } |
133 | 139 |
134 bool GetUserDownloadsDirectory(FilePath* result) { | 140 bool GetUserDownloadsDirectory(FilePath* result) { |
135 return base::mac::GetUserDirectory(NSDownloadsDirectory, result); | 141 return base::mac::GetUserDirectory(NSDownloadsDirectory, result); |
136 } | 142 } |
137 | 143 |
| 144 bool GetUserPicturesDirectory(FilePath* result) { |
| 145 return base::mac::GetUserDirectory(NSPicturesDirectory, result); |
| 146 } |
| 147 |
138 bool GetUserDesktop(FilePath* result) { | 148 bool GetUserDesktop(FilePath* result) { |
139 return base::mac::GetUserDirectory(NSDesktopDirectory, result); | 149 return base::mac::GetUserDirectory(NSDesktopDirectory, result); |
140 } | 150 } |
141 | 151 |
142 FilePath GetVersionedDirectory() { | 152 FilePath GetVersionedDirectory() { |
143 if (g_override_versioned_directory) | 153 if (g_override_versioned_directory) |
144 return *g_override_versioned_directory; | 154 return *g_override_versioned_directory; |
145 | 155 |
146 // Start out with the path to the running executable. | 156 // Start out with the path to the running executable. |
147 FilePath path; | 157 FilePath path; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return bundle; | 209 return bundle; |
200 } | 210 } |
201 | 211 |
202 bool ProcessNeedsProfileDir(const std::string& process_type) { | 212 bool ProcessNeedsProfileDir(const std::string& process_type) { |
203 // For now we have no reason to forbid this on other MacOS as we don't | 213 // For now we have no reason to forbid this on other MacOS as we don't |
204 // have the roaming profile troubles there. | 214 // have the roaming profile troubles there. |
205 return true; | 215 return true; |
206 } | 216 } |
207 | 217 |
208 } // namespace chrome | 218 } // namespace chrome |
OLD | NEW |