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

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

Issue 9240004: Transition to base/mac/bundle_locations.h step 3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/mac/mac_util.mm ('k') | chrome/browser/mac/keystone_glue.mm » ('j') | 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) 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/browser/mac/install_from_dmg.h" 5 #include "chrome/browser/mac/install_from_dmg.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #import <AppKit/AppKit.h> 8 #import <AppKit/AppKit.h>
9 #include <CoreFoundation/CoreFoundation.h> 9 #include <CoreFoundation/CoreFoundation.h>
10 #include <CoreServices/CoreServices.h> 10 #include <CoreServices/CoreServices.h>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 return MediaResidesOnDiskImage(media, NULL); 229 return MediaResidesOnDiskImage(media, NULL);
230 } 230 }
231 231
232 // Returns true if the application is located on a read-only filesystem of a 232 // Returns true if the application is located on a read-only filesystem of a
233 // disk image. Returns false if not, or in the event of an error. If 233 // disk image. Returns false if not, or in the event of an error. If
234 // dmg_bsd_device_name is present, it will be set to the BSD device name for 234 // dmg_bsd_device_name is present, it will be set to the BSD device name for
235 // the disk image's device, in "diskNsM" form. 235 // the disk image's device, in "diskNsM" form.
236 bool IsAppRunningFromReadOnlyDiskImage(std::string* dmg_bsd_device_name) { 236 bool IsAppRunningFromReadOnlyDiskImage(std::string* dmg_bsd_device_name) {
237 return IsPathOnReadOnlyDiskImage( 237 return IsPathOnReadOnlyDiskImage(
238 [[[NSBundle mainBundle] bundlePath] fileSystemRepresentation], 238 [[base::mac::OuterBundle() bundlePath] fileSystemRepresentation],
239 dmg_bsd_device_name); 239 dmg_bsd_device_name);
240 } 240 }
241 241
242 // Shows a dialog asking the user whether or not to install from the disk 242 // Shows a dialog asking the user whether or not to install from the disk
243 // image. Returns true if the user approves installation. 243 // image. Returns true if the user approves installation.
244 bool ShouldInstallDialog() { 244 bool ShouldInstallDialog() {
245 NSString* title = l10n_util::GetNSStringFWithFixup( 245 NSString* title = l10n_util::GetNSStringFWithFixup(
246 IDS_INSTALL_FROM_DMG_TITLE, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 246 IDS_INSTALL_FROM_DMG_TITLE, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
247 NSString* prompt = l10n_util::GetNSStringFWithFixup( 247 NSString* prompt = l10n_util::GetNSStringFWithFixup(
248 IDS_INSTALL_FROM_DMG_PROMPT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 248 IDS_INSTALL_FROM_DMG_PROMPT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 BOOL is_directory; 419 BOOL is_directory;
420 if (![file_manager fileExistsAtPath:application_directory 420 if (![file_manager fileExistsAtPath:application_directory
421 isDirectory:&is_directory] || 421 isDirectory:&is_directory] ||
422 !is_directory) { 422 !is_directory) {
423 VLOG(1) << "No application directory at " 423 VLOG(1) << "No application directory at "
424 << [application_directory UTF8String]; 424 << [application_directory UTF8String];
425 return false; 425 return false;
426 } 426 }
427 427
428 NSString* source_path = [[NSBundle mainBundle] bundlePath]; 428 NSString* source_path = [base::mac::OuterBundle() bundlePath];
429 NSString* application_name = [source_path lastPathComponent]; 429 NSString* application_name = [source_path lastPathComponent];
430 NSString* target_path = 430 NSString* target_path =
431 [application_directory stringByAppendingPathComponent:application_name]; 431 [application_directory stringByAppendingPathComponent:application_name];
432 432
433 if ([file_manager fileExistsAtPath:target_path]) { 433 if ([file_manager fileExistsAtPath:target_path]) {
434 VLOG(1) << "Something already exists at " << [target_path UTF8String]; 434 VLOG(1) << "Something already exists at " << [target_path UTF8String];
435 return false; 435 return false;
436 } 436 }
437 437
438 NSString* installer_path = 438 NSString* installer_path =
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( 674 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>(
675 trash_path.value().c_str()); 675 trash_path.value().c_str());
676 status = FNNotifyByPath(trash_path_u8, 676 status = FNNotifyByPath(trash_path_u8,
677 kFNDirectoryModifiedMessage, 677 kFNDirectoryModifiedMessage,
678 kNilOptions); 678 kNilOptions);
679 if (status != noErr) { 679 if (status != noErr) {
680 LOG(ERROR) << "FNNotifyByPath: " << status; 680 LOG(ERROR) << "FNNotifyByPath: " << status;
681 return; 681 return;
682 } 682 }
683 } 683 }
OLDNEW
« no previous file with comments | « base/mac/mac_util.mm ('k') | chrome/browser/mac/keystone_glue.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698