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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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
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/extension_icon_manager.h" 5 #include "chrome/browser/extensions/extension_icon_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "extensions/browser/image_loader.h" 10 #include "extensions/browser/image_loader.h"
(...skipping 16 matching lines...) Expand all
27 #include "ui/gfx/vector_icons_public.h" 27 #include "ui/gfx/vector_icons_public.h"
28 #include "ui/native_theme/common_theme.h" 28 #include "ui/native_theme/common_theme.h"
29 #include "ui/native_theme/native_theme.h" 29 #include "ui/native_theme/native_theme.h"
30 30
31 namespace { 31 namespace {
32 32
33 // Helper function to create a new bitmap with |padding| amount of empty space 33 // Helper function to create a new bitmap with |padding| amount of empty space
34 // around the original bitmap. 34 // around the original bitmap.
35 static SkBitmap ApplyPadding(const SkBitmap& source, 35 static SkBitmap ApplyPadding(const SkBitmap& source,
36 const gfx::Insets& padding) { 36 const gfx::Insets& padding) {
37 scoped_ptr<gfx::Canvas> result( 37 std::unique_ptr<gfx::Canvas> result(
38 new gfx::Canvas(gfx::Size(source.width() + padding.width(), 38 new gfx::Canvas(gfx::Size(source.width() + padding.width(),
39 source.height() + padding.height()), 39 source.height() + padding.height()),
40 1.0f, 40 1.0f, false));
41 false));
42 result->DrawImageInt( 41 result->DrawImageInt(
43 gfx::ImageSkia::CreateFrom1xBitmap(source), 42 gfx::ImageSkia::CreateFrom1xBitmap(source),
44 0, 0, source.width(), source.height(), 43 0, 0, source.width(), source.height(),
45 padding.left(), padding.top(), source.width(), source.height(), 44 padding.left(), padding.top(), source.width(), source.height(),
46 false); 45 false);
47 return result->ExtractImageRep().sk_bitmap(); 46 return result->ExtractImageRep().sk_bitmap();
48 } 47 }
49 48
50 } // namespace 49 } // namespace
51 50
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (monochrome_) { 134 if (monochrome_) {
136 color_utils::HSL shift = {-1, 0, 0.6}; 135 color_utils::HSL shift = {-1, 0, 0.6};
137 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift); 136 result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift);
138 } 137 }
139 138
140 if (!padding_.IsEmpty()) 139 if (!padding_.IsEmpty())
141 result = ApplyPadding(result, padding_); 140 result = ApplyPadding(result, padding_);
142 141
143 return result; 142 return result;
144 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698