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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 shortcut_creator.UpdateShortcuts(); | 625 shortcut_creator.UpdateShortcuts(); |
626 } | 626 } |
627 | 627 |
628 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { | 628 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { |
629 // TODO(mgiuca): Implement this on Mac. | 629 // TODO(mgiuca): Implement this on Mac. |
630 } | 630 } |
631 | 631 |
632 } // namespace internals | 632 } // namespace internals |
633 | 633 |
634 } // namespace web_app | 634 } // namespace web_app |
OLD | NEW |