Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: chrome/browser/mac/install_from_dmg.mm

Issue 2393793002: Mac: Port deprecated methods to 10.8+ alternatives in install_from_dmg.mm. (Closed)
Patch Set: Delete incorrect & unneeded sys_string_conversations_mac.mm import. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/mac/sdk_forward_declarations.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/mac/install_from_dmg.h" 5 #include "chrome/browser/mac/install_from_dmg.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #include <ApplicationServices/ApplicationServices.h> 8 #include <ApplicationServices/ApplicationServices.h>
9 #include <CoreFoundation/CoreFoundation.h> 9 #include <CoreFoundation/CoreFoundation.h>
10 #include <CoreServices/CoreServices.h> 10 #include <CoreServices/CoreServices.h>
(...skipping 12 matching lines...) Expand all
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/mac/authorization_util.h" 24 #include "base/mac/authorization_util.h"
25 #include "base/mac/bundle_locations.h" 25 #include "base/mac/bundle_locations.h"
26 #include "base/mac/foundation_util.h" 26 #include "base/mac/foundation_util.h"
27 #include "base/mac/mac_logging.h" 27 #include "base/mac/mac_logging.h"
28 #include "base/mac/mach_logging.h" 28 #include "base/mac/mach_logging.h"
29 #include "base/mac/scoped_authorizationref.h" 29 #include "base/mac/scoped_authorizationref.h"
30 #include "base/mac/scoped_cftyperef.h" 30 #include "base/mac/scoped_cftyperef.h"
31 #include "base/mac/scoped_ioobject.h" 31 #include "base/mac/scoped_ioobject.h"
32 #include "base/mac/scoped_nsautorelease_pool.h" 32 #include "base/mac/scoped_nsautorelease_pool.h"
33 #include "base/mac/sdk_forward_declarations.h"
33 #include "base/macros.h" 34 #include "base/macros.h"
34 #include "base/strings/string_util.h" 35 #include "base/strings/string_util.h"
35 #include "base/strings/stringprintf.h" 36 #include "base/strings/stringprintf.h"
36 #include "base/strings/sys_string_conversions.h" 37 #include "base/strings/sys_string_conversions.h"
37 #include "chrome/browser/mac/dock.h" 38 #include "chrome/browser/mac/dock.h"
38 #import "chrome/browser/mac/keystone_glue.h" 39 #import "chrome/browser/mac/keystone_glue.h"
39 #include "chrome/browser/mac/relauncher.h" 40 #include "chrome/browser/mac/relauncher.h"
40 #include "chrome/common/chrome_constants.h" 41 #include "chrome/common/chrome_constants.h"
41 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
42 #include "chrome/grit/chromium_strings.h" 43 #include "chrome/grit/chromium_strings.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return; 673 return;
673 } 674 }
674 sleep(1); 675 sleep(1);
675 } 676 }
676 677
677 if (!SynchronousDADiskEject(disk, kDADiskEjectOptionDefault)) { 678 if (!SynchronousDADiskEject(disk, kDADiskEjectOptionDefault)) {
678 LOG(ERROR) << "SynchronousDADiskEject"; 679 LOG(ERROR) << "SynchronousDADiskEject";
679 return; 680 return;
680 } 681 }
681 682
682 char* disk_image_path_in_trash_c; 683 NSURL* disk_image_path_nsurl =
683 OSStatus status = FSPathMoveObjectToTrashSync(disk_image_path.c_str(), 684 [NSURL fileURLWithPath:base::SysUTF8ToNSString(disk_image_path)];
684 &disk_image_path_in_trash_c, 685 if (![[NSFileManager defaultManager] trashItemAtURL:disk_image_path_nsurl
685 kFSFileOperationDefaultOptions); 686 resultingItemURL:nil
686 if (status != noErr) { 687 error:nil]) {
tapted 2016/10/07 04:33:15 We're probably not interested in resultingItemURL,
Patti Lor 2016/10/07 05:51:25 Done.
687 OSSTATUS_LOG(ERROR, status) << "FSPathMoveObjectToTrashSync"; 688 LOG(ERROR) << "NSFileManager trashItemAtURL::";
688 return; 689 return;
689 } 690 }
690 691
691 // FSPathMoveObjectToTrashSync alone doesn't result in the Trash icon in the
692 // Dock indicating that any garbage has been placed within it. Using the
693 // trash path that FSPathMoveObjectToTrashSync claims to have used, call
694 // FNNotifyByPath to fatten up the icon.
695 base::FilePath disk_image_path_in_trash(disk_image_path_in_trash_c);
696 free(disk_image_path_in_trash_c);
697
698 base::FilePath trash_path = disk_image_path_in_trash.DirName();
699 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>(
700 trash_path.value().c_str());
701 status = FNNotifyByPath(trash_path_u8,
702 kFNDirectoryModifiedMessage,
703 kNilOptions);
704 if (status != noErr) {
705 OSSTATUS_LOG(ERROR, status) << "FNNotifyByPath";
706 return;
707 }
708 } 692 }
OLDNEW
« no previous file with comments | « base/mac/sdk_forward_declarations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698