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

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

Issue 335003003: Introduces AppActivity and handler of chrome.shell API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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
« no previous file with comments | « apps/shell/browser/shell_desktop_controller.h ('k') | apps/shell/test/shell_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61eef82a6309a1ece5b2269d89e3f87e0a15c81e..2db85b792b12225ceeab2e7037ebd9fe48b382b2 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,20 @@ 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_->CreateAppWindow(context);
}
-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 +218,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());
}
« no previous file with comments | « apps/shell/browser/shell_desktop_controller.h ('k') | apps/shell/test/shell_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698