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" | |
6 | |
7 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
8 #include <string.h> | 6 #include <string.h> |
9 | 7 |
| 8 #include <memory> |
10 #include <string> | 9 #include <string> |
11 | 10 |
12 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
13 #include "base/logging.h" | 12 #include "base/logging.h" |
14 #import "base/mac/foundation_util.h" | 13 #import "base/mac/foundation_util.h" |
15 #import "base/mac/scoped_nsautorelease_pool.h" | 14 #import "base/mac/scoped_nsautorelease_pool.h" |
16 #include "base/memory/free_deleter.h" | 15 #include "base/memory/free_deleter.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/path_service.h" | 16 #include "base/path_service.h" |
19 #include "build/build_config.h" | 17 #include "build/build_config.h" |
20 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/chrome_paths_internal.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 #if !defined(OS_IOS) | 23 #if !defined(OS_IOS) |
25 const base::FilePath* g_override_versioned_directory = NULL; | 24 const base::FilePath* g_override_versioned_directory = NULL; |
26 | 25 |
27 // Return a retained (NOT autoreleased) NSBundle* as the internal | 26 // Return a retained (NOT autoreleased) NSBundle* as the internal |
28 // implementation of chrome::OuterAppBundle(), which should be the only | 27 // implementation of chrome::OuterAppBundle(), which should be the only |
29 // caller. | 28 // caller. |
30 NSBundle* OuterAppBundleInternal() { | 29 NSBundle* OuterAppBundleInternal() { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 222 |
224 NSBundle* OuterAppBundle() { | 223 NSBundle* OuterAppBundle() { |
225 // Cache this. Foundation leaks it anyway, and this should be the only call | 224 // Cache this. Foundation leaks it anyway, and this should be the only call |
226 // to OuterAppBundleInternal(). | 225 // to OuterAppBundleInternal(). |
227 static NSBundle* bundle = OuterAppBundleInternal(); | 226 static NSBundle* bundle = OuterAppBundleInternal(); |
228 return bundle; | 227 return bundle; |
229 } | 228 } |
230 | 229 |
231 bool GetUserDataDirectoryForBrowserBundle(NSBundle* bundle, | 230 bool GetUserDataDirectoryForBrowserBundle(NSBundle* bundle, |
232 base::FilePath* result) { | 231 base::FilePath* result) { |
233 scoped_ptr<char, base::FreeDeleter> | 232 std::unique_ptr<char, base::FreeDeleter> product_dir_name( |
234 product_dir_name(ProductDirNameForBundle(bundle)); | 233 ProductDirNameForBundle(bundle)); |
235 return GetDefaultUserDataDirectoryForProduct(product_dir_name.get(), result); | 234 return GetDefaultUserDataDirectoryForProduct(product_dir_name.get(), result); |
236 } | 235 } |
237 | 236 |
238 #endif // !defined(OS_IOS) | 237 #endif // !defined(OS_IOS) |
239 | 238 |
240 bool ProcessNeedsProfileDir(const std::string& process_type) { | 239 bool ProcessNeedsProfileDir(const std::string& process_type) { |
241 // For now we have no reason to forbid this on other MacOS as we don't | 240 // For now we have no reason to forbid this on other MacOS as we don't |
242 // have the roaming profile troubles there. | 241 // have the roaming profile troubles there. |
243 return true; | 242 return true; |
244 } | 243 } |
245 | 244 |
246 } // namespace chrome | 245 } // namespace chrome |
OLD | NEW |