OLD | NEW |
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 #include "chrome/browser/ui/panels/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/fullscreen.h" | 9 #include "chrome/browser/fullscreen.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 int width = browser->override_bounds().width(); | 93 int width = browser->override_bounds().width(); |
94 int height = browser->override_bounds().height(); | 94 int height = browser->override_bounds().height(); |
95 Panel* panel = new Panel(browser, gfx::Size(width, height)); | 95 Panel* panel = new Panel(browser, gfx::Size(width, height)); |
96 panel_strip_->AddPanel(panel); | 96 panel_strip_->AddPanel(panel); |
97 | 97 |
98 content::NotificationService::current()->Notify( | 98 content::NotificationService::current()->Notify( |
99 chrome::NOTIFICATION_PANEL_ADDED, | 99 chrome::NOTIFICATION_PANEL_ADDED, |
100 content::Source<Panel>(panel), | 100 content::Source<Panel>(panel), |
101 content::NotificationService::NoDetails()); | 101 content::NotificationService::NoDetails()); |
102 | 102 |
| 103 // We don't enable full screen detection for Linux as z-order rules for |
| 104 // panels on Linux ensures that they're below any app running in full screen |
| 105 // mode. |
| 106 #if defined(OS_WIN) || defined(OS_MACOSX) |
103 if (num_panels() == 1) { | 107 if (num_panels() == 1) { |
104 full_screen_mode_timer_.Start(FROM_HERE, | 108 full_screen_mode_timer_.Start(FROM_HERE, |
105 base::TimeDelta::FromMilliseconds(kFullScreenModeCheckIntervalMs), | 109 base::TimeDelta::FromMilliseconds(kFullScreenModeCheckIntervalMs), |
106 this, &PanelManager::CheckFullScreenMode); | 110 this, &PanelManager::CheckFullScreenMode); |
107 } | 111 } |
| 112 #endif |
108 | 113 |
109 return panel; | 114 return panel; |
110 } | 115 } |
111 | 116 |
112 int PanelManager::StartingRightPosition() const { | 117 int PanelManager::StartingRightPosition() const { |
113 return panel_strip_->StartingRightPosition(); | 118 return panel_strip_->StartingRightPosition(); |
114 } | 119 } |
115 | 120 |
116 void PanelManager::CheckFullScreenMode() { | 121 void PanelManager::CheckFullScreenMode() { |
117 bool is_full_screen_new = IsFullScreenMode(); | 122 bool is_full_screen_new = IsFullScreenMode(); |
118 if (is_full_screen_ == is_full_screen_new) | 123 if (is_full_screen_ == is_full_screen_new) |
119 return; | 124 return; |
120 is_full_screen_ = is_full_screen_new; | 125 is_full_screen_ = is_full_screen_new; |
121 panel_strip_->OnFullScreenModeChanged(is_full_screen_); | 126 panel_strip_->OnFullScreenModeChanged(is_full_screen_); |
122 panel_overflow_strip_->OnFullScreenModeChanged(is_full_screen_); | 127 panel_overflow_strip_->OnFullScreenModeChanged(is_full_screen_); |
123 } | 128 } |
124 | 129 |
125 void PanelManager::Remove(Panel* panel) { | 130 void PanelManager::Remove(Panel* panel) { |
| 131 #if defined(OS_WIN) || defined(OS_MACOSX) |
126 if (num_panels() == 1) | 132 if (num_panels() == 1) |
127 full_screen_mode_timer_.Stop(); | 133 full_screen_mode_timer_.Stop(); |
| 134 #endif |
128 | 135 |
129 if (panel_strip_->Remove(panel)) | 136 if (panel_strip_->Remove(panel)) |
130 return; | 137 return; |
131 bool removed = panel_overflow_strip_->Remove(panel); | 138 bool removed = panel_overflow_strip_->Remove(panel); |
132 DCHECK(removed); | 139 DCHECK(removed); |
133 } | 140 } |
134 | 141 |
135 void PanelManager::OnPanelRemoved(Panel* panel) { | 142 void PanelManager::OnPanelRemoved(Panel* panel) { |
136 content::NotificationService::current()->Notify( | 143 content::NotificationService::current()->Notify( |
137 chrome::NOTIFICATION_PANEL_REMOVED, | 144 chrome::NOTIFICATION_PANEL_REMOVED, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); | 232 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); |
226 } | 233 } |
227 | 234 |
228 bool PanelManager::is_dragging_panel() const { | 235 bool PanelManager::is_dragging_panel() const { |
229 return panel_strip_->is_dragging_panel(); | 236 return panel_strip_->is_dragging_panel(); |
230 } | 237 } |
231 | 238 |
232 const PanelManager::Panels& PanelManager::panels() const { | 239 const PanelManager::Panels& PanelManager::panels() const { |
233 return panel_strip_->panels(); | 240 return panel_strip_->panels(); |
234 } | 241 } |
OLD | NEW |