| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/panels/overflow_panel_strip.h" | 5 #include "chrome/browser/ui/panels/overflow_panel_strip.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/panels/panel_manager.h" | 8 #include "chrome/browser/ui/panels/panel_manager.h" |
| 9 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 9 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
| 10 #include "chrome/browser/ui/panels/panel_overflow_indicator.h" | 10 #include "chrome/browser/ui/panels/panel_overflow_indicator.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void OverflowPanelStrip::UpdateCurrentWidth() { | 76 void OverflowPanelStrip::UpdateCurrentWidth() { |
| 77 current_display_width_ = are_overflow_titles_shown_ ? kOverflowAreaHoverWidth | 77 current_display_width_ = are_overflow_titles_shown_ ? kOverflowAreaHoverWidth |
| 78 : display_area_.width(); | 78 : display_area_.width(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void OverflowPanelStrip::AddPanel(Panel* panel) { | 81 void OverflowPanelStrip::AddPanel(Panel* panel) { |
| 82 // TODO(jianli): consider using other container to improve the perf for | 82 // TODO(jianli): consider using other container to improve the perf for |
| 83 // inserting to the front. http://crbug.com/106222 | 83 // inserting to the front. http://crbug.com/106222 |
| 84 DCHECK_NE(this, panel->panel_strip()); | 84 DCHECK_NE(this, panel->panel_strip()); |
| 85 panel->set_panel_strip(this); | 85 panel->SetPanelStrip(this); |
| 86 | 86 |
| 87 // Newly created panels that were temporarily in the panel strip | 87 // Newly created panels that were temporarily in the panel strip |
| 88 // are added to the back of the overflow, whereas panels that are | 88 // are added to the back of the overflow, whereas panels that are |
| 89 // bumped from the panel strip by other panels go to the front | 89 // bumped from the panel strip by other panels go to the front |
| 90 // of overflow. | 90 // of overflow. |
| 91 if (panel->has_temporary_layout()) { | 91 if (panel->has_temporary_layout()) { |
| 92 panel->set_has_temporary_layout(false); | 92 panel->set_has_temporary_layout(false); |
| 93 panels_.push_back(panel); | 93 panels_.push_back(panel); |
| 94 DoRefresh(panels_.size() - 1, panels_.size() - 1); | 94 DoRefresh(panels_.size() - 1, panels_.size() - 1); |
| 95 } else { | 95 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 111 if (num_panels() > max_visible_panels_) { | 111 if (num_panels() > max_visible_panels_) { |
| 112 if (!overflow_indicator_.get()) { | 112 if (!overflow_indicator_.get()) { |
| 113 overflow_indicator_.reset(PanelOverflowIndicator::Create()); | 113 overflow_indicator_.reset(PanelOverflowIndicator::Create()); |
| 114 } | 114 } |
| 115 UpdateOverflowIndicatorCount(); | 115 UpdateOverflowIndicatorCount(); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void OverflowPanelStrip::RemovePanel(Panel* panel) { | 119 void OverflowPanelStrip::RemovePanel(Panel* panel) { |
| 120 DCHECK_EQ(this, panel->panel_strip()); | 120 DCHECK_EQ(this, panel->panel_strip()); |
| 121 panel->set_panel_strip(NULL); | 121 panel->SetPanelStrip(NULL); |
| 122 | 122 |
| 123 size_t index = 0; | 123 size_t index = 0; |
| 124 Panels::iterator iter = panels_.begin(); | 124 Panels::iterator iter = panels_.begin(); |
| 125 for (; iter != panels_.end(); ++iter, ++index) | 125 for (; iter != panels_.end(); ++iter, ++index) |
| 126 if (*iter == panel) | 126 if (*iter == panel) |
| 127 break; | 127 break; |
| 128 DCHECK(iter != panels_.end()); | 128 DCHECK(iter != panels_.end()); |
| 129 | 129 |
| 130 panels_.erase(iter); | 130 panels_.erase(iter); |
| 131 DoRefresh(index, panels_.size() - 1); | 131 DoRefresh(index, panels_.size() - 1); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // expanded overflow panels when in full screen mode so no need | 400 // expanded overflow panels when in full screen mode so no need |
| 401 // to detect when mouse hovers over the overflow strip. | 401 // to detect when mouse hovers over the overflow strip. |
| 402 if (is_full_screen) | 402 if (is_full_screen) |
| 403 panel_manager_->mouse_watcher()->RemoveObserver(this); | 403 panel_manager_->mouse_watcher()->RemoveObserver(this); |
| 404 else | 404 else |
| 405 panel_manager_->mouse_watcher()->AddObserver(this); | 405 panel_manager_->mouse_watcher()->AddObserver(this); |
| 406 | 406 |
| 407 for (size_t i = 0; i < panels_.size(); ++i) | 407 for (size_t i = 0; i < panels_.size(); ++i) |
| 408 panels_[i]->FullScreenModeChanged(is_full_screen); | 408 panels_[i]->FullScreenModeChanged(is_full_screen); |
| 409 } | 409 } |
| OLD | NEW |