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/service_process_util_posix.h" | 5 #include "chrome/common/service_process_util_posix.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 <vector> | 10 #include <vector> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 bool RemoveFromLaunchd() { | 74 bool RemoveFromLaunchd() { |
75 // We're killing a file. | 75 // We're killing a file. |
76 base::ThreadRestrictions::AssertIOAllowed(); | 76 base::ThreadRestrictions::AssertIOAllowed(); |
77 base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); | 77 base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); |
78 return Launchd::GetInstance()->DeletePlist(Launchd::User, | 78 return Launchd::GetInstance()->DeletePlist(Launchd::User, |
79 Launchd::Agent, | 79 Launchd::Agent, |
80 name); | 80 name); |
81 } | 81 } |
82 | 82 |
83 class ExecFilePathWatcherDelegate : public FilePathWatcher::Delegate { | 83 class ExecFilePathWatcherDelegate |
| 84 : public base::files::FilePathWatcher::Delegate { |
84 public: | 85 public: |
85 ExecFilePathWatcherDelegate() { } | 86 ExecFilePathWatcherDelegate() { } |
86 virtual ~ExecFilePathWatcherDelegate() { } | 87 virtual ~ExecFilePathWatcherDelegate() { } |
87 | 88 |
88 bool Init(const FilePath& path); | 89 bool Init(const FilePath& path); |
89 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE; | 90 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE; |
90 | 91 |
91 private: | 92 private: |
92 FSRef executable_fsref_; | 93 FSRef executable_fsref_; |
93 }; | 94 }; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 CFErrorRef err = NULL; | 434 CFErrorRef err = NULL; |
434 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 435 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
435 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 436 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
436 LOG(ERROR) << "RemoveJob " << err; | 437 LOG(ERROR) << "RemoveJob " << err; |
437 // Exiting with zero, so launchd doesn't restart the process. | 438 // Exiting with zero, so launchd doesn't restart the process. |
438 exit(0); | 439 exit(0); |
439 } | 440 } |
440 } | 441 } |
441 } | 442 } |
442 } | 443 } |
OLD | NEW |