Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: chrome/browser/ui/panels/panel_overflow_strip.h

Issue 8953040: Add overflow indicator count on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698