| Index: apps/shell/browser/shell_desktop_controller.cc
|
| diff --git a/apps/shell/browser/shell_desktop_controller.cc b/apps/shell/browser/shell_desktop_controller.cc
|
| index 396758f6ddd9afaf8aebdffb5a77c6357c921b9e..ae0fc07383e6a4e0dff8a690c68d3e4f60f32515 100644
|
| --- a/apps/shell/browser/shell_desktop_controller.cc
|
| +++ b/apps/shell/browser/shell_desktop_controller.cc
|
| @@ -4,7 +4,7 @@
|
|
|
| #include "apps/shell/browser/shell_desktop_controller.h"
|
|
|
| -#include "apps/shell/browser/shell_app_window.h"
|
| +#include "apps/shell/browser/shell_app_window_controller.h"
|
| #include "content/public/browser/context_factory.h"
|
| #include "ui/aura/client/cursor_client.h"
|
| #include "ui/aura/client/default_capture_client.h"
|
| @@ -173,8 +173,7 @@ ShellDesktopController::ShellDesktopController() {
|
| }
|
|
|
| ShellDesktopController::~ShellDesktopController() {
|
| - // The app window must be explicitly closed before desktop teardown.
|
| - DCHECK(!app_window_);
|
| + app_window_controller_.reset();
|
| g_instance = NULL;
|
| DestroyRootWindow();
|
| aura::Env::DeleteInstance();
|
| @@ -185,22 +184,22 @@ ShellDesktopController* ShellDesktopController::instance() {
|
| return g_instance;
|
| }
|
|
|
| +void ShellDesktopController::SetAppWindowController(
|
| + ShellAppWindowController* app_window_controller) {
|
| + app_window_controller_.reset(app_window_controller);
|
| +}
|
| +
|
| ShellAppWindow* ShellDesktopController::CreateAppWindow(
|
| content::BrowserContext* context) {
|
| - aura::Window* root_window = host_->window();
|
| -
|
| - app_window_.reset(new ShellAppWindow);
|
| - app_window_->Init(context, root_window->bounds().size());
|
| -
|
| - // Attach the web contents view to our window hierarchy.
|
| - aura::Window* content = app_window_->GetNativeWindow();
|
| - root_window->AddChild(content);
|
| - content->Show();
|
| -
|
| - return app_window_.get();
|
| + return app_window_controller_
|
| + ? app_window_controller_->CreateAppWindow(context)
|
| + : NULL;
|
| }
|
|
|
| -void ShellDesktopController::CloseAppWindow() { app_window_.reset(); }
|
| +void ShellDesktopController::CloseAppWindows() {
|
| + if (app_window_controller_)
|
| + app_window_controller_->CloseAppWindows();
|
| +}
|
|
|
| aura::Window* ShellDesktopController::GetDefaultParent(
|
| aura::Window* context,
|
| @@ -221,7 +220,7 @@ void ShellDesktopController::OnDisplayModeChanged(
|
| void ShellDesktopController::OnHostCloseRequested(
|
| const aura::WindowTreeHost* host) {
|
| DCHECK_EQ(host_.get(), host);
|
| - CloseAppWindow();
|
| + CloseAppWindows();
|
| base::MessageLoop::current()->PostTask(FROM_HERE,
|
| base::MessageLoop::QuitClosure());
|
| }
|
|
|