| 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 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 25 #include "skia/ext/image_operations.h" | 25 #include "skia/ext/image_operations.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/codec/png_codec.h" | 27 #include "ui/gfx/codec/png_codec.h" |
| 28 #include "ui/gfx/color_utils.h" | 28 #include "ui/gfx/color_utils.h" |
| 29 #include "ui/gfx/skbitmap_operations.h" | 29 #include "ui/gfx/skbitmap_operations.h" |
| 30 #include "webkit/glue/image_decoder.h" | 30 #include "webkit/glue/image_decoder.h" |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 scoped_refptr<RefCountedMemory> BitmapToMemory(const SkBitmap* image) { | 34 scoped_refptr<base::RefCountedMemory> BitmapToMemory(const SkBitmap* image) { |
| 35 base::RefCountedBytes* image_bytes = new base::RefCountedBytes; | 35 base::RefCountedBytes* image_bytes = new base::RefCountedBytes; |
| 36 gfx::PNGCodec::EncodeBGRASkBitmap(*image, false, &image_bytes->data()); | 36 gfx::PNGCodec::EncodeBGRASkBitmap(*image, false, &image_bytes->data()); |
| 37 return image_bytes; | 37 return image_bytes; |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkBitmap DesaturateImage(const SkBitmap* image) { | 40 SkBitmap DesaturateImage(const SkBitmap* image) { |
| 41 color_utils::HSL shift = {-1, 0, 0.6}; | 41 color_utils::HSL shift = {-1, 0, 0.6}; |
| 42 return SkBitmapOperations::CreateHSLShiftedBitmap(*image, shift); | 42 return SkBitmapOperations::CreateHSLShiftedBitmap(*image, shift); |
| 43 } | 43 } |
| 44 | 44 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 void ExtensionIconSource::ClearData(int request_id) { | 337 void ExtensionIconSource::ClearData(int request_id) { |
| 338 std::map<int, ExtensionIconRequest*>::iterator i = | 338 std::map<int, ExtensionIconRequest*>::iterator i = |
| 339 request_map_.find(request_id); | 339 request_map_.find(request_id); |
| 340 if (i == request_map_.end()) | 340 if (i == request_map_.end()) |
| 341 return; | 341 return; |
| 342 | 342 |
| 343 delete i->second; | 343 delete i->second; |
| 344 request_map_.erase(i); | 344 request_map_.erase(i); |
| 345 } | 345 } |
| OLD | NEW |