| 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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 #include <launch.h> | 6 #include <launch.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 ofDirectory:NSTrashDirectory | 374 ofDirectory:NSTrashDirectory |
| 375 inDomain:0 | 375 inDomain:0 |
| 376 toItemAtURL:executable_fsref_ | 376 toItemAtURL:executable_fsref_ |
| 377 error:nil]) { | 377 error:nil]) { |
| 378 in_trash = relationship == NSURLRelationshipContains; | 378 in_trash = relationship == NSURLRelationshipContains; |
| 379 } | 379 } |
| 380 } else { | 380 } else { |
| 381 DCHECK(base::mac::IsAtMostOS10_9()); | 381 DCHECK(base::mac::IsAtMostOS10_9()); |
| 382 Boolean fs_in_trash; | 382 Boolean fs_in_trash; |
| 383 FSRef ref; | 383 FSRef ref; |
| 384 if (CFURLGetFSRef(base::mac::NSToCFCast(executable_fsref_.get()), &ref)) { | |
| 385 #pragma clang diagnostic push | 384 #pragma clang diagnostic push |
| 386 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 385 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
| 386 if (CFURLGetFSRef(base::mac::NSToCFCast(executable_fsref_.get()), &ref)) { |
| 387 // This is ok because it only happens on 10.9 and won't be needed once | 387 // This is ok because it only happens on 10.9 and won't be needed once |
| 388 // we stop supporting that. | 388 // we stop supporting that. |
| 389 OSErr err = FSDetermineIfRefIsEnclosedByFolder( | 389 OSErr err = FSDetermineIfRefIsEnclosedByFolder( |
| 390 kOnAppropriateDisk, kTrashFolderType, &ref, &fs_in_trash); | 390 kOnAppropriateDisk, kTrashFolderType, &ref, &fs_in_trash); |
| 391 #pragma clang diagnostic pop | 391 #pragma clang diagnostic pop |
| 392 if (err == noErr && fs_in_trash) | 392 if (err == noErr && fs_in_trash) |
| 393 in_trash = true; | 393 in_trash = true; |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 if (in_trash) { | 396 if (in_trash) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 CFErrorRef err = NULL; | 462 CFErrorRef err = NULL; |
| 463 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 463 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
| 464 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 464 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
| 465 DLOG(ERROR) << "RemoveJob " << err; | 465 DLOG(ERROR) << "RemoveJob " << err; |
| 466 // Exiting with zero, so launchd doesn't restart the process. | 466 // Exiting with zero, so launchd doesn't restart the process. |
| 467 exit(0); | 467 exit(0); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 } | 471 } |
| OLD | NEW |