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/extensions/icon_with_badge_image_source.h" | 5 #include "chrome/browser/ui/extensions/icon_with_badge_image_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 grayscale_(false), | 116 grayscale_(false), |
117 paint_page_action_decoration_(false), | 117 paint_page_action_decoration_(false), |
118 paint_blocked_actions_decoration_(false) {} | 118 paint_blocked_actions_decoration_(false) {} |
119 | 119 |
120 IconWithBadgeImageSource::~IconWithBadgeImageSource() {} | 120 IconWithBadgeImageSource::~IconWithBadgeImageSource() {} |
121 | 121 |
122 void IconWithBadgeImageSource::SetIcon(const gfx::Image& icon) { | 122 void IconWithBadgeImageSource::SetIcon(const gfx::Image& icon) { |
123 icon_ = icon; | 123 icon_ = icon; |
124 } | 124 } |
125 | 125 |
126 void IconWithBadgeImageSource::SetBadge(scoped_ptr<Badge> badge) { | 126 void IconWithBadgeImageSource::SetBadge(std::unique_ptr<Badge> badge) { |
127 badge_ = std::move(badge); | 127 badge_ = std::move(badge); |
128 } | 128 } |
129 | 129 |
130 void IconWithBadgeImageSource::Draw(gfx::Canvas* canvas) { | 130 void IconWithBadgeImageSource::Draw(gfx::Canvas* canvas) { |
131 if (icon_.IsEmpty()) | 131 if (icon_.IsEmpty()) |
132 return; | 132 return; |
133 | 133 |
134 gfx::ImageSkia skia = icon_.AsImageSkia(); | 134 gfx::ImageSkia skia = icon_.AsImageSkia(); |
135 gfx::ImageSkiaRep rep = skia.GetRepresentation(canvas->image_scale()); | 135 gfx::ImageSkiaRep rep = skia.GetRepresentation(canvas->image_scale()); |
136 if (rep.scale() != canvas->image_scale()) { | 136 if (rep.scale() != canvas->image_scale()) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 void IconWithBadgeImageSource::PaintBlockedActionDecoration( | 291 void IconWithBadgeImageSource::PaintBlockedActionDecoration( |
292 gfx::Canvas* canvas) { | 292 gfx::Canvas* canvas) { |
293 canvas->Save(); | 293 canvas->Save(); |
294 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 294 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
295 IDR_BLOCKED_EXTENSION_SCRIPT); | 295 IDR_BLOCKED_EXTENSION_SCRIPT); |
296 canvas->DrawImageInt(img, size().width() - img.width(), 0); | 296 canvas->DrawImageInt(img, size().width() - img.width(), 0); |
297 canvas->Restore(); | 297 canvas->Restore(); |
298 } | 298 } |
OLD | NEW |