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/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
15 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/gfx/display.h" | 17 #include "ui/gfx/display.h" |
18 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 namespace internal { | 21 namespace internal { |
22 namespace { | |
23 // True if the extended desktop mode is enabled. | |
24 bool extended_desktop_enabled = false; | |
25 } // namespace | |
26 | 22 |
27 DisplayController::DisplayController() | 23 DisplayController::DisplayController() |
28 : secondary_display_layout_(RIGHT) { | 24 : secondary_display_layout_(RIGHT) { |
29 aura::Env::GetInstance()->display_manager()->AddObserver(this); | 25 aura::Env::GetInstance()->display_manager()->AddObserver(this); |
30 } | 26 } |
31 | 27 |
32 DisplayController::~DisplayController() { | 28 DisplayController::~DisplayController() { |
33 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); | 29 aura::Env::GetInstance()->display_manager()->RemoveObserver(this); |
34 // Delete all root window controllers, which deletes root window | 30 // Delete all root window controllers, which deletes root window |
35 // from the last so that the primary root window gets deleted last. | 31 // from the last so that the primary root window gets deleted last. |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 controller->MoveWindowsTo(Shell::GetPrimaryRootWindow()); | 222 controller->MoveWindowsTo(Shell::GetPrimaryRootWindow()); |
227 delete controller; | 223 delete controller; |
228 } else { | 224 } else { |
229 delete root; | 225 delete root; |
230 } | 226 } |
231 } | 227 } |
232 } | 228 } |
233 | 229 |
234 // static | 230 // static |
235 bool DisplayController::IsExtendedDesktopEnabled(){ | 231 bool DisplayController::IsExtendedDesktopEnabled(){ |
236 return extended_desktop_enabled || | 232 static bool extended_desktop_disabled = |
237 CommandLine::ForCurrentProcess()->HasSwitch( | 233 CommandLine::ForCurrentProcess()->HasSwitch( |
238 switches::kAshExtendedDesktop); | 234 switches::kAshExtendedDesktopDisabled); |
239 } | 235 return !extended_desktop_disabled; |
240 | |
241 // static | |
242 void DisplayController::SetExtendedDesktopEnabled(bool enabled) { | |
243 extended_desktop_enabled = enabled; | |
244 } | 236 } |
245 | 237 |
246 aura::RootWindow* DisplayController::AddRootWindowForDisplay( | 238 aura::RootWindow* DisplayController::AddRootWindowForDisplay( |
247 const gfx::Display& display) { | 239 const gfx::Display& display) { |
248 aura::RootWindow* root = aura::Env::GetInstance()->display_manager()-> | 240 aura::RootWindow* root = aura::Env::GetInstance()->display_manager()-> |
249 CreateRootWindowForDisplay(display); | 241 CreateRootWindowForDisplay(display); |
250 root_windows_[display.id()] = root; | 242 root_windows_[display.id()] = root; |
251 // Confine the cursor within the window if | 243 // Confine the cursor within the window if |
252 // 1) Extended desktop is enabled or | 244 // 1) Extended desktop is enabled or |
253 // 2) the display is primary display and the host window | 245 // 2) the display is primary display and the host window |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 break; | 280 break; |
289 } | 281 } |
290 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 282 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
291 secondary_display->set_bounds( | 283 secondary_display->set_bounds( |
292 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 284 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
293 secondary_display->UpdateWorkAreaFromInsets(insets); | 285 secondary_display->UpdateWorkAreaFromInsets(insets); |
294 } | 286 } |
295 | 287 |
296 } // namespace internal | 288 } // namespace internal |
297 } // namespace ash | 289 } // namespace ash |
OLD | NEW |