| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_desktop_controller_aura.h" | 5 #include "extensions/shell/browser/shell_desktop_controller_aura.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 } // namespace | 176 } // namespace |
| 177 | 177 |
| 178 ShellDesktopControllerAura::ShellDesktopControllerAura() | 178 ShellDesktopControllerAura::ShellDesktopControllerAura() |
| 179 : app_window_client_(new ShellAppWindowClient) { | 179 : app_window_client_(new ShellAppWindowClient) { |
| 180 extensions::AppWindowClient::Set(app_window_client_.get()); | 180 extensions::AppWindowClient::Set(app_window_client_.get()); |
| 181 | 181 |
| 182 #if defined(OS_CHROMEOS) | 182 #if defined(OS_CHROMEOS) |
| 183 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 183 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 184 this); | 184 this); |
| 185 display_configurator_.reset(new ui::DisplayConfigurator); | 185 display_configurator_.reset(new display::DisplayConfigurator); |
| 186 #if defined(USE_OZONE) | 186 #if defined(USE_OZONE) |
| 187 display_configurator_->Init( | 187 display_configurator_->Init( |
| 188 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), false); | 188 ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate(), false); |
| 189 #elif defined(USE_X11) | 189 #elif defined(USE_X11) |
| 190 display_configurator_->Init(base::MakeUnique<ui::NativeDisplayDelegateX11>(), | 190 display_configurator_->Init( |
| 191 false); | 191 base::MakeUnique<display::NativeDisplayDelegateX11>(), false); |
| 192 #endif | 192 #endif |
| 193 display_configurator_->ForceInitialConfigure(0); | 193 display_configurator_->ForceInitialConfigure(0); |
| 194 display_configurator_->AddObserver(this); | 194 display_configurator_->AddObserver(this); |
| 195 #endif | 195 #endif |
| 196 CreateRootWindow(); | 196 CreateRootWindow(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 ShellDesktopControllerAura::~ShellDesktopControllerAura() { | 199 ShellDesktopControllerAura::~ShellDesktopControllerAura() { |
| 200 CloseAppWindows(); | 200 CloseAppWindows(); |
| 201 DestroyRootWindow(); | 201 DestroyRootWindow(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 bool down, | 251 bool down, |
| 252 const base::TimeTicks& timestamp) { | 252 const base::TimeTicks& timestamp) { |
| 253 if (down) { | 253 if (down) { |
| 254 chromeos::DBusThreadManager::Get() | 254 chromeos::DBusThreadManager::Get() |
| 255 ->GetPowerManagerClient() | 255 ->GetPowerManagerClient() |
| 256 ->RequestShutdown(); | 256 ->RequestShutdown(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void ShellDesktopControllerAura::OnDisplayModeChanged( | 260 void ShellDesktopControllerAura::OnDisplayModeChanged( |
| 261 const ui::DisplayConfigurator::DisplayStateList& displays) { | 261 const display::DisplayConfigurator::DisplayStateList& displays) { |
| 262 gfx::Size size = GetPrimaryDisplaySize(); | 262 gfx::Size size = GetPrimaryDisplaySize(); |
| 263 if (!size.IsEmpty()) | 263 if (!size.IsEmpty()) |
| 264 host_->UpdateRootWindowSizeInPixels(size); | 264 host_->UpdateRootWindowSizeInPixels(size); |
| 265 } | 265 } |
| 266 #endif | 266 #endif |
| 267 | 267 |
| 268 void ShellDesktopControllerAura::OnHostCloseRequested( | 268 void ShellDesktopControllerAura::OnHostCloseRequested( |
| 269 const aura::WindowTreeHost* host) { | 269 const aura::WindowTreeHost* host) { |
| 270 DCHECK_EQ(host_.get(), host); | 270 DCHECK_EQ(host_.get(), host); |
| 271 CloseAppWindows(); | 271 CloseAppWindows(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 user_activity_notifier_.reset(); | 379 user_activity_notifier_.reset(); |
| 380 #endif | 380 #endif |
| 381 user_activity_detector_.reset(); | 381 user_activity_detector_.reset(); |
| 382 host_.reset(); | 382 host_.reset(); |
| 383 display::Screen::SetScreenInstance(nullptr); | 383 display::Screen::SetScreenInstance(nullptr); |
| 384 screen_.reset(); | 384 screen_.reset(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 gfx::Size ShellDesktopControllerAura::GetPrimaryDisplaySize() { | 387 gfx::Size ShellDesktopControllerAura::GetPrimaryDisplaySize() { |
| 388 #if defined(OS_CHROMEOS) | 388 #if defined(OS_CHROMEOS) |
| 389 const ui::DisplayConfigurator::DisplayStateList& displays = | 389 const display::DisplayConfigurator::DisplayStateList& displays = |
| 390 display_configurator_->cached_displays(); | 390 display_configurator_->cached_displays(); |
| 391 if (displays.empty()) | 391 if (displays.empty()) |
| 392 return gfx::Size(); | 392 return gfx::Size(); |
| 393 const ui::DisplayMode* mode = displays[0]->current_mode(); | 393 const display::DisplayMode* mode = displays[0]->current_mode(); |
| 394 return mode ? mode->size() : gfx::Size(); | 394 return mode ? mode->size() : gfx::Size(); |
| 395 #else | 395 #else |
| 396 return gfx::Size(); | 396 return gfx::Size(); |
| 397 #endif | 397 #endif |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace extensions | 400 } // namespace extensions |
| OLD | NEW |