Chromium Code Reviews| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 | 430 |
| 431 NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; | 431 NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; |
| 432 return base::FilePath([path_string fileSystemRepresentation]); | 432 return base::FilePath([path_string fileSystemRepresentation]); |
| 433 } | 433 } |
| 434 | 434 |
| 435 bool CreatePlatformShortcuts( | 435 bool CreatePlatformShortcuts( |
| 436 const base::FilePath& web_app_path, | 436 const base::FilePath& web_app_path, |
| 437 const ShellIntegration::ShortcutInfo& shortcut_info, | 437 const ShellIntegration::ShortcutInfo& shortcut_info, |
| 438 const ShellIntegration::ShortcutLocations& /*creation_locations*/) { | 438 const ShellIntegration::ShortcutLocations& /*creation_locations*/) { |
| 439 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 439 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 440 string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); | 440 WebAppShortcutCreator shortcut_creator( |
| 441 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, | 441 web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| 442 bundle_id); | |
| 443 return shortcut_creator.CreateShortcut(); | 442 return shortcut_creator.CreateShortcut(); |
| 444 } | 443 } |
| 445 | 444 |
| 446 void DeletePlatformShortcuts( | 445 void DeletePlatformShortcuts( |
| 447 const base::FilePath& web_app_path, | 446 const base::FilePath& web_app_path, |
| 448 const ShellIntegration::ShortcutInfo& info) { | 447 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 449 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 448 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 450 | 449 WebAppShortcutCreator shortcut_creator( |
| 451 base::FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); | 450 web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| 452 file_util::Delete(bundle_path, true); | 451 file_util::Delete(shortcut_creator.GetShortcutPath(), true); |
|
tapted
2013/06/11 06:40:08
web_app_win.cc also checks whether the `Chrome App
jackhou1
2013/06/12 07:43:50
Done.
| |
| 453 } | 452 } |
| 454 | 453 |
| 455 void UpdatePlatformShortcuts( | 454 void UpdatePlatformShortcuts( |
| 456 const base::FilePath& web_app_path, | 455 const base::FilePath& web_app_path, |
| 457 const string16& old_app_title, | 456 const string16& /*old_app_title*/, |
| 458 const ShellIntegration::ShortcutInfo& shortcut_info) { | 457 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 459 // TODO(benwells): Implement this when shortcuts / weblings are enabled on | 458 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 460 // mac. | 459 WebAppShortcutCreator shortcut_creator( |
| 460 web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); | |
| 461 shortcut_creator.CreateShortcut(); | |
|
tapted
2013/06/11 06:40:08
I wonder if there are any downsides to copying ove
jackhou1
2013/06/12 07:43:50
Seems to be fine to delete first. The app is resta
| |
| 461 } | 462 } |
| 462 | 463 |
| 463 } // namespace internals | 464 } // namespace internals |
| 464 | 465 |
| 465 } // namespace web_app | 466 } // namespace web_app |
| OLD | NEW |