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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 ScopedCarbonHandle raw_data(bitmap.getSize()); | 123 ScopedCarbonHandle raw_data(bitmap.getSize()); |
124 ConvertSkiaToARGB(bitmap, &raw_data); | 124 ConvertSkiaToARGB(bitmap, &raw_data); |
125 OSErr result = SetIconFamilyData(icon_family, icon_type, raw_data.Get()); | 125 OSErr result = SetIconFamilyData(icon_family, icon_type, raw_data.Get()); |
126 DCHECK_EQ(noErr, result); | 126 DCHECK_EQ(noErr, result); |
127 return result == noErr; | 127 return result == noErr; |
128 } | 128 } |
129 | 129 |
130 base::FilePath GetWritableApplicationsDirectory() { | 130 base::FilePath GetWritableApplicationsDirectory() { |
131 base::FilePath path; | 131 base::FilePath path; |
132 if (base::mac::GetLocalDirectory(NSApplicationDirectory, &path) && | 132 if (base::mac::GetLocalDirectory(NSApplicationDirectory, &path) && |
133 file_util::PathIsWritable(path)) { | 133 base::PathIsWritable(path)) { |
134 return path; | 134 return path; |
135 } | 135 } |
136 if (base::mac::GetUserDirectory(NSApplicationDirectory, &path)) | 136 if (base::mac::GetUserDirectory(NSApplicationDirectory, &path)) |
137 return path; | 137 return path; |
138 return base::FilePath(); | 138 return base::FilePath(); |
139 } | 139 } |
140 | 140 |
141 // Given the path to an app bundle, return the resources directory. | 141 // Given the path to an app bundle, return the resources directory. |
142 base::FilePath GetResourcesPath(const base::FilePath& app_path) { | 142 base::FilePath GetResourcesPath(const base::FilePath& app_path) { |
143 return app_path.Append("Contents").Append("Resources"); | 143 return app_path.Append("Contents").Append("Resources"); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 base::mac::RemoveQuarantineAttribute(dst_path.Append(app_name)); | 378 base::mac::RemoveQuarantineAttribute(dst_path.Append(app_name)); |
379 ++succeeded; | 379 ++succeeded; |
380 } | 380 } |
381 | 381 |
382 return succeeded; | 382 return succeeded; |
383 } | 383 } |
384 | 384 |
385 bool WebAppShortcutCreator::CreateShortcuts() { | 385 bool WebAppShortcutCreator::CreateShortcuts() { |
386 base::FilePath dst_path = GetDestinationPath(); | 386 base::FilePath dst_path = GetDestinationPath(); |
387 if (dst_path.empty() || !file_util::DirectoryExists(dst_path.DirName())) { | 387 if (dst_path.empty() || !base::DirectoryExists(dst_path.DirName())) { |
388 LOG(ERROR) << "Couldn't find an Applications directory to copy app to."; | 388 LOG(ERROR) << "Couldn't find an Applications directory to copy app to."; |
389 return false; | 389 return false; |
390 } | 390 } |
391 | 391 |
392 if (!file_util::CreateDirectory(app_data_path_)) { | 392 if (!file_util::CreateDirectory(app_data_path_)) { |
393 LOG(ERROR) << "Creating app_data_path " << app_data_path_.value() | 393 LOG(ERROR) << "Creating app_data_path " << app_data_path_.value() |
394 << " failed."; | 394 << " failed."; |
395 return false; | 395 return false; |
396 } | 396 } |
397 | 397 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 BuildShortcutInfoFromBundle(*it); | 703 BuildShortcutInfoFromBundle(*it); |
704 WebAppShortcutCreator shortcut_creator( | 704 WebAppShortcutCreator shortcut_creator( |
705 it->DirName(), shortcut_info, base::mac::BaseBundleID()); | 705 it->DirName(), shortcut_info, base::mac::BaseBundleID()); |
706 shortcut_creator.DeleteShortcuts(); | 706 shortcut_creator.DeleteShortcuts(); |
707 } | 707 } |
708 } | 708 } |
709 | 709 |
710 } // namespace internals | 710 } // namespace internals |
711 | 711 |
712 } // namespace web_app | 712 } // namespace web_app |
OLD | NEW |