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

Side by Side Diff: chrome/browser/ui/views/browser_action_view.cc

Issue 10696130: Get rid of implicit conversion to and from ImageSkiaRep (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_item_gtk.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_item_gtk.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698