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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 app_name += ' '; | 262 app_name += ' '; |
263 } | 263 } |
264 app_name += info_.extension_id; | 264 app_name += info_.extension_id; |
265 return base::FilePath(app_name).ReplaceExtension("app"); | 265 return base::FilePath(app_name).ReplaceExtension("app"); |
266 } | 266 } |
267 | 267 |
268 bool WebAppShortcutCreator::BuildShortcut( | 268 bool WebAppShortcutCreator::BuildShortcut( |
269 const base::FilePath& staging_path) const { | 269 const base::FilePath& staging_path) const { |
270 // Update the app's plist and icon in a temp directory. This works around | 270 // Update the app's plist and icon in a temp directory. This works around |
271 // a Finder bug where the app's icon doesn't properly update. | 271 // a Finder bug where the app's icon doesn't properly update. |
272 if (!file_util::CopyDirectory(GetAppLoaderPath(), staging_path, true)) { | 272 if (!base::CopyDirectory(GetAppLoaderPath(), staging_path, true)) { |
273 LOG(ERROR) << "Copying app to staging path: " << staging_path.value() | 273 LOG(ERROR) << "Copying app to staging path: " << staging_path.value() |
274 << " failed."; | 274 << " failed."; |
275 return false; | 275 return false; |
276 } | 276 } |
277 | 277 |
278 if (!UpdatePlist(staging_path)) | 278 if (!UpdatePlist(staging_path)) |
279 return false; | 279 return false; |
280 | 280 |
281 if (!UpdateDisplayName(staging_path)) | 281 if (!UpdateDisplayName(staging_path)) |
282 return false; | 282 return false; |
(...skipping 14 matching lines...) Expand all Loading... |
297 | 297 |
298 base::FilePath app_name = GetShortcutName(); | 298 base::FilePath app_name = GetShortcutName(); |
299 base::FilePath staging_path = | 299 base::FilePath staging_path = |
300 scoped_temp_dir.path().Append(app_name); | 300 scoped_temp_dir.path().Append(app_name); |
301 if (!BuildShortcut(staging_path)) | 301 if (!BuildShortcut(staging_path)) |
302 return 0; | 302 return 0; |
303 | 303 |
304 for (std::vector<base::FilePath>::const_iterator it = folders.begin(); | 304 for (std::vector<base::FilePath>::const_iterator it = folders.begin(); |
305 it != folders.end(); ++it) { | 305 it != folders.end(); ++it) { |
306 const base::FilePath& dst_path = *it; | 306 const base::FilePath& dst_path = *it; |
307 if (!file_util::CopyDirectory(staging_path, dst_path, true)) { | 307 if (!base::CopyDirectory(staging_path, dst_path, true)) { |
308 LOG(ERROR) << "Copying app to dst path: " << dst_path.value() | 308 LOG(ERROR) << "Copying app to dst path: " << dst_path.value() |
309 << " failed"; | 309 << " failed"; |
310 return succeeded; | 310 return succeeded; |
311 } | 311 } |
312 | 312 |
313 base::mac::RemoveQuarantineAttribute(dst_path.Append(app_name)); | 313 base::mac::RemoveQuarantineAttribute(dst_path.Append(app_name)); |
314 ++succeeded; | 314 ++succeeded; |
315 } | 315 } |
316 | 316 |
317 return succeeded; | 317 return succeeded; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 const ShellIntegration::ShortcutInfo& shortcut_info) { | 620 const ShellIntegration::ShortcutInfo& shortcut_info) { |
621 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 621 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
622 WebAppShortcutCreator shortcut_creator( | 622 WebAppShortcutCreator shortcut_creator( |
623 app_data_path, shortcut_info, base::mac::BaseBundleID()); | 623 app_data_path, shortcut_info, base::mac::BaseBundleID()); |
624 shortcut_creator.UpdateShortcuts(); | 624 shortcut_creator.UpdateShortcuts(); |
625 } | 625 } |
626 | 626 |
627 } // namespace internals | 627 } // namespace internals |
628 | 628 |
629 } // namespace web_app | 629 } // namespace web_app |
OLD | NEW |