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/views/browser_action_view.h" | 5 #include "chrome/browser/ui/views/browser_action_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 button_->Destroy(); | 354 button_->Destroy(); |
355 } | 355 } |
356 | 356 |
357 gfx::Canvas* BrowserActionView::GetIconWithBadge() { | 357 gfx::Canvas* BrowserActionView::GetIconWithBadge() { |
358 int tab_id = panel_->GetCurrentTabId(); | 358 int tab_id = panel_->GetCurrentTabId(); |
359 | 359 |
360 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id); | 360 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id); |
361 if (icon.isNull()) | 361 if (icon.isNull()) |
362 icon = button_->default_icon(); | 362 icon = button_->default_icon(); |
363 | 363 |
364 gfx::Canvas* canvas = new gfx::Canvas(icon, false); | 364 gfx::Canvas* canvas = |
| 365 new gfx::Canvas(gfx::ImageSkiaRep(icon, ui::SCALE_FACTOR_100P), false); |
365 | 366 |
366 if (tab_id >= 0) { | 367 if (tab_id >= 0) { |
367 gfx::Rect bounds(icon.width(), icon.height() + ToolbarView::kVertSpacing); | 368 gfx::Rect bounds(icon.width(), icon.height() + ToolbarView::kVertSpacing); |
368 button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id); | 369 button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id); |
369 } | 370 } |
370 | 371 |
371 return canvas; | 372 return canvas; |
372 } | 373 } |
373 | 374 |
374 void BrowserActionView::Layout() { | 375 void BrowserActionView::Layout() { |
(...skipping 14 matching lines...) Expand all Loading... |
389 state->role = ui::AccessibilityTypes::ROLE_GROUPING; | 390 state->role = ui::AccessibilityTypes::ROLE_GROUPING; |
390 } | 391 } |
391 | 392 |
392 void BrowserActionView::PaintChildren(gfx::Canvas* canvas) { | 393 void BrowserActionView::PaintChildren(gfx::Canvas* canvas) { |
393 View::PaintChildren(canvas); | 394 View::PaintChildren(canvas); |
394 ExtensionAction* action = button()->browser_action(); | 395 ExtensionAction* action = button()->browser_action(); |
395 int tab_id = panel_->GetCurrentTabId(); | 396 int tab_id = panel_->GetCurrentTabId(); |
396 if (tab_id >= 0) | 397 if (tab_id >= 0) |
397 action->PaintBadge(canvas, gfx::Rect(width(), height()), tab_id); | 398 action->PaintBadge(canvas, gfx::Rect(width(), height()), tab_id); |
398 } | 399 } |
OLD | NEW |