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/docked_panel_strip.h" | 8 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
9 #include "chrome/browser/ui/panels/panel_manager.h" | 9 #include "chrome/browser/ui/panels/panel_manager.h" |
10 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 10 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 panel->set_has_temporary_layout(false); | 91 panel->set_has_temporary_layout(false); |
92 panels_.push_back(panel); | 92 panels_.push_back(panel); |
93 DoRefresh(panels_.size() - 1, panels_.size() - 1); | 93 DoRefresh(panels_.size() - 1, panels_.size() - 1); |
94 } else { | 94 } else { |
95 panels_.insert(panels_.begin(), panel); | 95 panels_.insert(panels_.begin(), panel); |
96 RefreshLayout(); | 96 RefreshLayout(); |
97 } | 97 } |
98 | 98 |
99 // Set panel properties for this strip. | 99 // Set panel properties for this strip. |
100 panel->SetAppIconVisibility(false); | 100 panel->SetAppIconVisibility(false); |
101 panel->set_draggable(false); | |
102 panel->ApplyVisualStyleForStrip(); | 101 panel->ApplyVisualStyleForStrip(); |
103 | 102 |
104 if (num_panels() == 1) { | 103 if (num_panels() == 1) { |
105 panel_manager_->mouse_watcher()->AddObserver(this); | 104 panel_manager_->mouse_watcher()->AddObserver(this); |
106 UpdateMaxVisiblePanelsOnHover(); | 105 UpdateMaxVisiblePanelsOnHover(); |
107 } | 106 } |
108 | 107 |
109 // Update the overflow indicator only when the number of overflow panels go | 108 // Update the overflow indicator only when the number of overflow panels go |
110 // beyond the maximum visible limit. | 109 // beyond the maximum visible limit. |
111 if (num_panels() > max_visible_panels_) { | 110 if (num_panels() > max_visible_panels_) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Overflow is already a minimized mode for a panel. Nothing more to do. | 174 // Overflow is already a minimized mode for a panel. Nothing more to do. |
176 } | 175 } |
177 | 176 |
178 void OverflowPanelStrip::RestorePanel(Panel* panel) { | 177 void OverflowPanelStrip::RestorePanel(Panel* panel) { |
179 DCHECK_EQ(this, panel->panel_strip()); | 178 DCHECK_EQ(this, panel->panel_strip()); |
180 PanelStrip* docked_strip = panel_manager_->docked_strip(); | 179 PanelStrip* docked_strip = panel_manager_->docked_strip(); |
181 panel->MoveToStrip(docked_strip); | 180 panel->MoveToStrip(docked_strip); |
182 docked_strip->RestorePanel(panel); | 181 docked_strip->RestorePanel(panel); |
183 } | 182 } |
184 | 183 |
| 184 bool OverflowPanelStrip::CanDragPanel(const Panel* panel) const { |
| 185 // All overflow panels are not draggable. |
| 186 return false; |
| 187 } |
| 188 |
| 189 void OverflowPanelStrip::StartDraggingPanel(Panel* panel) { |
| 190 NOTREACHED(); |
| 191 } |
| 192 |
| 193 void OverflowPanelStrip::DragPanel(Panel* panel, int delta_x, int delta_y) { |
| 194 NOTREACHED(); |
| 195 } |
| 196 |
| 197 void OverflowPanelStrip::EndDraggingPanel(Panel* panel, bool cancelled) { |
| 198 NOTREACHED(); |
| 199 } |
| 200 |
185 void OverflowPanelStrip::RefreshLayout() { | 201 void OverflowPanelStrip::RefreshLayout() { |
186 if (panels_.empty()) | 202 if (panels_.empty()) |
187 return; | 203 return; |
188 DoRefresh(0, panels_.size() - 1); | 204 DoRefresh(0, panels_.size() - 1); |
189 } | 205 } |
190 | 206 |
191 void OverflowPanelStrip::DoRefresh(size_t start_index, size_t end_index) { | 207 void OverflowPanelStrip::DoRefresh(size_t start_index, size_t end_index) { |
192 if (panels_.empty() || start_index == panels_.size()) | 208 if (panels_.empty() || start_index == panels_.size()) |
193 return; | 209 return; |
194 | 210 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 bounds.set_width(current_display_width); | 380 bounds.set_width(current_display_width); |
365 overflow_indicator_->SetBounds(bounds); | 381 overflow_indicator_->SetBounds(bounds); |
366 overflow_indicator_->SetCount(num_panels() - max_visible_panels); | 382 overflow_indicator_->SetCount(num_panels() - max_visible_panels); |
367 } | 383 } |
368 } | 384 } |
369 | 385 |
370 void OverflowPanelStrip::OnFullScreenModeChanged(bool is_full_screen) { | 386 void OverflowPanelStrip::OnFullScreenModeChanged(bool is_full_screen) { |
371 for (size_t i = 0; i < panels_.size(); ++i) | 387 for (size_t i = 0; i < panels_.size(); ++i) |
372 panels_[i]->FullScreenModeChanged(is_full_screen); | 388 panels_[i]->FullScreenModeChanged(is_full_screen); |
373 } | 389 } |
OLD | NEW |