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/mac/launchd.h" | 5 #include "chrome/common/mac/launchd.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/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 NSString* plist_file_path = | 51 NSString* plist_file_path = |
52 [launch_dir stringByAppendingPathComponent:base::mac::CFToNSCast(name)]; | 52 [launch_dir stringByAppendingPathComponent:base::mac::CFToNSCast(name)]; |
53 plist_file_path = [plist_file_path stringByAppendingPathExtension:@"plist"]; | 53 plist_file_path = [plist_file_path stringByAppendingPathExtension:@"plist"]; |
54 return [NSURL fileURLWithPath:plist_file_path isDirectory:NO]; | 54 return [NSURL fileURLWithPath:plist_file_path isDirectory:NO]; |
55 } | 55 } |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 COMPILE_ASSERT(static_cast<int>(Launchd::User) == | 59 static_assert(static_cast<int>(Launchd::User) == |
60 static_cast<int>(NSUserDomainMask), | 60 static_cast<int>(NSUserDomainMask), |
61 NSUserDomainMask_value_changed); | 61 "NSUserDomainMask value changed"); |
62 COMPILE_ASSERT(static_cast<int>(Launchd::Local) == | 62 static_assert(static_cast<int>(Launchd::Local) == |
63 static_cast<int>(NSLocalDomainMask), | 63 static_cast<int>(NSLocalDomainMask), |
64 NSLocalDomainMask_value_changed); | 64 "NSLocalDomainMask value changed"); |
65 COMPILE_ASSERT(static_cast<int>(Launchd::Network) == | 65 static_assert(static_cast<int>(Launchd::Network) == |
66 static_cast<int>(NSNetworkDomainMask), | 66 static_cast<int>(NSNetworkDomainMask), |
67 NSNetworkDomainMask_value_changed); | 67 "NSNetworkDomainMask value changed"); |
68 COMPILE_ASSERT(static_cast<int>(Launchd::System) == | 68 static_assert(static_cast<int>(Launchd::System) == |
69 static_cast<int>(NSSystemDomainMask), | 69 static_cast<int>(NSSystemDomainMask), |
70 NSSystemDomainMask_value_changed); | 70 "NSSystemDomainMask value changed"); |
71 | 71 |
72 Launchd* Launchd::g_instance_ = NULL; | 72 Launchd* Launchd::g_instance_ = NULL; |
73 | 73 |
74 Launchd* Launchd::GetInstance() { | 74 Launchd* Launchd::GetInstance() { |
75 if (!g_instance_) { | 75 if (!g_instance_) { |
76 g_instance_ = Singleton<Launchd>::get(); | 76 g_instance_ = Singleton<Launchd>::get(); |
77 } | 77 } |
78 return g_instance_; | 78 return g_instance_; |
79 } | 79 } |
80 | 80 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 DLOG(ERROR) << "DeletePlist: " << base::mac::NSToCFCast(err); | 164 DLOG(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 |