OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |