| 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 <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/files/scoped_temp_dir.h" |
| 10 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 11 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
| 13 #include "base/memory/scoped_nsobject.h" | 14 #include "base/memory/scoped_nsobject.h" |
| 14 #include "base/scoped_temp_dir.h" | |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/web_applications/web_app.h" | 17 #include "chrome/browser/web_applications/web_app.h" |
| 18 #include "chrome/common/chrome_paths_internal.h" | 18 #include "chrome/common/chrome_paths_internal.h" |
| 19 #include "chrome/common/mac/app_mode_common.h" | 19 #include "chrome/common/mac/app_mode_common.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "grit/chromium_strings.h" | 21 #include "grit/chromium_strings.h" |
| 22 #include "skia/ext/skia_utils_mac.h" | 22 #include "skia/ext/skia_utils_mac.h" |
| 23 #include "third_party/icon_family/IconFamily.h" | 23 #include "third_party/icon_family/IconFamily.h" |
| 24 #include "ui/base/l10n/l10n_util_mac.h" | 24 #include "ui/base/l10n/l10n_util_mac.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 info_(shortcut_info), | 91 info_(shortcut_info), |
| 92 chrome_bundle_id_(chrome_bundle_id) { | 92 chrome_bundle_id_(chrome_bundle_id) { |
| 93 } | 93 } |
| 94 | 94 |
| 95 WebAppShortcutCreator::~WebAppShortcutCreator() { | 95 WebAppShortcutCreator::~WebAppShortcutCreator() { |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool WebAppShortcutCreator::CreateShortcut() { | 98 bool WebAppShortcutCreator::CreateShortcut() { |
| 99 FilePath app_name = internals::GetSanitizedFileName(info_.title); | 99 FilePath app_name = internals::GetSanitizedFileName(info_.title); |
| 100 FilePath app_file_name = app_name.ReplaceExtension("app"); | 100 FilePath app_file_name = app_name.ReplaceExtension("app"); |
| 101 ScopedTempDir scoped_temp_dir; | 101 base::ScopedTempDir scoped_temp_dir; |
| 102 if (!scoped_temp_dir.CreateUniqueTempDir()) | 102 if (!scoped_temp_dir.CreateUniqueTempDir()) |
| 103 return false; | 103 return false; |
| 104 FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); | 104 FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); |
| 105 | 105 |
| 106 // Update the app's plist and icon in a temp directory. This works around | 106 // Update the app's plist and icon in a temp directory. This works around |
| 107 // a Finder bug where the app's icon doesn't properly update. | 107 // a Finder bug where the app's icon doesn't properly update. |
| 108 if (!file_util::CopyDirectory(GetAppLoaderPath(), staging_path, true)) { | 108 if (!file_util::CopyDirectory(GetAppLoaderPath(), staging_path, true)) { |
| 109 LOG(ERROR) << "Copying app to staging path: " << staging_path.value() | 109 LOG(ERROR) << "Copying app to staging path: " << staging_path.value() |
| 110 << " failed"; | 110 << " failed"; |
| 111 return false; | 111 return false; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void UpdatePlatformShortcuts( | 273 void UpdatePlatformShortcuts( |
| 274 const FilePath& web_app_path, | 274 const FilePath& web_app_path, |
| 275 const ShellIntegration::ShortcutInfo& shortcut_info) { | 275 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 276 // TODO(benwells): Implement this when shortcuts / weblings are enabled on | 276 // TODO(benwells): Implement this when shortcuts / weblings are enabled on |
| 277 // mac. | 277 // mac. |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace internals | 280 } // namespace internals |
| 281 | 281 |
| 282 } // namespace web_app | 282 } // namespace web_app |
| OLD | NEW |