| 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 #include "chrome/browser/web_applications/web_app_mac.h" | 5 #include "chrome/browser/web_applications/web_app_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 [NSMutableDictionary dictionaryWithContentsOfFile:plist_path]; | 110 [NSMutableDictionary dictionaryWithContentsOfFile:plist_path]; |
| 111 | 111 |
| 112 [dict setObject:base::SysUTF8ToNSString(info_.extension_id) | 112 [dict setObject:base::SysUTF8ToNSString(info_.extension_id) |
| 113 forKey:app_mode::kCrAppModeShortcutIDKey]; | 113 forKey:app_mode::kCrAppModeShortcutIDKey]; |
| 114 [dict setObject:base::SysUTF16ToNSString(info_.title) | 114 [dict setObject:base::SysUTF16ToNSString(info_.title) |
| 115 forKey:app_mode::kCrAppModeShortcutNameKey]; | 115 forKey:app_mode::kCrAppModeShortcutNameKey]; |
| 116 [dict setObject:base::SysUTF8ToNSString(info_.url.spec()) | 116 [dict setObject:base::SysUTF8ToNSString(info_.url.spec()) |
| 117 forKey:app_mode::kCrAppModeShortcutURLKey]; | 117 forKey:app_mode::kCrAppModeShortcutURLKey]; |
| 118 [dict setObject:base::mac::FilePathToNSString(user_data_dir_) | 118 [dict setObject:base::mac::FilePathToNSString(user_data_dir_) |
| 119 forKey:app_mode::kCrAppModeUserDataDirKey]; | 119 forKey:app_mode::kCrAppModeUserDataDirKey]; |
| 120 [dict setObject:base::mac::FilePathToNSString(info_.extension_path) |
| 121 forKey:app_mode::kCrAppModeExtensionPathKey]; |
| 120 return [dict writeToFile:plist_path atomically:YES]; | 122 return [dict writeToFile:plist_path atomically:YES]; |
| 121 } | 123 } |
| 122 | 124 |
| 123 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { | 125 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { |
| 124 // TODO(sail): Add support for multiple icon sizes. | 126 // TODO(sail): Add support for multiple icon sizes. |
| 125 if (info_.favicon.empty() || info_.favicon.width() != 32 || | 127 if (info_.favicon.empty() || info_.favicon.width() != 32 || |
| 126 info_.favicon.height() != 32) { | 128 info_.favicon.height() != 32) { |
| 127 return true; | 129 return true; |
| 128 } | 130 } |
| 129 | 131 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 158 void CreateShortcutTask(const FilePath& web_app_path, | 160 void CreateShortcutTask(const FilePath& web_app_path, |
| 159 const FilePath& profile_path, | 161 const FilePath& profile_path, |
| 160 const ShellIntegration::ShortcutInfo& shortcut_info) { | 162 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 161 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 163 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 162 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info); | 164 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info); |
| 163 shortcut_creator.CreateShortcut(); | 165 shortcut_creator.CreateShortcut(); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace internals | 168 } // namespace internals |
| 167 } // namespace web_app | 169 } // namespace web_app |
| OLD | NEW |