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

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

Issue 8827011: Panel strip refactor cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced 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
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_strip.h ('k') | chrome/browser/ui/panels/panel_strip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_overflow_strip.cc
diff --git a/chrome/browser/ui/panels/panel_overflow_strip.cc b/chrome/browser/ui/panels/panel_overflow_strip.cc
index b26ae8e412083b88356d055e026a580e772d7699..ce122bf375665e2e7f48499fc709f6b2a34fdbbc 100644
--- a/chrome/browser/ui/panels/panel_overflow_strip.cc
+++ b/chrome/browser/ui/panels/panel_overflow_strip.cc
@@ -41,27 +41,25 @@ void PanelOverflowStrip::SetDisplayArea(const gfx::Rect& display_area) {
Refresh();
}
-void PanelOverflowStrip::AddPanel(Panel* panel, bool is_new) {
+void PanelOverflowStrip::AddPanel(Panel* panel) {
// TODO(jianli): consider using other container to improve the perf for
// inserting to the front. http://crbug.com/106222
- if (is_new)
+ DCHECK_EQ(Panel::IN_OVERFLOW, panel->expansion_state());
+ // Newly created panels that were temporarily in the panel strip
+ // are added to the back of the overflow, whereas panels that are
+ // bumped from the panel strip by other panels go to the front
+ // of overflow.
+ if (panel->has_temporary_layout()) {
+ panel->set_has_temporary_layout(false);
panels_.push_back(panel);
- else
- panels_.insert(panels_.begin(), panel);
-
- if (panels_.size() == 1)
- panel_manager_->mouse_watcher()->AddObserver(this);
-
- panel->SetExpansionState(Panel::IN_OVERFLOW);
-
- if (is_new) {
- // When the overflow panel is added to the back, only need to refresh
- // itself.
DoRefresh(panels_.size() - 1, panels_.size() - 1);
} else {
- // When the overflow panel is added to the front, refresh all.
+ panels_.insert(panels_.begin(), panel);
Refresh();
}
+
+ if (panels_.size() == 1)
+ panel_manager_->mouse_watcher()->AddObserver(this);
}
bool PanelOverflowStrip::Remove(Panel* panel) {
@@ -93,6 +91,9 @@ void PanelOverflowStrip::RemoveAll() {
void PanelOverflowStrip::OnPanelExpansionStateChanged(
Panel* panel, Panel::ExpansionState old_state) {
DCHECK(panel->expansion_state() == Panel::IN_OVERFLOW);
+ panel_manager_->panel_strip()->Remove(panel);
+ AddPanel(panel);
+ panel->SetAppIconVisibility(false);
}
void PanelOverflowStrip::Refresh() {
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_strip.h ('k') | chrome/browser/ui/panels/panel_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698