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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/multi_display_manager.h" | 8 #include "ash/display/multi_display_manager.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/wm/coordinate_conversion.h" | 12 #include "ash/wm/coordinate_conversion.h" |
13 #include "ash/wm/property_util.h" | 13 #include "ash/wm/property_util.h" |
14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "ui/aura/client/screen_position_client.h" | 16 #include "ui/aura/client/screen_position_client.h" |
17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
20 #include "ui/gfx/display.h" | 20 #include "ui/gfx/display.h" |
21 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace internal { | 24 namespace internal { |
| 25 namespace { |
| 26 // True if the extended desktop mode is enabled. |
| 27 bool extended_desktop_enabled = false; |
| 28 } // namespace |
25 | 29 |
26 DisplayController::DisplayController() | 30 DisplayController::DisplayController() |
27 : secondary_display_layout_(RIGHT), | 31 : secondary_display_layout_(RIGHT), |
28 dont_warp_mouse_(false) { | 32 dont_warp_mouse_(false) { |
29 aura::Env::GetInstance()->display_manager()->AddObserver(this); | 33 aura::Env::GetInstance()->display_manager()->AddObserver(this); |
30 } | 34 } |
31 | 35 |
32 DisplayController::~DisplayController() { | 36 DisplayController::~DisplayController() { |
33 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); | 37 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); |
34 // Delete all root window controllers, which deletes root window | 38 // Delete all root window controllers, which deletes root window |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 controller->MoveWindowsTo(Shell::GetPrimaryRootWindow()); | 204 controller->MoveWindowsTo(Shell::GetPrimaryRootWindow()); |
201 delete controller; | 205 delete controller; |
202 } else { | 206 } else { |
203 delete root; | 207 delete root; |
204 } | 208 } |
205 } | 209 } |
206 } | 210 } |
207 | 211 |
208 // static | 212 // static |
209 bool DisplayController::IsExtendedDesktopEnabled(){ | 213 bool DisplayController::IsExtendedDesktopEnabled(){ |
210 static bool extended_desktop_disabled = | 214 return extended_desktop_enabled || |
211 CommandLine::ForCurrentProcess()->HasSwitch( | 215 CommandLine::ForCurrentProcess()->HasSwitch( |
212 switches::kAshExtendedDesktopDisabled); | 216 switches::kAshExtendedDesktop); |
213 return !extended_desktop_disabled; | 217 } |
| 218 |
| 219 // static |
| 220 void DisplayController::SetExtendedDesktopEnabled(bool enabled) { |
| 221 extended_desktop_enabled = enabled; |
214 } | 222 } |
215 | 223 |
216 aura::RootWindow* DisplayController::AddRootWindowForDisplay( | 224 aura::RootWindow* DisplayController::AddRootWindowForDisplay( |
217 const gfx::Display& display) { | 225 const gfx::Display& display) { |
218 aura::RootWindow* root = aura::Env::GetInstance()->display_manager()-> | 226 aura::RootWindow* root = aura::Env::GetInstance()->display_manager()-> |
219 CreateRootWindowForDisplay(display); | 227 CreateRootWindowForDisplay(display); |
220 root_windows_[display.id()] = root; | 228 root_windows_[display.id()] = root; |
221 // Confine the cursor within the window if | 229 // Confine the cursor within the window if |
222 // 1) Extended desktop is enabled or | 230 // 1) Extended desktop is enabled or |
223 // 2) the display is primary display and the host window | 231 // 2) the display is primary display and the host window |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 break; | 266 break; |
259 } | 267 } |
260 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 268 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
261 secondary_display->set_bounds( | 269 secondary_display->set_bounds( |
262 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 270 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
263 secondary_display->UpdateWorkAreaFromInsets(insets); | 271 secondary_display->UpdateWorkAreaFromInsets(insets); |
264 } | 272 } |
265 | 273 |
266 } // namespace internal | 274 } // namespace internal |
267 } // namespace ash | 275 } // namespace ash |
OLD | NEW |