| 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 "apps/shell/browser/shell_desktop_controller.h" | 5 #include "apps/shell/browser/shell_desktop_controller.h" |
| 6 | 6 |
| 7 #include "apps/shell/browser/shell_app_window.h" | 7 #include "apps/shell/browser/shell_app_window.h" |
| 8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/layout_manager.h" | 10 #include "ui/aura/layout_manager.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 ShellDesktopController* g_instance = NULL; | 86 ShellDesktopController* g_instance = NULL; |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 ShellDesktopController::ShellDesktopController() { | 90 ShellDesktopController::ShellDesktopController() { |
| 91 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
| 92 output_configurator_.reset(new ui::OutputConfigurator); | 92 display_configurator_.reset(new ui::DisplayConfigurator); |
| 93 output_configurator_->Init(false); | 93 display_configurator_->Init(false); |
| 94 output_configurator_->ForceInitialConfigure(0); | 94 display_configurator_->ForceInitialConfigure(0); |
| 95 output_configurator_->AddObserver(this); | 95 display_configurator_->AddObserver(this); |
| 96 #endif | 96 #endif |
| 97 CreateRootWindow(); | 97 CreateRootWindow(); |
| 98 | 98 |
| 99 DCHECK(!views::ViewsDelegate::views_delegate); | 99 DCHECK(!views::ViewsDelegate::views_delegate); |
| 100 views::ViewsDelegate::views_delegate = | 100 views::ViewsDelegate::views_delegate = |
| 101 new ShellViewsDelegate(wm_test_helper_->host()->window()); | 101 new ShellViewsDelegate(wm_test_helper_->host()->window()); |
| 102 | 102 |
| 103 g_instance = this; | 103 g_instance = this; |
| 104 } | 104 } |
| 105 | 105 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ShellDesktopController::CloseAppWindow() { app_window_.reset(); } | 136 void ShellDesktopController::CloseAppWindow() { app_window_.reset(); } |
| 137 | 137 |
| 138 aura::WindowTreeHost* ShellDesktopController::GetWindowTreeHost() { | 138 aura::WindowTreeHost* ShellDesktopController::GetWindowTreeHost() { |
| 139 return wm_test_helper_->host(); | 139 return wm_test_helper_->host(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if defined(OS_CHROMEOS) | 142 #if defined(OS_CHROMEOS) |
| 143 void ShellDesktopController::OnDisplayModeChanged( | 143 void ShellDesktopController::OnDisplayModeChanged( |
| 144 const std::vector<ui::OutputConfigurator::DisplayState>& outputs) { | 144 const std::vector<ui::DisplayConfigurator::DisplayState>& outputs) { |
| 145 gfx::Size size = GetPrimaryDisplaySize(); | 145 gfx::Size size = GetPrimaryDisplaySize(); |
| 146 if (!size.IsEmpty()) | 146 if (!size.IsEmpty()) |
| 147 wm_test_helper_->host()->UpdateRootWindowSize(size); | 147 wm_test_helper_->host()->UpdateRootWindowSize(size); |
| 148 } | 148 } |
| 149 #endif | 149 #endif |
| 150 | 150 |
| 151 void ShellDesktopController::CreateRootWindow() { | 151 void ShellDesktopController::CreateRootWindow() { |
| 152 test_screen_.reset(aura::TestScreen::Create()); | 152 test_screen_.reset(aura::TestScreen::Create()); |
| 153 // TODO(jamescook): Replace this with a real Screen implementation. | 153 // TODO(jamescook): Replace this with a real Screen implementation. |
| 154 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 154 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 170 host->Show(); | 170 host->Show(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void ShellDesktopController::DestroyRootWindow() { | 173 void ShellDesktopController::DestroyRootWindow() { |
| 174 wm_test_helper_.reset(); | 174 wm_test_helper_.reset(); |
| 175 ui::ShutdownInputMethodForTesting(); | 175 ui::ShutdownInputMethodForTesting(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { | 178 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { |
| 179 #if defined(OS_CHROMEOS) | 179 #if defined(OS_CHROMEOS) |
| 180 const std::vector<ui::OutputConfigurator::DisplayState>& states = | 180 const std::vector<ui::DisplayConfigurator::DisplayState>& states = |
| 181 output_configurator_->cached_outputs(); | 181 display_configurator_->cached_outputs(); |
| 182 if (states.empty()) | 182 if (states.empty()) |
| 183 return gfx::Size(); | 183 return gfx::Size(); |
| 184 const ui::DisplayMode* mode = states[0].display->current_mode(); | 184 const ui::DisplayMode* mode = states[0].display->current_mode(); |
| 185 return mode ? mode->size() : gfx::Size(); | 185 return mode ? mode->size() : gfx::Size(); |
| 186 #else | 186 #else |
| 187 return gfx::Size(); | 187 return gfx::Size(); |
| 188 #endif | 188 #endif |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace apps | 191 } // namespace apps |
| OLD | NEW |