OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/app_list/fast_show_pickler.h" | 5 #include "chrome/browser/ui/app_list/fast_show_pickler.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "ui/app_list/app_list_item.h" | 8 #include "ui/app_list/app_list_item.h" |
9 #include "ui/gfx/image/image_skia_rep.h" | 9 #include "ui/gfx/image/image_skia_rep.h" |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 int size = 0; | 126 int size = 0; |
127 if (!it->ReadInt(&size)) | 127 if (!it->ReadInt(&size)) |
128 return false; | 128 return false; |
129 | 129 |
130 const char* pixels = NULL; | 130 const char* pixels = NULL; |
131 if (!it->ReadBytes(&pixels, size)) | 131 if (!it->ReadBytes(&pixels, size)) |
132 return false; | 132 return false; |
133 | 133 |
134 SkBitmap bitmap; | 134 SkBitmap bitmap; |
135 if (!bitmap.allocPixels(SkImageInfo::Make( | 135 if (!bitmap.tryAllocPixels(SkImageInfo::Make( |
136 width, height, color_type, kPremul_SkAlphaType))) | 136 width, height, color_type, kPremul_SkAlphaType))) |
137 return false; | 137 return false; |
138 | 138 |
139 memcpy(bitmap.getPixels(), pixels, bitmap.getSize()); | 139 memcpy(bitmap.getPixels(), pixels, bitmap.getSize()); |
140 result.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale)); | 140 result.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale)); |
141 } | 141 } |
142 | 142 |
143 *out = result; | 143 *out = result; |
144 return true; | 144 return true; |
145 } | 145 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 for (int i = 0; i < app_count; ++i) { | 236 for (int i = 0; i < app_count; ++i) { |
237 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass()); | 237 scoped_ptr<AppListItem> item(UnpickleAppListItem(&it).Pass()); |
238 if (!item) | 238 if (!item) |
239 return scoped_ptr<AppListModel>(); | 239 return scoped_ptr<AppListModel>(); |
240 std::string folder_id = item->folder_id(); | 240 std::string folder_id = item->folder_id(); |
241 model->AddItemToFolder(item.Pass(), folder_id); | 241 model->AddItemToFolder(item.Pass(), folder_id); |
242 } | 242 } |
243 | 243 |
244 return model.Pass(); | 244 return model.Pass(); |
245 } | 245 } |
OLD | NEW |