Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1060)

Side by Side Diff: chrome/browser/extensions/convert_web_app.cc

Issue 382623002: SkBitmap::Config is no more, use SkColorType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed some for chromeos and win Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/extensions/convert_web_app.h" 5 #include "chrome/browser/extensions/convert_web_app.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 // Write the icon files. 129 // Write the icon files.
130 base::FilePath icons_dir = temp_dir.path().AppendASCII(kIconsDirName); 130 base::FilePath icons_dir = temp_dir.path().AppendASCII(kIconsDirName);
131 if (!base::CreateDirectory(icons_dir)) { 131 if (!base::CreateDirectory(icons_dir)) {
132 LOG(ERROR) << "Could not create icons directory."; 132 LOG(ERROR) << "Could not create icons directory.";
133 return NULL; 133 return NULL;
134 } 134 }
135 for (size_t i = 0; i < web_app.icons.size(); ++i) { 135 for (size_t i = 0; i < web_app.icons.size(); ++i) {
136 // Skip unfetched bitmaps. 136 // Skip unfetched bitmaps.
137 if (web_app.icons[i].data.config() == SkBitmap::kNo_Config) 137 if (web_app.icons[i].data.colorType() == kUnknown_SkColorType)
138 continue; 138 continue;
139 139
140 base::FilePath icon_file = icons_dir.AppendASCII( 140 base::FilePath icon_file = icons_dir.AppendASCII(
141 base::StringPrintf("%i.png", web_app.icons[i].width)); 141 base::StringPrintf("%i.png", web_app.icons[i].width));
142 std::vector<unsigned char> image_data; 142 std::vector<unsigned char> image_data;
143 if (!gfx::PNGCodec::EncodeBGRASkBitmap(web_app.icons[i].data, 143 if (!gfx::PNGCodec::EncodeBGRASkBitmap(web_app.icons[i].data,
144 false, 144 false,
145 &image_data)) { 145 &image_data)) {
146 LOG(ERROR) << "Could not create icon file."; 146 LOG(ERROR) << "Could not create icon file.";
147 return NULL; 147 return NULL;
(...skipping 18 matching lines...) Expand all
166 if (!extension.get()) { 166 if (!extension.get()) {
167 LOG(ERROR) << error; 167 LOG(ERROR) << error;
168 return NULL; 168 return NULL;
169 } 169 }
170 170
171 temp_dir.Take(); // The caller takes ownership of the directory. 171 temp_dir.Take(); // The caller takes ownership of the directory.
172 return extension; 172 return extension;
173 } 173 }
174 174
175 } // namespace extensions 175 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698