| Index: chrome/browser/ui/panels/panel_overflow_strip.h
|
| diff --git a/chrome/browser/ui/panels/panel_overflow_strip.h b/chrome/browser/ui/panels/panel_overflow_strip.h
|
| index 32ff32c3f284c49308147c28e890a148701dbd0b..f7411cf41b6c628dd790e5f3d7067b0d9c7e0e19 100644
|
| --- a/chrome/browser/ui/panels/panel_overflow_strip.h
|
| +++ b/chrome/browser/ui/panels/panel_overflow_strip.h
|
| @@ -9,17 +9,21 @@
|
| #include <vector>
|
| #include "chrome/browser/ui/panels/panel.h"
|
| #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| #include "ui/base/animation/animation_delegate.h"
|
|
|
| class Browser;
|
| class PanelManager;
|
| +class PanelOverflowIndicator;
|
| namespace ui {
|
| class SlideAnimation;
|
| }
|
|
|
| // Manipulates all the panels that are placed on the left-most overflow area.
|
| class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| - public ui::AnimationDelegate {
|
| + public ui::AnimationDelegate,
|
| + public content::NotificationObserver {
|
| public:
|
| typedef std::vector<Panel*> Panels;
|
|
|
| @@ -41,6 +45,9 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| void OnPanelExpansionStateChanged(
|
| Panel* panel, Panel::ExpansionState old_state);
|
|
|
| + // Called when a panel is starting/stopping drawing an attention.
|
| + void OnPanelAttentionStateChanged(Panel* panel);
|
| +
|
| // Refreshes the layouts for all panels to reflect any possible changes.
|
| void Refresh();
|
|
|
| @@ -55,8 +62,16 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| #ifdef UNIT_TEST
|
| int current_display_width() const { return current_display_width_; }
|
|
|
| - void set_max_visible_panels(int max_visible_panels) {
|
| - max_visible_panels_ = max_visible_panels;
|
| + PanelOverflowIndicator* overflow_indicator() const {
|
| + return overflow_indicator_.get();
|
| + }
|
| +
|
| + void set_max_visible_panels_on_shrunk(int max_visible_panels) {
|
| + max_visible_panels_on_shrunk_ = max_visible_panels;
|
| + }
|
| +
|
| + void set_max_visible_panels_on_expanded(int max_visible_panels) {
|
| + max_visible_panels_on_expanded_ = max_visible_panels;
|
| }
|
| #endif
|
|
|
| @@ -68,10 +83,18 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
|
| virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
|
|
|
| + // Overridden from NotificationObserver:
|
| + virtual void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) OVERRIDE;
|
| +
|
| + void UpdateMaxVisibkePanelsOnExpanded();
|
| void UpdateCurrentWidth();
|
|
|
| void DoRefresh(size_t start_index, size_t end_index);
|
|
|
| + void UpdateOverflowIndicator(int width);
|
| +
|
| // Computes the layout of the |index| panel to fit into the area.
|
| // Empty bounds will be returned if this is not possible due to not enough
|
| // space.
|
| @@ -83,6 +106,11 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const;
|
| void ShowOverflowTitles(bool show_overflow_titles);
|
|
|
| + int max_visible_panels() const {
|
| + return are_overflow_titles_shown_ ? max_visible_panels_on_expanded_
|
| + : max_visible_panels_on_shrunk_;
|
| + }
|
| +
|
| // Weak pointer since PanelManager owns PanelOverflowStrip instance.
|
| PanelManager* panel_manager_;
|
|
|
| @@ -99,7 +127,12 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| int current_display_width_;
|
|
|
| // Maximium number of overflow panels allowed to be shown.
|
| - int max_visible_panels_;
|
| + int max_visible_panels_on_shrunk_;
|
| + int max_visible_panels_on_expanded_;
|
| +
|
| + // User to show "+N" indicator when number of overflow panels exceed
|
| + // |max_visible_panels_on_shrunk_|.
|
| + scoped_ptr<PanelOverflowIndicator> overflow_indicator_;
|
|
|
| // For mouse hover-over effect.
|
| bool are_overflow_titles_shown_;
|
| @@ -107,6 +140,9 @@ class PanelOverflowStrip : public PanelMouseWatcherObserver,
|
| int overflow_hover_animator_start_width_;
|
| int overflow_hover_animator_end_width_;
|
|
|
| + // Registrar for receiving the shut down notification.
|
| + content::NotificationRegistrar registrar_;
|
| +
|
| // Invalid panel index.
|
| static const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
|
|
|
|
|