| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 button_->Destroy(); | 297 button_->Destroy(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 gfx::Canvas* BrowserActionView::GetIconWithBadge() { | 300 gfx::Canvas* BrowserActionView::GetIconWithBadge() { |
| 301 int tab_id = panel_->GetCurrentTabId(); | 301 int tab_id = panel_->GetCurrentTabId(); |
| 302 | 302 |
| 303 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id); | 303 SkBitmap icon = button_->extension()->browser_action()->GetIcon(tab_id); |
| 304 if (icon.isNull()) | 304 if (icon.isNull()) |
| 305 icon = button_->default_icon(); | 305 icon = button_->default_icon(); |
| 306 | 306 |
| 307 gfx::Canvas* canvas = new gfx::CanvasSkia(icon.width(), icon.height(), false); | 307 gfx::CanvasSkia* canvas = new gfx::CanvasSkia; |
| 308 canvas->Init(icon.width(), icon.height(), false); |
| 308 canvas->DrawBitmapInt(icon, 0, 0); | 309 canvas->DrawBitmapInt(icon, 0, 0); |
| 309 | 310 |
| 310 if (tab_id >= 0) { | 311 if (tab_id >= 0) { |
| 311 gfx::Rect bounds(icon.width(), icon.height() + ToolbarView::kVertSpacing); | 312 gfx::Rect bounds(icon.width(), icon.height() + ToolbarView::kVertSpacing); |
| 312 button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id); | 313 button_->extension()->browser_action()->PaintBadge(canvas, bounds, tab_id); |
| 313 } | 314 } |
| 314 | 315 |
| 315 return canvas; | 316 return canvas; |
| 316 } | 317 } |
| 317 | 318 |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 } | 1094 } |
| 1094 } | 1095 } |
| 1095 | 1096 |
| 1096 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1097 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1097 const Extension* extension) { | 1098 const Extension* extension) { |
| 1098 // Only display incognito-enabled extensions while in incognito mode. | 1099 // Only display incognito-enabled extensions while in incognito mode. |
| 1099 return | 1100 return |
| 1100 (!profile_->IsOffTheRecord() || | 1101 (!profile_->IsOffTheRecord() || |
| 1101 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1102 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 1102 } | 1103 } |
| OLD | NEW |