Chromium Code Reviews| 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/common/switches.h" | 15 #include "extensions/shell/common/switches.h" |
| 15 #include "ui/aura/client/cursor_client.h" | 16 #include "ui/aura/client/cursor_client.h" |
| 16 #include "ui/aura/client/default_capture_client.h" | 17 #include "ui/aura/client/default_capture_client.h" |
| 17 #include "ui/aura/layout_manager.h" | 18 #include "ui/aura/layout_manager.h" |
| 18 #include "ui/aura/test/test_screen.h" | 19 #include "ui/aura/test/test_screen.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 #include "ui/aura/window_event_dispatcher.h" | 21 #include "ui/aura/window_event_dispatcher.h" |
| 21 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
| 22 #include "ui/base/cursor/cursor.h" | 23 #include "ui/base/cursor/cursor.h" |
| 23 #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... | |
| 152 return true; | 153 return true; |
| 153 } | 154 } |
| 154 | 155 |
| 155 private: | 156 private: |
| 156 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); | 157 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); |
| 157 }; | 158 }; |
| 158 | 159 |
| 159 } // namespace | 160 } // namespace |
| 160 | 161 |
| 161 ShellDesktopController::ShellDesktopController() | 162 ShellDesktopController::ShellDesktopController() |
| 162 : app_window_(NULL) { | 163 : apps_client_(new ShellAppsClient), app_window_(NULL) { |
| 164 extensions::AppsClient::Set(apps_client_.get()); | |
| 165 | |
| 163 #if defined(OS_CHROMEOS) | 166 #if defined(OS_CHROMEOS) |
| 164 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 167 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 165 AddObserver(this); | 168 AddObserver(this); |
| 166 display_configurator_.reset(new ui::DisplayConfigurator); | 169 display_configurator_.reset(new ui::DisplayConfigurator); |
| 167 display_configurator_->Init(false); | 170 display_configurator_->Init(false); |
| 168 display_configurator_->ForceInitialConfigure(0); | 171 display_configurator_->ForceInitialConfigure(0); |
| 169 display_configurator_->AddObserver(this); | 172 display_configurator_->AddObserver(this); |
| 170 #endif | 173 #endif |
| 171 | |
| 172 CreateRootWindow(); | 174 CreateRootWindow(); |
| 173 } | 175 } |
| 174 | 176 |
| 175 ShellDesktopController::~ShellDesktopController() { | 177 ShellDesktopController::~ShellDesktopController() { |
| 178 extensions::AppsClient::Set(NULL); | |
|
James Cook
2014/09/18 19:08:26
nit: I would either move this to the end of this f
oshima
2014/09/18 20:56:49
Done.
| |
| 176 CloseAppWindows(); | 179 CloseAppWindows(); |
| 177 DestroyRootWindow(); | 180 DestroyRootWindow(); |
| 178 #if defined(OS_CHROMEOS) | 181 #if defined(OS_CHROMEOS) |
| 179 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 182 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 180 RemoveObserver(this); | 183 RemoveObserver(this); |
| 181 #endif | 184 #endif |
| 182 } | 185 } |
| 183 | 186 |
| 184 aura::WindowTreeHost* ShellDesktopController::GetHost() { | 187 aura::WindowTreeHost* ShellDesktopController::GetHost() { |
| 185 return host_.get(); | 188 return host_.get(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 if (displays.empty()) | 343 if (displays.empty()) |
| 341 return gfx::Size(); | 344 return gfx::Size(); |
| 342 const ui::DisplayMode* mode = displays[0].display->current_mode(); | 345 const ui::DisplayMode* mode = displays[0].display->current_mode(); |
| 343 return mode ? mode->size() : gfx::Size(); | 346 return mode ? mode->size() : gfx::Size(); |
| 344 #else | 347 #else |
| 345 return gfx::Size(); | 348 return gfx::Size(); |
| 346 #endif | 349 #endif |
| 347 } | 350 } |
| 348 | 351 |
| 349 } // namespace extensions | 352 } // namespace extensions |
| OLD | NEW |