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

Side by Side Diff: extensions/common/image_util.cc

Issue 782693002: Ensure there are always nice icons for bookmark apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review; test Created 6 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/image_util.h" 5 #include "extensions/common/image_util.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 namespace image_util { 14 namespace image_util {
15 15
(...skipping 18 matching lines...) Expand all
34 // Convert the string to an integer and make sure it is in the correct value 34 // Convert the string to an integer and make sure it is in the correct value
35 // range. 35 // range.
36 std::vector<uint8_t> color_bytes; 36 std::vector<uint8_t> color_bytes;
37 if (!base::HexStringToBytes(formatted_color, &color_bytes)) 37 if (!base::HexStringToBytes(formatted_color, &color_bytes))
38 return false; 38 return false;
39 39
40 *result = SkColorSetARGB(255, color_bytes[0], color_bytes[1], color_bytes[2]); 40 *result = SkColorSetARGB(255, color_bytes[0], color_bytes[1], color_bytes[2]);
41 return true; 41 return true;
42 } 42 }
43 43
44 std::string GenerateCSSColorString(SkColor color) {
45 char buffer[8];
46
47 sprintf(buffer, "#%02X%02X%02X", SkColorGetR(color), SkColorGetG(color),
48 SkColorGetB(color));
49 return std::string(buffer);
calamity 2014/12/09 03:46:12 Use base::StringPrintf instead. Fixed size buffers
benwells 2014/12/09 08:28:35 Done.
50 }
51
44 } // namespace image_util 52 } // namespace image_util
45 } // namespace extensions 53 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698