| 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/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.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 "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 static const int kPulsateEveryMs = 8000; | 69 static const int kPulsateEveryMs = 8000; |
| 70 | 70 |
| 71 static const int kPopupTopSpacingNonGlass = 3; | 71 static const int kPopupTopSpacingNonGlass = 3; |
| 72 static const int kPopupBottomSpacingNonGlass = 2; | 72 static const int kPopupBottomSpacingNonGlass = 2; |
| 73 static const int kPopupBottomSpacingGlass = 1; | 73 static const int kPopupBottomSpacingGlass = 1; |
| 74 | 74 |
| 75 // The size of the font to use in the text overlay for the background page | 75 // The size of the font to use in the text overlay for the background page |
| 76 // badge. | 76 // badge. |
| 77 static const float kBadgeTextFontSize = 9.0; | 77 static const float kBadgeTextFontSize = 9.0; |
| 78 | 78 |
| 79 // Margins for the wrench menu badges (badge is placed in the upper right | 79 // Top margin for the wrench menu badges (badge is placed in the upper right |
| 80 // corner of the wrench menu with the specified margins). | 80 // corner of the wrench menu). |
| 81 static const int kBadgeRightMargin = 2; | |
| 82 static const int kBadgeTopMargin = 2; | 81 static const int kBadgeTopMargin = 2; |
| 83 | 82 |
| 84 static SkBitmap* kPopupBackgroundEdge = NULL; | 83 static SkBitmap* kPopupBackgroundEdge = NULL; |
| 85 | 84 |
| 86 //////////////////////////////////////////////////////////////////////////////// | 85 //////////////////////////////////////////////////////////////////////////////// |
| 87 // ToolbarView, public: | 86 // ToolbarView, public: |
| 88 | 87 |
| 89 ToolbarView::ToolbarView(Browser* browser) | 88 ToolbarView::ToolbarView(Browser* browser) |
| 90 : model_(browser->toolbar_model()), | 89 : model_(browser->toolbar_model()), |
| 91 back_(NULL), | 90 back_(NULL), |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } else if (ShouldShowIncompatibilityWarning()) { | 745 } else if (ShouldShowIncompatibilityWarning()) { |
| 747 #if defined(OS_WIN) | 746 #if defined(OS_WIN) |
| 748 badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE); | 747 badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE); |
| 749 #else | 748 #else |
| 750 NOTREACHED(); | 749 NOTREACHED(); |
| 751 #endif | 750 #endif |
| 752 } else { | 751 } else { |
| 753 NOTREACHED(); | 752 NOTREACHED(); |
| 754 } | 753 } |
| 755 | 754 |
| 756 canvas->DrawBitmapInt(badge, | 755 canvas->DrawBitmapInt(badge, icon.width() - badge.width(), kBadgeTopMargin); |
| 757 icon.width() - badge.width() - kBadgeRightMargin, | |
| 758 kBadgeTopMargin); | |
| 759 | 756 |
| 760 return canvas->ExtractBitmap(); | 757 return canvas->ExtractBitmap(); |
| 761 } | 758 } |
| 762 | 759 |
| 763 SkBitmap ToolbarView::GetBackgroundPageBadge() { | 760 SkBitmap ToolbarView::GetBackgroundPageBadge() { |
| 764 ThemeProvider* tp = GetThemeProvider(); | 761 ThemeProvider* tp = GetThemeProvider(); |
| 765 SkBitmap* badge = tp->GetBitmapNamed(IDR_BACKGROUND_BADGE); | 762 SkBitmap* badge = tp->GetBitmapNamed(IDR_BACKGROUND_BADGE); |
| 766 string16 badge_text = base::FormatNumber( | 763 string16 badge_text = base::FormatNumber( |
| 767 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount()); | 764 BackgroundPageTracker::GetSingleton()->GetBackgroundPageCount()); |
| 768 return badge_util::DrawBadgeIconOverlay( | 765 return badge_util::DrawBadgeIconOverlay( |
| 769 *badge, | 766 *badge, |
| 770 kBadgeTextFontSize, | 767 kBadgeTextFontSize, |
| 771 badge_text, | 768 badge_text, |
| 772 l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW)); | 769 l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW)); |
| 773 } | 770 } |
| 774 | 771 |
| OLD | NEW |