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/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/accessibility/browser_accessibility_state.h" | 10 #include "chrome/browser/accessibility/browser_accessibility_state.h" |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Save the old value before resetting it. | 735 // Save the old value before resetting it. |
736 bool was_showing = incompatibility_badge_showing; | 736 bool was_showing = incompatibility_badge_showing; |
737 incompatibility_badge_showing = false; | 737 incompatibility_badge_showing = false; |
738 #endif | 738 #endif |
739 | 739 |
740 bool add_badge = IsUpgradeRecommended() || ShouldShowIncompatibilityWarning(); | 740 bool add_badge = IsUpgradeRecommended() || ShouldShowIncompatibilityWarning(); |
741 if (!add_badge) | 741 if (!add_badge) |
742 return icon; | 742 return icon; |
743 | 743 |
744 // Draw the chrome app menu icon onto the canvas. | 744 // Draw the chrome app menu icon onto the canvas. |
745 scoped_ptr<gfx::CanvasSkia> canvas( | 745 scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia); |
746 new gfx::CanvasSkia(icon.width(), icon.height(), false)); | 746 canvas->Init(icon.width(), icon.height(), false); |
747 canvas->DrawBitmapInt(icon, 0, 0); | 747 canvas->DrawBitmapInt(icon, 0, 0); |
748 | 748 |
749 SkBitmap badge; | 749 SkBitmap badge; |
750 // Only one badge can be active at any given time. The Upgrade notification | 750 // Only one badge can be active at any given time. The Upgrade notification |
751 // is deemed most important, then the DLL conflict badge. | 751 // is deemed most important, then the DLL conflict badge. |
752 if (IsUpgradeRecommended()) { | 752 if (IsUpgradeRecommended()) { |
753 badge = *tp->GetBitmapNamed(GetUpgradeRecommendedBadge()); | 753 badge = *tp->GetBitmapNamed(GetUpgradeRecommendedBadge()); |
754 } else if (ShouldShowIncompatibilityWarning()) { | 754 } else if (ShouldShowIncompatibilityWarning()) { |
755 #if defined(OS_WIN) | 755 #if defined(OS_WIN) |
756 if (!was_showing) | 756 if (!was_showing) |
757 UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"), profile_); | 757 UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"), profile_); |
758 badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE); | 758 badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE); |
759 incompatibility_badge_showing = true; | 759 incompatibility_badge_showing = true; |
760 #else | 760 #else |
761 NOTREACHED(); | 761 NOTREACHED(); |
762 #endif | 762 #endif |
763 } else { | 763 } else { |
764 NOTREACHED(); | 764 NOTREACHED(); |
765 } | 765 } |
766 | 766 |
767 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); | 767 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); |
768 | 768 |
769 return canvas->ExtractBitmap(); | 769 return canvas->ExtractBitmap(); |
770 } | 770 } |
OLD | NEW |