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/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/fullscreen.h" | 10 #include "chrome/browser/fullscreen.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 docked_strip_->OnFullScreenModeChanged(is_full_screen_); | 146 docked_strip_->OnFullScreenModeChanged(is_full_screen_); |
147 overflow_strip_->OnFullScreenModeChanged(is_full_screen_); | 147 overflow_strip_->OnFullScreenModeChanged(is_full_screen_); |
148 } | 148 } |
149 | 149 |
150 void PanelManager::Remove(Panel* panel) { | 150 void PanelManager::Remove(Panel* panel) { |
151 #if defined(OS_WIN) || defined(OS_MACOSX) | 151 #if defined(OS_WIN) || defined(OS_MACOSX) |
152 if (num_panels() == 1) | 152 if (num_panels() == 1) |
153 full_screen_mode_timer_.Stop(); | 153 full_screen_mode_timer_.Stop(); |
154 #endif | 154 #endif |
155 | 155 |
156 if (docked_strip_->Remove(panel)) | 156 if (docked_strip_->RemovePanel(panel)) |
157 return; | 157 return; |
158 bool removed = overflow_strip_->Remove(panel); | 158 bool removed = overflow_strip_->RemovePanel(panel); |
159 DCHECK(removed); | 159 DCHECK(removed); |
160 } | 160 } |
161 | 161 |
162 void PanelManager::OnPanelRemoved(Panel* panel) { | 162 void PanelManager::OnPanelRemoved(Panel* panel) { |
163 content::NotificationService::current()->Notify( | 163 content::NotificationService::current()->Notify( |
164 chrome::NOTIFICATION_PANEL_REMOVED, | 164 chrome::NOTIFICATION_PANEL_REMOVED, |
165 content::Source<Panel>(panel), | 165 content::Source<Panel>(panel), |
166 content::NotificationService::NoDetails()); | 166 content::NotificationService::NoDetails()); |
167 } | 167 } |
168 | 168 |
(...skipping 18 matching lines...) Expand all Loading... |
187 if (panel->expansion_state() == Panel::IN_OVERFLOW) | 187 if (panel->expansion_state() == Panel::IN_OVERFLOW) |
188 overflow_strip_->OnPanelAttentionStateChanged(panel); | 188 overflow_strip_->OnPanelAttentionStateChanged(panel); |
189 else | 189 else |
190 docked_strip_->OnPanelAttentionStateChanged(panel); | 190 docked_strip_->OnPanelAttentionStateChanged(panel); |
191 } | 191 } |
192 | 192 |
193 void PanelManager::OnPreferredWindowSizeChanged( | 193 void PanelManager::OnPreferredWindowSizeChanged( |
194 Panel* panel, const gfx::Size& preferred_window_size) { | 194 Panel* panel, const gfx::Size& preferred_window_size) { |
195 if (!auto_sizing_enabled_) | 195 if (!auto_sizing_enabled_) |
196 return; | 196 return; |
197 docked_strip_->OnWindowSizeChanged(panel, preferred_window_size); | 197 docked_strip_->ResizePanelWindow(panel, preferred_window_size); |
198 } | 198 } |
199 | 199 |
200 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { | 200 void PanelManager::ResizePanel(Panel* panel, const gfx::Size& new_size) { |
201 // Explicit resizing is not allowed for auto-resizable panels for now. | 201 // Explicit resizing is not allowed for auto-resizable panels for now. |
202 // http://crbug.com/109343 | 202 // http://crbug.com/109343 |
203 if (panel->auto_resizable()) { | 203 if (panel->auto_resizable()) { |
204 LOG(INFO) << "Resizing auto-resizable Panels is not supported yet."; | 204 LOG(INFO) << "Resizing auto-resizable Panels is not supported yet."; |
205 return; | 205 return; |
206 } | 206 } |
207 docked_strip_->OnWindowSizeChanged(panel, new_size); | 207 docked_strip_->ResizePanelWindow(panel, new_size); |
208 } | 208 } |
209 | 209 |
210 bool PanelManager::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const { | 210 bool PanelManager::ShouldBringUpTitlebars(int mouse_x, int mouse_y) const { |
211 return docked_strip_->ShouldBringUpTitlebars(mouse_x, mouse_y); | 211 return docked_strip_->ShouldBringUpTitlebars(mouse_x, mouse_y); |
212 } | 212 } |
213 | 213 |
214 void PanelManager::BringUpOrDownTitlebars(bool bring_up) { | 214 void PanelManager::BringUpOrDownTitlebars(bool bring_up) { |
215 docked_strip_->BringUpOrDownTitlebars(bring_up); | 215 docked_strip_->BringUpOrDownTitlebars(bring_up); |
216 } | 216 } |
217 | 217 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 AdjustWorkAreaForAutoHidingDesktopBars(); | 250 AdjustWorkAreaForAutoHidingDesktopBars(); |
251 Layout(); | 251 Layout(); |
252 } | 252 } |
253 | 253 |
254 void PanelManager::OnAutoHidingDesktopBarVisibilityChanged( | 254 void PanelManager::OnAutoHidingDesktopBarVisibilityChanged( |
255 AutoHidingDesktopBar::Alignment alignment, | 255 AutoHidingDesktopBar::Alignment alignment, |
256 AutoHidingDesktopBar::Visibility visibility) { | 256 AutoHidingDesktopBar::Visibility visibility) { |
257 docked_strip_->OnAutoHidingDesktopBarVisibilityChanged(alignment, visibility); | 257 docked_strip_->OnAutoHidingDesktopBarVisibilityChanged(alignment, visibility); |
258 } | 258 } |
259 | 259 |
260 void PanelManager::RemoveAll() { | 260 void PanelManager::CloseAll() { |
261 docked_strip_->RemoveAll(); | 261 docked_strip_->CloseAll(); |
262 overflow_strip_->RemoveAll(); | 262 overflow_strip_->CloseAll(); |
263 } | 263 } |
264 | 264 |
265 int PanelManager::num_panels() const { | 265 int PanelManager::num_panels() const { |
266 return docked_strip_->num_panels() + overflow_strip_->num_panels(); | 266 return docked_strip_->num_panels() + overflow_strip_->num_panels(); |
267 } | 267 } |
268 | 268 |
269 std::vector<Panel*> PanelManager::panels() const { | 269 std::vector<Panel*> PanelManager::panels() const { |
270 std::vector<Panel*> panels = docked_strip_->panels(); | 270 std::vector<Panel*> panels = docked_strip_->panels(); |
271 for (OverflowPanelStrip::Panels::const_iterator iter = | 271 for (OverflowPanelStrip::Panels::const_iterator iter = |
272 overflow_strip_->panels().begin(); | 272 overflow_strip_->panels().begin(); |
273 iter != overflow_strip_->panels().end(); ++iter) | 273 iter != overflow_strip_->panels().end(); ++iter) |
274 panels.push_back(*iter); | 274 panels.push_back(*iter); |
275 return panels; | 275 return panels; |
276 } | 276 } |
277 | 277 |
278 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 278 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
279 panel_mouse_watcher_.reset(watcher); | 279 panel_mouse_watcher_.reset(watcher); |
280 } | 280 } |
OLD | NEW |