OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/app/chrome_main_mac.h" | 5 #include "chrome/app/chrome_main_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #import "base/mac/bundle_locations.h" |
14 #import "base/mac/foundation_util.h" | 15 #import "base/mac/foundation_util.h" |
15 #import "base/mac/scoped_nsautorelease_pool.h" | 16 #import "base/mac/scoped_nsautorelease_pool.h" |
16 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
17 #include "chrome/browser/policy/policy_path_parser.h" | 18 #include "chrome/browser/policy/policy_path_parser.h" |
18 #include "chrome/common/chrome_paths_internal.h" | 19 #include "chrome/common/chrome_paths_internal.h" |
19 #include "policy/policy_constants.h" | 20 #include "policy/policy_constants.h" |
20 | 21 |
21 void CheckUserDataDirPolicy(FilePath* user_data_dir) { | 22 void CheckUserDataDirPolicy(FilePath* user_data_dir) { |
22 base::mac::ScopedNSAutoreleasePool pool; | 23 base::mac::ScopedNSAutoreleasePool pool; |
23 | 24 |
24 // Since the configuration management infrastructure is not initialized when | 25 // Since the configuration management infrastructure is not initialized when |
25 // this code runs, read the policy preference directly. | 26 // this code runs, read the policy preference directly. |
26 NSString* key = base::SysUTF8ToNSString(policy::key::kUserDataDir); | 27 NSString* key = base::SysUTF8ToNSString(policy::key::kUserDataDir); |
27 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 28 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
28 NSString* value = [defaults stringForKey:key]; | 29 NSString* value = [defaults stringForKey:key]; |
29 if (value && [defaults objectIsForcedForKey:key]) { | 30 if (value && [defaults objectIsForcedForKey:key]) { |
30 std::string string_value = base::SysNSStringToUTF8(value); | 31 std::string string_value = base::SysNSStringToUTF8(value); |
31 // Now replace any vars the user might have used. | 32 // Now replace any vars the user might have used. |
32 string_value = | 33 string_value = |
33 policy::path_parser::ExpandPathVariables(string_value); | 34 policy::path_parser::ExpandPathVariables(string_value); |
34 *user_data_dir = FilePath(string_value); | 35 *user_data_dir = FilePath(string_value); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 void SetUpBundleOverrides() { | 39 void SetUpBundleOverrides() { |
39 base::mac::ScopedNSAutoreleasePool pool; | 40 base::mac::ScopedNSAutoreleasePool pool; |
40 | 41 |
41 base::mac::SetOverrideAppBundlePath(chrome::GetFrameworkBundlePath()); | 42 base::mac::SetOverrideFrameworkBundlePath(chrome::GetFrameworkBundlePath()); |
42 | 43 |
43 NSBundle* base_bundle = chrome::OuterAppBundle(); | 44 NSBundle* base_bundle = chrome::OuterAppBundle(); |
44 base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]); | 45 base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]); |
45 } | 46 } |
OLD | NEW |