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

Side by Side Diff: chrome/browser/views/browser_actions_container.cc

Issue 2825018: Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/browser_actions_container.h" 5 #include "chrome/browser/views/browser_actions_container.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/slide_animation.h" 9 #include "app/slide_animation.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 button_->Destroy(); 316 button_->Destroy();
317 } 317 }
318 318
319 gfx::Canvas* BrowserActionView::GetIconWithBadge() { 319 gfx::Canvas* BrowserActionView::GetIconWithBadge() {
320 int tab_id = panel_->GetCurrentTabId(); 320 int tab_id = panel_->GetCurrentTabId();
321 321
322 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id); 322 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id);
323 if (icon.isNull()) 323 if (icon.isNull())
324 icon = button_->default_icon(); 324 icon = button_->default_icon();
325 325
326 // TODO(beng): Convert to CanvasSkia 326 gfx::Canvas* canvas =
327 gfx::Canvas* canvas = new gfx::Canvas(icon.width(), icon.height(), false); 327 new gfx::CanvasSkia(icon.width(), icon.height(), false);
328 canvas->DrawBitmapInt(icon, 0, 0); 328 canvas->DrawBitmapInt(icon, 0, 0);
329 329
330 if (tab_id >= 0) { 330 if (tab_id >= 0) {
331 gfx::Rect bounds = 331 gfx::Rect bounds =
332 gfx::Rect(icon.width(), icon.height() + kControlVertOffset); 332 gfx::Rect(icon.width(), icon.height() + kControlVertOffset);
333 button_->extension()->browser_action()->PaintBadge(canvas, 333 button_->extension()->browser_action()->PaintBadge(canvas,
334 bounds, tab_id); 334 bounds, tab_id);
335 } 335 }
336 336
337 return canvas; 337 return canvas;
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 popup_ = NULL; 1163 popup_ = NULL;
1164 popup_button_->SetButtonNotPushed(); 1164 popup_button_->SetButtonNotPushed();
1165 popup_button_ = NULL; 1165 popup_button_ = NULL;
1166 } 1166 }
1167 1167
1168 bool BrowserActionsContainer::ShouldDisplayBrowserAction(Extension* extension) { 1168 bool BrowserActionsContainer::ShouldDisplayBrowserAction(Extension* extension) {
1169 // Only display incognito-enabled extensions while in incognito mode. 1169 // Only display incognito-enabled extensions while in incognito mode.
1170 return (!profile_->IsOffTheRecord() || 1170 return (!profile_->IsOffTheRecord() ||
1171 profile_->GetExtensionsService()->IsIncognitoEnabled(extension)); 1171 profile_->GetExtensionsService()->IsIncognitoEnabled(extension));
1172 } 1172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698