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

Side by Side Diff: chrome/browser/ui/panels/panel_overflow_strip.h

Issue 8872044: Add test cases for panel overflow handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 #include "chrome/browser/ui/panels/panel.h" 10 #include "chrome/browser/ui/panels/panel.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Refreshes the layouts for all panels to reflect any possible changes. 44 // Refreshes the layouts for all panels to reflect any possible changes.
45 void Refresh(); 45 void Refresh();
46 46
47 void OnFullScreenModeChanged(bool is_full_screen); 47 void OnFullScreenModeChanged(bool is_full_screen);
48 48
49 int num_panels() const { return static_cast<int>(panels_.size()); } 49 int num_panels() const { return static_cast<int>(panels_.size()); }
50 Panel* first_panel() const { 50 Panel* first_panel() const {
51 return panels_.empty() ? NULL : panels_.front(); 51 return panels_.empty() ? NULL : panels_.front();
52 } 52 }
53 const Panels& panels() const { return panels_; }
53 54
54 #ifdef UNIT_TEST 55 #ifdef UNIT_TEST
55 const Panels& panels() const { return panels_; } 56 void set_max_visible_panels(int max_visible_panels) {
57 max_visible_panels_ = max_visible_panels;
58 }
59
60 bool TestShouldShowOverflowTitles(const gfx::Point& mouse_position) const {
61 return ShouldShowOverflowTitles(mouse_position);
62 }
56 #endif 63 #endif
57 64
65 // The width of the overflow area that is expanded to show more info, i.e.
66 // titles, when the mouse hovers over the area.
67 static const int kOverflowAreaHoverWidth = 200;
jennb 2011/12/10 00:42:46 Don't need this here if overflow strip has a notio
jianli 2011/12/13 23:23:40 Done.
68
58 private: 69 private:
59 // Overridden from PanelMouseWatcherObserver: 70 // Overridden from PanelMouseWatcherObserver:
60 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; 71 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
61 72
62 // Overridden from AnimationDelegate: 73 // Overridden from AnimationDelegate:
74 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
63 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 75 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
64 76
65 void DoRefresh(size_t start_index, size_t end_index); 77 void DoRefresh(size_t start_index, size_t end_index);
66 78
67 // Computes the layout of the |index| panel to fit into the area. 79 // Computes the layout of the |index| panel to fit into the area.
68 // Empty bounds will be returned if this is not possible due to not enough 80 // Empty bounds will be returned if this is not possible due to not enough
69 // space. 81 // space.
70 gfx::Rect ComputeLayout(size_t index, 82 gfx::Rect ComputeLayout(size_t index,
71 const gfx::Size& iconified_size) const; 83 const gfx::Size& iconified_size) const;
72 84
73 // Used to pop up the titles for overflow panels when the mouse hovers over 85 // Used to pop up the titles for overflow panels when the mouse hovers over
74 // the overflow area. 86 // the overflow area.
75 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const; 87 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const;
76 void ShowOverflowTitles(bool show_overflow_titles); 88 void ShowOverflowTitles(bool show_overflow_titles);
77 89
78 // Weak pointer since PanelManager owns PanelOverflowStrip instance. 90 // Weak pointer since PanelManager owns PanelOverflowStrip instance.
79 PanelManager* panel_manager_; 91 PanelManager* panel_manager_;
80 92
81 // The queue for storing all panels. 93 // The queue for storing all panels.
82 Panels panels_; 94 Panels panels_;
83 95
84 // The overflow area where panels are iconified due to insufficient space 96 // The overflow area where panels are iconified due to insufficient space
85 // in the panel strip. 97 // in the panel strip.
86 gfx::Rect display_area_; 98 gfx::Rect display_area_;
87 99
100 // Maximium number of overflow panels allowed to be shown.
101 int max_visible_panels_;
102
88 // For mouse hover-over effect. 103 // For mouse hover-over effect.
89 bool are_overflow_titles_shown_; 104 bool are_overflow_titles_shown_;
90 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_; 105 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_;
91 int overflow_hover_animator_start_width_; 106 int overflow_hover_animator_start_width_;
92 int overflow_hover_animator_end_width_; 107 int overflow_hover_animator_end_width_;
93 108
94 // Invalid panel index. 109 // Invalid panel index.
95 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); 110 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
96 111
97 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip); 112 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip);
98 }; 113 };
99 114
100 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ 115 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698