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/common/launchd_mac.h" | 5 #include "chrome/common/launchd_mac.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <launch.h> | 8 #include <launch.h> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 argv.push_back("-c"); | 125 argv.push_back("-c"); |
126 std::string command = base::StringPrintf( | 126 std::string command = base::StringPrintf( |
127 "/bin/launchctl unload -S %s %s;" | 127 "/bin/launchctl unload -S %s %s;" |
128 "/bin/launchctl load -S %s %s;", | 128 "/bin/launchctl load -S %s %s;", |
129 [ns_session_type UTF8String], file_path, | 129 [ns_session_type UTF8String], file_path, |
130 [ns_session_type UTF8String], file_path); | 130 [ns_session_type UTF8String], file_path); |
131 argv.push_back(command); | 131 argv.push_back(command); |
132 | 132 |
133 base::LaunchOptions options; | 133 base::LaunchOptions options; |
134 options.new_process_group = true; | 134 options.new_process_group = true; |
135 return base::LaunchProcess(argv, options); | 135 return base::LaunchProcess(argv, options, NULL); |
136 } | 136 } |
137 | 137 |
138 CFMutableDictionaryRef Launchd::CreatePlistFromFile(Domain domain, | 138 CFMutableDictionaryRef Launchd::CreatePlistFromFile(Domain domain, |
139 Type type, | 139 Type type, |
140 CFStringRef name) { | 140 CFStringRef name) { |
141 base::mac::ScopedNSAutoreleasePool pool; | 141 base::mac::ScopedNSAutoreleasePool pool; |
142 NSURL* ns_url = GetPlistURL(domain, type, name); | 142 NSURL* ns_url = GetPlistURL(domain, type, name); |
143 NSMutableDictionary* plist = | 143 NSMutableDictionary* plist = |
144 [[NSMutableDictionary alloc] initWithContentsOfURL:ns_url]; | 144 [[NSMutableDictionary alloc] initWithContentsOfURL:ns_url]; |
145 return base::mac::NSToCFCast(plist); | 145 return base::mac::NSToCFCast(plist); |
(...skipping 14 matching lines...) Expand all Loading... |
160 NSError* err = nil; | 160 NSError* err = nil; |
161 if (![[NSFileManager defaultManager] removeItemAtPath:[ns_url path] | 161 if (![[NSFileManager defaultManager] removeItemAtPath:[ns_url path] |
162 error:&err]) { | 162 error:&err]) { |
163 if ([err code] != NSFileNoSuchFileError) { | 163 if ([err code] != NSFileNoSuchFileError) { |
164 LOG(ERROR) << "DeletePlist: " << base::mac::NSToCFCast(err); | 164 LOG(ERROR) << "DeletePlist: " << base::mac::NSToCFCast(err); |
165 } | 165 } |
166 return false; | 166 return false; |
167 } | 167 } |
168 return true; | 168 return true; |
169 } | 169 } |
OLD | NEW |