Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: extensions/shell/browser/shell_desktop_controller.cc

Issue 543123004: Close AppWindow to perform clean shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@apifeatures
Patch Set: Add comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/shell/browser/shell_desktop_controller.cc
diff --git a/extensions/shell/browser/shell_desktop_controller.cc b/extensions/shell/browser/shell_desktop_controller.cc
index 625547bd3d43bb31cda7e60efc73827f88271bdd..8c3c553ca595b273b362661fc372c4754a69e0b2 100644
--- a/extensions/shell/browser/shell_desktop_controller.cc
+++ b/extensions/shell/browser/shell_desktop_controller.cc
@@ -5,6 +5,9 @@
#include "extensions/shell/browser/shell_desktop_controller.h"
#include "base/command_line.h"
+#include "extensions/browser/app_window/app_window.h"
+#include "extensions/browser/app_window/native_app_window.h"
+#include "extensions/shell/browser/shell_app_delegate.h"
#include "extensions/shell/browser/shell_app_window.h"
#include "extensions/shell/common/switches.h"
#include "ui/aura/client/cursor_client.h"
@@ -153,7 +156,8 @@ class AppsFocusRules : public wm::BaseFocusRules {
} // namespace
-ShellDesktopController::ShellDesktopController() {
+ShellDesktopController::ShellDesktopController()
+ : app_window_(NULL) {
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
AddObserver(this);
@@ -167,7 +171,7 @@ ShellDesktopController::ShellDesktopController() {
}
ShellDesktopController::~ShellDesktopController() {
- app_window_.reset();
+ CloseAppWindows();
DestroyRootWindow();
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
@@ -179,20 +183,27 @@ aura::WindowTreeHost* ShellDesktopController::GetHost() {
return host_.get();
}
-ShellAppWindow* ShellDesktopController::CreateAppWindow(
+ShellAppWindow* ShellDesktopController::CreateShellAppWindow(
content::BrowserContext* context,
const Extension* extension) {
aura::Window* root_window = GetHost()->window();
- app_window_.reset(new ShellAppWindow);
- app_window_->Init(context, extension, root_window->bounds().size());
+ shell_app_window_.reset(new ShellAppWindow);
+ shell_app_window_->Init(context, extension, root_window->bounds().size());
// Attach the web contents view to our window hierarchy.
- aura::Window* content = app_window_->GetNativeWindow();
+ aura::Window* content = shell_app_window_->GetNativeWindow();
AddAppWindow(content);
content->Show();
- return app_window_.get();
+ return shell_app_window_.get();
+}
+
+AppWindow* ShellDesktopController::CreateAppWindow(
+ content::BrowserContext* context,
+ const Extension* extension) {
+ app_window_ = new AppWindow(context, new ShellAppDelegate, extension);
+ return app_window_;
}
void ShellDesktopController::AddAppWindow(aura::Window* window) {
@@ -201,7 +212,11 @@ void ShellDesktopController::AddAppWindow(aura::Window* window) {
}
void ShellDesktopController::CloseAppWindows() {
- app_window_.reset();
+ shell_app_window_.reset();
+ if (app_window_) {
+ app_window_->GetBaseWindow()->Close(); // Close() deletes |app_window_|.
+ app_window_ = NULL;
+ }
}
aura::Window* ShellDesktopController::GetDefaultParent(
« no previous file with comments | « extensions/shell/browser/shell_desktop_controller.h ('k') | extensions/shell/browser/shell_native_app_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698