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/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 int width = browser->override_bounds().width(); | 112 int width = browser->override_bounds().width(); |
113 int height = browser->override_bounds().height(); | 113 int height = browser->override_bounds().height(); |
114 Panel* panel = new Panel(browser, gfx::Size(width, height)); | 114 Panel* panel = new Panel(browser, gfx::Size(width, height)); |
115 panel_strip_->AddPanel(panel); | 115 panel_strip_->AddPanel(panel); |
116 | 116 |
117 content::NotificationService::current()->Notify( | 117 content::NotificationService::current()->Notify( |
118 chrome::NOTIFICATION_PANEL_ADDED, | 118 chrome::NOTIFICATION_PANEL_ADDED, |
119 content::Source<Panel>(panel), | 119 content::Source<Panel>(panel), |
120 content::NotificationService::NoDetails()); | 120 content::NotificationService::NoDetails()); |
121 | 121 |
| 122 // We don't enable full screen detection for Linux as z-order rules for |
| 123 // panels on Linux ensures that they're below any app running in full screen |
| 124 // mode. |
| 125 #if defined(OS_WIN) || defined(OS_MACOSX) |
122 if (num_panels() == 1) { | 126 if (num_panels() == 1) { |
123 full_screen_mode_timer_.Start(FROM_HERE, | 127 full_screen_mode_timer_.Start(FROM_HERE, |
124 base::TimeDelta::FromMilliseconds(kFullScreenModeCheckIntervalMs), | 128 base::TimeDelta::FromMilliseconds(kFullScreenModeCheckIntervalMs), |
125 this, &PanelManager::CheckFullScreenMode); | 129 this, &PanelManager::CheckFullScreenMode); |
126 } | 130 } |
| 131 #endif |
127 | 132 |
128 return panel; | 133 return panel; |
129 } | 134 } |
130 | 135 |
131 int PanelManager::StartingRightPosition() const { | 136 int PanelManager::StartingRightPosition() const { |
132 return panel_strip_->StartingRightPosition(); | 137 return panel_strip_->StartingRightPosition(); |
133 } | 138 } |
134 | 139 |
135 void PanelManager::CheckFullScreenMode() { | 140 void PanelManager::CheckFullScreenMode() { |
136 bool is_full_screen_new = IsFullScreenMode(); | 141 bool is_full_screen_new = IsFullScreenMode(); |
137 if (is_full_screen_ == is_full_screen_new) | 142 if (is_full_screen_ == is_full_screen_new) |
138 return; | 143 return; |
139 is_full_screen_ = is_full_screen_new; | 144 is_full_screen_ = is_full_screen_new; |
140 panel_strip_->OnFullScreenModeChanged(is_full_screen_); | 145 panel_strip_->OnFullScreenModeChanged(is_full_screen_); |
141 panel_overflow_strip_->OnFullScreenModeChanged(is_full_screen_); | 146 panel_overflow_strip_->OnFullScreenModeChanged(is_full_screen_); |
142 } | 147 } |
143 | 148 |
144 void PanelManager::Remove(Panel* panel) { | 149 void PanelManager::Remove(Panel* panel) { |
| 150 #if defined(OS_WIN) || defined(OS_MACOSX) |
145 if (num_panels() == 1) | 151 if (num_panels() == 1) |
146 full_screen_mode_timer_.Stop(); | 152 full_screen_mode_timer_.Stop(); |
| 153 #endif |
147 | 154 |
148 if (panel_strip_->Remove(panel)) | 155 if (panel_strip_->Remove(panel)) |
149 return; | 156 return; |
150 bool removed = panel_overflow_strip_->Remove(panel); | 157 bool removed = panel_overflow_strip_->Remove(panel); |
151 DCHECK(removed); | 158 DCHECK(removed); |
152 } | 159 } |
153 | 160 |
154 void PanelManager::OnPanelRemoved(Panel* panel) { | 161 void PanelManager::OnPanelRemoved(Panel* panel) { |
155 content::NotificationService::current()->Notify( | 162 content::NotificationService::current()->Notify( |
156 chrome::NOTIFICATION_PANEL_REMOVED, | 163 chrome::NOTIFICATION_PANEL_REMOVED, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); | 251 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); |
245 } | 252 } |
246 | 253 |
247 bool PanelManager::is_dragging_panel() const { | 254 bool PanelManager::is_dragging_panel() const { |
248 return panel_strip_->is_dragging_panel(); | 255 return panel_strip_->is_dragging_panel(); |
249 } | 256 } |
250 | 257 |
251 const PanelManager::Panels& PanelManager::panels() const { | 258 const PanelManager::Panels& PanelManager::panels() const { |
252 return panel_strip_->panels(); | 259 return panel_strip_->panels(); |
253 } | 260 } |
OLD | NEW |