| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/shell/browser/default_shell_app_window_controller.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "extensions/shell/browser/shell_app_window.h" | |
| 9 #include "extensions/shell/browser/shell_desktop_controller.h" | |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/aura/window_tree_host.h" | |
| 12 | |
| 13 namespace extensions { | |
| 14 | |
| 15 DefaultShellAppWindowController::DefaultShellAppWindowController( | |
| 16 ShellDesktopController* shell_desktop_controller) | |
| 17 : shell_desktop_controller_(shell_desktop_controller) { | |
| 18 DCHECK(shell_desktop_controller_); | |
| 19 } | |
| 20 | |
| 21 DefaultShellAppWindowController::~DefaultShellAppWindowController() { | |
| 22 // The app window must be explicitly closed before desktop teardown. | |
| 23 DCHECK(!app_window_); | |
| 24 } | |
| 25 | |
| 26 ShellAppWindow* DefaultShellAppWindowController::CreateAppWindow( | |
| 27 content::BrowserContext* context, | |
| 28 const Extension* extension) { | |
| 29 aura::Window* root_window = shell_desktop_controller_->host()->window(); | |
| 30 | |
| 31 app_window_.reset(new ShellAppWindow); | |
| 32 app_window_->Init(context, extension, root_window->bounds().size()); | |
| 33 | |
| 34 // Attach the web contents view to our window hierarchy. | |
| 35 aura::Window* content = app_window_->GetNativeWindow(); | |
| 36 root_window->AddChild(content); | |
| 37 content->Show(); | |
| 38 | |
| 39 return app_window_.get(); | |
| 40 } | |
| 41 | |
| 42 void DefaultShellAppWindowController::CloseAppWindows() { | |
| 43 app_window_.reset(); | |
| 44 } | |
| 45 | |
| 46 } // namespace extensions | |
| OLD | NEW |