| 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.h" | 5 #include "extensions/shell/browser/shell_desktop_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "extensions/browser/app_window/app_window.h" | 11 #include "extensions/browser/app_window/app_window.h" |
| 12 #include "extensions/browser/app_window/native_app_window.h" | 12 #include "extensions/browser/app_window/native_app_window.h" |
| 13 #include "extensions/shell/browser/shell_app_delegate.h" | 13 #include "extensions/shell/browser/shell_app_delegate.h" |
| 14 #include "extensions/shell/browser/shell_apps_client.h" | 14 #include "extensions/shell/browser/shell_app_window_client.h" |
| 15 #include "extensions/shell/common/switches.h" | 15 #include "extensions/shell/common/switches.h" |
| 16 #include "ui/aura/client/cursor_client.h" | 16 #include "ui/aura/client/cursor_client.h" |
| 17 #include "ui/aura/client/default_capture_client.h" | 17 #include "ui/aura/client/default_capture_client.h" |
| 18 #include "ui/aura/layout_manager.h" | 18 #include "ui/aura/layout_manager.h" |
| 19 #include "ui/aura/test/test_screen.h" | 19 #include "ui/aura/test/test_screen.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 22 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
| 23 #include "ui/base/cursor/cursor.h" | 23 #include "ui/base/cursor/cursor.h" |
| 24 #include "ui/base/cursor/image_cursors.h" | 24 #include "ui/base/cursor/image_cursors.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 private: | 156 private: |
| 157 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); | 157 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 | 161 |
| 162 ShellDesktopController::ShellDesktopController() | 162 ShellDesktopController::ShellDesktopController() |
| 163 : apps_client_(new ShellAppsClient), app_window_(NULL) { | 163 : apps_client_(new ShellAppWindowClient), app_window_(NULL) { |
| 164 extensions::AppsClient::Set(apps_client_.get()); | 164 extensions::AppWindowClient::Set(apps_client_.get()); |
| 165 | 165 |
| 166 #if defined(OS_CHROMEOS) | 166 #if defined(OS_CHROMEOS) |
| 167 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 167 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 168 AddObserver(this); | 168 AddObserver(this); |
| 169 display_configurator_.reset(new ui::DisplayConfigurator); | 169 display_configurator_.reset(new ui::DisplayConfigurator); |
| 170 display_configurator_->Init(false); | 170 display_configurator_->Init(false); |
| 171 display_configurator_->ForceInitialConfigure(0); | 171 display_configurator_->ForceInitialConfigure(0); |
| 172 display_configurator_->AddObserver(this); | 172 display_configurator_->AddObserver(this); |
| 173 #endif | 173 #endif |
| 174 CreateRootWindow(); | 174 CreateRootWindow(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 ShellDesktopController::~ShellDesktopController() { | 177 ShellDesktopController::~ShellDesktopController() { |
| 178 CloseAppWindows(); | 178 CloseAppWindows(); |
| 179 DestroyRootWindow(); | 179 DestroyRootWindow(); |
| 180 #if defined(OS_CHROMEOS) | 180 #if defined(OS_CHROMEOS) |
| 181 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 181 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 182 RemoveObserver(this); | 182 RemoveObserver(this); |
| 183 #endif | 183 #endif |
| 184 extensions::AppsClient::Set(NULL); | 184 extensions::AppWindowClient::Set(NULL); |
| 185 } | 185 } |
| 186 | 186 |
| 187 aura::WindowTreeHost* ShellDesktopController::GetHost() { | 187 aura::WindowTreeHost* ShellDesktopController::GetHost() { |
| 188 return host_.get(); | 188 return host_.get(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 AppWindow* ShellDesktopController::CreateAppWindow( | 191 AppWindow* ShellDesktopController::CreateAppWindow( |
| 192 content::BrowserContext* context, | 192 content::BrowserContext* context, |
| 193 const Extension* extension) { | 193 const Extension* extension) { |
| 194 app_window_ = new AppWindow(context, new ShellAppDelegate, extension); | 194 app_window_ = new AppWindow(context, new ShellAppDelegate, extension); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 if (displays.empty()) | 343 if (displays.empty()) |
| 344 return gfx::Size(); | 344 return gfx::Size(); |
| 345 const ui::DisplayMode* mode = displays[0].display->current_mode(); | 345 const ui::DisplayMode* mode = displays[0].display->current_mode(); |
| 346 return mode ? mode->size() : gfx::Size(); | 346 return mode ? mode->size() : gfx::Size(); |
| 347 #else | 347 #else |
| 348 return gfx::Size(); | 348 return gfx::Size(); |
| 349 #endif | 349 #endif |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace extensions | 352 } // namespace extensions |
| OLD | NEW |