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

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: AppWindow ownership 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
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_
oshima 2014/06/16 18:40:08 then you can remove NULL check?
Jun Mukai 2014/06/16 18:48:15 Removed, anyways app_window_controller_ needs to b
+ ? 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());
}

Powered by Google App Engine
This is Rietveld 408576698