| 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/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 forKey:app_mode::kCrAppModeExtensionPathKey]; | 191 forKey:app_mode::kCrAppModeExtensionPathKey]; |
| 192 return [plist writeToFile:plist_path atomically:YES]; | 192 return [plist writeToFile:plist_path atomically:YES]; |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { | 195 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { |
| 196 if (info_.favicon.IsEmpty()) | 196 if (info_.favicon.IsEmpty()) |
| 197 return true; | 197 return true; |
| 198 | 198 |
| 199 scoped_nsobject<IconFamily> icon_family([[IconFamily alloc] init]); | 199 scoped_nsobject<IconFamily> icon_family([[IconFamily alloc] init]); |
| 200 bool image_added = false; | 200 bool image_added = false; |
| 201 const std::vector<const SkBitmap*>& bitmaps = | 201 const std::vector<SkBitmap>& bitmaps = info_.favicon.ToImageSkia()->bitmaps(); |
| 202 info_.favicon.ToImageSkia()->bitmaps(); | |
| 203 for (size_t i = 0; i < bitmaps.size(); ++i) { | 202 for (size_t i = 0; i < bitmaps.size(); ++i) { |
| 204 NSBitmapImageRep* image_rep = SkBitmapToImageRep(*bitmaps[i]); | 203 NSBitmapImageRep* image_rep = SkBitmapToImageRep(bitmaps[i]); |
| 205 if (!image_rep) | 204 if (!image_rep) |
| 206 continue; | 205 continue; |
| 207 | 206 |
| 208 // Missing an icon size is not fatal so don't fail if adding the bitmap | 207 // Missing an icon size is not fatal so don't fail if adding the bitmap |
| 209 // doesn't work. | 208 // doesn't work. |
| 210 if (!AddBitmapImageRepToIconFamily(icon_family, image_rep)) | 209 if (!AddBitmapImageRepToIconFamily(icon_family, image_rep)) |
| 211 continue; | 210 continue; |
| 212 | 211 |
| 213 image_added = true; | 212 image_added = true; |
| 214 } | 213 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 const ShellIntegration::ShortcutInfo& shortcut_info) { | 255 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 257 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 256 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 258 string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); | 257 string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); |
| 259 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, | 258 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, |
| 260 bundle_id); | 259 bundle_id); |
| 261 return shortcut_creator.CreateShortcut(); | 260 return shortcut_creator.CreateShortcut(); |
| 262 } | 261 } |
| 263 | 262 |
| 264 } // namespace internals | 263 } // namespace internals |
| 265 } // namespace web_app | 264 } // namespace web_app |
| OLD | NEW |