Added stub MediaSourcePlayer for developing behind the flag
[chromium-blink-merge.git] / chrome / common / icon_with_badge_image_source.cc
blobd3d785b9fcd8fb33897b86269bf881799bd5ba03
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
3 // found in the LICENSE file.
5 #include "chrome/common/icon_with_badge_image_source.h"
7 #include "chrome/common/badge_util.h"
8 //#include "ui/base/layout.h"
9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/geometry/rect.h"
12 IconWithBadgeImageSource::IconWithBadgeImageSource(
13 const gfx::ImageSkia& icon,
14 const gfx::Size& icon_size,
15 const gfx::Size& spacing,
16 const std::string& text,
17 const SkColor& text_color,
18 const SkColor& background_color,
19 extensions::ActionInfo::Type action_type)
20 : gfx::CanvasImageSource(icon_size, false),
21 icon_(icon),
22 spacing_(spacing),
23 text_(text),
24 text_color_(text_color),
25 background_color_(background_color),
26 action_type_(action_type) {
29 IconWithBadgeImageSource::~IconWithBadgeImageSource() {}
31 void IconWithBadgeImageSource::Draw(gfx::Canvas* canvas) {
32 canvas->DrawImageInt(icon_, 0, 0, SkPaint());
33 gfx::Rect bounds(size_.width() + spacing_.width(),
34 size_.height() + spacing_.height());
36 // Draw a badge on the provided browser action icon's canvas.
37 badge_util::PaintBadge(canvas, bounds, text_, text_color_,
38 background_color_, size_.width(),
39 action_type_);