diff options
-rw-r--r-- | chrome/app/theme/conflicts.png | bin | 801 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/conflicts_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/enumerate_modules_model_win.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/toolbar_view.cc | 97 | ||||
-rw-r--r-- | chrome/browser/ui/views/toolbar_view.h | 23 | ||||
-rw-r--r-- | chrome/browser/wrench_menu_model.cc | 6 |
7 files changed, 39 insertions, 98 deletions
diff --git a/chrome/app/theme/conflicts.png b/chrome/app/theme/conflicts.png Binary files differdeleted file mode 100644 index 6149c8e..0000000 --- a/chrome/app/theme/conflicts.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index ce8b295..cfbc868 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -24,6 +24,8 @@ <include name="IDR_ACCESSED_COOKIES" file="accessed_cookies.png" type="BINDATA" /> <include name="IDR_APP_DEFAULT_ICON" file="app_default_icon.png" type="BINDATA" /> <include name="IDR_APP_DROPARROW" file="app_droparrow.png" type="BINDATA" /> + <include name="IDR_BACKGROUND_BADGE" file="background_badge.png" type="BINDATA" /> + <include name="IDR_BACKGROUND_MENU" file="background_menu.png" type="BINDATA" /> <include name="IDR_BACK" file="back.png" type="BINDATA" /> <include name="IDR_BACK_D" file="back_d.png" type="BINDATA" /> <include name="IDR_BACK_H" file="back_h.png" type="BINDATA" /> @@ -77,7 +79,8 @@ <include name="IDR_CLOSE_BAR_P" file="close_bar_p.png" type="BINDATA" /> <include name="IDR_CLOSE_BUTTON_MASK" file="close_button_mask.png" type="BINDATA" /> <if expr="os.find('win') != -1"> - <include name="IDR_CONFLICTS" file="conflicts.png" type="BINDATA" /> + <include name="IDR_CONFLICT_BADGE" file="conflict_badge.png" type="BINDATA" /> + <include name="IDR_CONFLICT_MENU" file="conflict_menu.png" type="BINDATA" /> </if> <include name="IDR_CONSTRAINED_BOTTOM_CENTER_V" file="constrained_bottom_center_v.png" type="BINDATA" /> <include name="IDR_CONSTRAINED_BOTTOM_LEFT_CORNER_V" file="constrained_bottom_left_corner_v.png" type="BINDATA" /> @@ -426,7 +429,9 @@ <include name="IDR_TOOLS_H" file="tools_h.png" type="BINDATA" /> <include name="IDR_TOOLS_P" file="tools_p.png" type="BINDATA" /> <include name="IDR_UPDATE_AVAILABLE" file="update_available.png" type="BINDATA" /> + <include name="IDR_UPDATE_BADGE" file="update_badge.png" type="BINDATA" /> <include name="IDR_UPDATE_FAIL" file="update_fail.png" type="BINDATA" /> + <include name="IDR_UPDATE_MENU" file="update_menu.png" type="BINDATA" /> <include name="IDR_UPDATE_UPTODATE" file="update_uptodate.png" type="BINDATA" /> <include name="IDR_UPGRADE_DOT_ACTIVE" file="upgrade_dot_active.png" type="BINDATA" /> <include name="IDR_UPGRADE_DOT_INACTIVE" file="upgrade_dot_inactive.png" type="BINDATA" /> diff --git a/chrome/browser/dom_ui/conflicts_ui.cc b/chrome/browser/dom_ui/conflicts_ui.cc index a93257a..45a6f18 100644 --- a/chrome/browser/dom_ui/conflicts_ui.cc +++ b/chrome/browser/dom_ui/conflicts_ui.cc @@ -207,7 +207,7 @@ ConflictsUI::ConflictsUI(TabContents* contents) : DOMUI(contents) { // static RefCountedMemory* ConflictsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_CONFLICTS); + LoadDataResourceBytes(IDR_CONFLICT_MENU); } #endif diff --git a/chrome/browser/enumerate_modules_model_win.h b/chrome/browser/enumerate_modules_model_win.h index 54684d0..bdbf989 100644 --- a/chrome/browser/enumerate_modules_model_win.h +++ b/chrome/browser/enumerate_modules_model_win.h @@ -112,7 +112,7 @@ class ModuleEnumerator : public base::RefCountedThreadSafe<ModuleEnumerator> { const BlacklistEntry& blacklisted); explicit ModuleEnumerator(EnumerateModulesModel* observer); - virtual ~ModuleEnumerator(); + ~ModuleEnumerator(); // Start scanning the loaded module list (if a scan is not already in // progress). This function does not block while reading the module list, but diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 5890a12..71f1387 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -182,7 +182,7 @@ void ToolbarView::Init(Profile* profile) { // Catch the case where the window is created after we detect a new version. if (IsUpgradeRecommended() || ShouldShowIncompatibilityWarning()) - ShowNotificationDot(); + UpdateAppMenuBadge(); LoadImages(); @@ -322,9 +322,6 @@ cleanup: if (destroyed_flag) return; destroyed_flag_ = NULL; - - // Stop pulsating the notification dot on the app menu (if active). - notification_dot_pulse_timer_.Stop(); } //////////////////////////////////////////////////////////////////////////////// @@ -347,16 +344,6 @@ void ToolbarView::OnInputInProgress(bool in_progress) { } //////////////////////////////////////////////////////////////////////////////// -// ToolbarView, AnimationDelegate implementation: - -void ToolbarView::AnimationProgressed(const Animation* animation) { - app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); - app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); - app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); - SchedulePaint(); -} - -//////////////////////////////////////////////////////////////////////////////// // ToolbarView, CommandUpdater::CommandObserver implementation: void ToolbarView::EnabledStateChangedForCommand(int id, bool enabled) { @@ -407,11 +394,11 @@ void ToolbarView::Observe(NotificationType type, SchedulePaint(); } } else if (type == NotificationType::UPGRADE_RECOMMENDED) { - ShowNotificationDot(); + UpdateAppMenuBadge(); } else if (type == NotificationType::MODULE_INCOMPATIBILITY_DETECTED) { bool confirmed_bad = *Details<bool>(details).ptr(); if (confirmed_bad) - ShowNotificationDot(); + UpdateAppMenuBadge(); } } @@ -648,21 +635,11 @@ void ToolbarView::LoadImages() { app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); } -void ToolbarView::ShowNotificationDot() { - notification_dot_animation_.reset(new SlideAnimation(this)); - notification_dot_animation_->SetSlideDuration(kPulseDuration); - - // Then start the recurring timer for pulsating it. - notification_dot_pulse_timer_.Stop(); - notification_dot_pulse_timer_.Start( - base::TimeDelta::FromMilliseconds(kPulsateEveryMs), - this, &ToolbarView::PulsateNotificationDot); -} - -void ToolbarView::PulsateNotificationDot() { - // Start the pulsating animation. - notification_dot_animation_->Reset(0.0); - notification_dot_animation_->Show(); +void ToolbarView::UpdateAppMenuBadge() { + app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); + app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); + app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); + SchedulePaint(); } SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { @@ -686,56 +663,26 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) { new gfx::CanvasSkia(icon.width(), icon.height(), false)); canvas->DrawBitmapInt(icon, 0, 0); - SkBitmap badge; - static bool has_faded_in = false; - if (!has_faded_in) { - SkBitmap* dot = NULL; - if (ShouldShowIncompatibilityWarning()) { + SkBitmap* badge = NULL; + // Only one badge can be active at any given time. The Upgrade notification + // is deemed most important, then the DLL conflict badge. + if (IsUpgradeRecommended()) { + badge = tp->GetBitmapNamed(IDR_UPDATE_BADGE); + } else if (ShouldShowIncompatibilityWarning()) { #if defined(OS_WIN) - dot = tp->GetBitmapNamed(IDR_INCOMPATIBILITY_DOT_INACTIVE); + badge = tp->GetBitmapNamed(IDR_CONFLICT_BADGE); #else - NOTREACHED(); + NOTREACHED(); #endif - } else { - dot = tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE); - } - SkBitmap transparent; - transparent.setConfig(dot->getConfig(), dot->width(), dot->height()); - transparent.allocPixels(); - transparent.eraseARGB(0, 0, 0, 0); - badge = SkBitmapOperations::CreateBlendedBitmap( - *dot, transparent, - 1.0 - notification_dot_animation_->GetCurrentValue()); - if (notification_dot_animation_->GetCurrentValue() == 1.0) - has_faded_in = true; } else { - // Convert animation values that start from 0.0 and incrementally go - // up to 1.0 into values that start in 0.0, go to 1.0 and then back - // to 0.0 (to create a pulsing effect). - double value = - 1.0 - abs(2.0 * notification_dot_animation_->GetCurrentValue() - 1.0); - - // Add the badge to it. - if (ShouldShowIncompatibilityWarning()) { -#if defined(OS_WIN) - badge = SkBitmapOperations::CreateBlendedBitmap( - *tp->GetBitmapNamed(IDR_INCOMPATIBILITY_DOT_INACTIVE), - *tp->GetBitmapNamed(IDR_INCOMPATIBILITY_DOT_ACTIVE), - value); -#else - NOTREACHED(); -#endif - } else { - badge = SkBitmapOperations::CreateBlendedBitmap( - *tp->GetBitmapNamed(IDR_UPGRADE_DOT_INACTIVE), - *tp->GetBitmapNamed(IDR_UPGRADE_DOT_ACTIVE), - value); - } + NOTREACHED(); } - static const int kBadgeLeftSpacing = 8; - static const int kBadgeTopSpacing = 18; - canvas->DrawBitmapInt(badge, kBadgeLeftSpacing, kBadgeTopSpacing); + static const int kBadgeRightMargin = 2; + static const int kBadgeTopMargin = 2; + canvas->DrawBitmapInt(*badge, + icon.width() - badge->width() - kBadgeRightMargin, + kBadgeTopMargin); return canvas->ExtractBitmap(); } diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index 2bcaeed..ccae7fa2 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -39,7 +39,6 @@ class ToolbarView : public AccessiblePaneView, public views::ViewMenuDelegate, public menus::AcceleratorProvider, public LocationBarView::Delegate, - public AnimationDelegate, public NotificationObserver, public CommandUpdater::CommandObserver, public views::ButtonListener { @@ -101,9 +100,6 @@ class ToolbarView : public AccessiblePaneView, virtual InstantController* GetInstant(); virtual void OnInputInProgress(bool in_progress); - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); - // Overridden from CommandUpdater::CommandObserver: virtual void EnabledStateChangedForCommand(int id, bool enabled); @@ -161,15 +157,11 @@ class ToolbarView : public AccessiblePaneView, return display_mode_ == DISPLAYMODE_NORMAL; } - // Starts the recurring timer that periodically asks the notification dot - // to pulsate. - void ShowNotificationDot(); - - // Show the reminder, tempting the user to take a look. - void PulsateNotificationDot(); + // Updates the badge on the app menu (Wrench). + void UpdateAppMenuBadge(); - // Gets a canvas with the icon for the app menu. It will possibly contain - // an overlaid badge if an update is recommended. + // Gets a bitmap with the icon for the app menu and any overlaid notification + // badge. SkBitmap GetAppMenuIcon(views::CustomButton::ButtonState state); scoped_ptr<BackForwardMenuModel> back_menu_model_; @@ -213,13 +205,6 @@ class ToolbarView : public AccessiblePaneView, // Vector of listeners to receive callbacks when the menu opens. std::vector<views::MenuListener*> menu_listeners_; - // The animation that makes the notification dot pulse. - scoped_ptr<SlideAnimation> notification_dot_animation_; - - // We periodically restart the animation after it has been showed - // once, to create a pulsating effect. - base::RepeatingTimer<ToolbarView> notification_dot_pulse_timer_; - // Used to post tasks to switch to the next/previous menu. ScopedRunnableMethodFactory<ToolbarView> method_factory_; diff --git a/chrome/browser/wrench_menu_model.cc b/chrome/browser/wrench_menu_model.cc index 7f09d9a..52bfe19 100644 --- a/chrome/browser/wrench_menu_model.cc +++ b/chrome/browser/wrench_menu_model.cc @@ -425,7 +425,11 @@ void WrenchMenuModel::Build() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SetIcon(GetIndexOfCommandId(IDC_UPGRADE_DIALOG), - *rb.GetBitmapNamed(IDR_UPDATE_AVAILABLE)); + *rb.GetBitmapNamed(IDR_UPDATE_MENU)); +#if defined(OS_WIN) + SetIcon(GetIndexOfCommandId(IDC_VIEW_INCOMPATIBILITIES), + *rb.GetBitmapNamed(IDR_CONFLICT_MENU)); +#endif AddItemWithStringId(IDC_HELP_PAGE, IDS_HELP_PAGE); if (browser_defaults::kShowExitMenuItem) { |