| 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 "chrome/browser/web_applications/web_app_mac.h" | 5 #import "chrome/browser/web_applications/web_app_mac.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 [NSMutableDictionary dictionaryWithContentsOfFile:plist_path]; | 526 [NSMutableDictionary dictionaryWithContentsOfFile:plist_path]; |
| 527 | 527 |
| 528 [plist setObject:base::SysUTF8ToNSString(GetInternalBundleIdentifier()) | 528 [plist setObject:base::SysUTF8ToNSString(GetInternalBundleIdentifier()) |
| 529 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]; | 529 forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]; |
| 530 return [plist writeToFile:plist_path | 530 return [plist writeToFile:plist_path |
| 531 atomically:YES]; | 531 atomically:YES]; |
| 532 } | 532 } |
| 533 | 533 |
| 534 base::FilePath WebAppShortcutCreator::GetAppBundleById( | 534 base::FilePath WebAppShortcutCreator::GetAppBundleById( |
| 535 const std::string& bundle_id) const { | 535 const std::string& bundle_id) const { |
| 536 base::mac::ScopedCFTypeRef<CFStringRef> bundle_id_cf( | 536 base::ScopedCFTypeRef<CFStringRef> bundle_id_cf( |
| 537 base::SysUTF8ToCFStringRef(bundle_id)); | 537 base::SysUTF8ToCFStringRef(bundle_id)); |
| 538 CFURLRef url_ref = NULL; | 538 CFURLRef url_ref = NULL; |
| 539 OSStatus status = LSFindApplicationForInfo( | 539 OSStatus status = LSFindApplicationForInfo( |
| 540 kLSUnknownCreator, bundle_id_cf.get(), NULL, NULL, &url_ref); | 540 kLSUnknownCreator, bundle_id_cf.get(), NULL, NULL, &url_ref); |
| 541 if (status != noErr) | 541 if (status != noErr) |
| 542 return base::FilePath(); | 542 return base::FilePath(); |
| 543 | 543 |
| 544 base::mac::ScopedCFTypeRef<CFURLRef> url(url_ref); | 544 base::ScopedCFTypeRef<CFURLRef> url(url_ref); |
| 545 NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; | 545 NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; |
| 546 return base::FilePath([path_string fileSystemRepresentation]); | 546 return base::FilePath([path_string fileSystemRepresentation]); |
| 547 } | 547 } |
| 548 | 548 |
| 549 std::string WebAppShortcutCreator::GetBundleIdentifier() const { | 549 std::string WebAppShortcutCreator::GetBundleIdentifier() const { |
| 550 // Replace spaces in the profile path with hyphen. | 550 // Replace spaces in the profile path with hyphen. |
| 551 std::string normalized_profile_path; | 551 std::string normalized_profile_path; |
| 552 ReplaceChars(info_.profile_path.BaseName().value(), | 552 ReplaceChars(info_.profile_path.BaseName().value(), |
| 553 " ", "-", &normalized_profile_path); | 553 " ", "-", &normalized_profile_path); |
| 554 | 554 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 const ShellIntegration::ShortcutInfo& shortcut_info) { | 621 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 622 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 622 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 623 WebAppShortcutCreator shortcut_creator( | 623 WebAppShortcutCreator shortcut_creator( |
| 624 app_data_path, shortcut_info, base::mac::BaseBundleID()); | 624 app_data_path, shortcut_info, base::mac::BaseBundleID()); |
| 625 shortcut_creator.UpdateShortcuts(); | 625 shortcut_creator.UpdateShortcuts(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 } // namespace internals | 628 } // namespace internals |
| 629 | 629 |
| 630 } // namespace web_app | 630 } // namespace web_app |
| OLD | NEW |