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

Unified Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 8985008: Don't use browser windows for platform app shell windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable platform app tests on non-GTK platforms. Created 8 years, 11 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 | « chrome/browser/ui/extensions/shell_window.h ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/extensions/shell_window.cc
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0a21d5c8548b114b140d96059b3bdf18f1c6b38d
--- /dev/null
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/extensions/shell_window.h"
+
+#include "chrome/browser/extensions/extension_process_manager.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_source.h"
+
+ShellWindow::ShellWindow(ExtensionHost* host)
+ : host_(host) {
+ // Close the window in response to window.close() and the like.
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
+ content::Source<Profile>(host->profile()));
+}
+
+ShellWindow::~ShellWindow() {
+}
+
+ShellWindow* ShellWindow::Create(Profile* profile,
+ const Extension* extension,
+ const GURL& url) {
+ ExtensionProcessManager* manager = profile->GetExtensionProcessManager();
+ DCHECK(manager);
+ if (!manager)
+ return NULL;
+
+ ExtensionHost* host = manager->CreateShellHost(extension, url);
+ // CHECK host so that non-GTK platform compilers don't complain about unused
+ // variables.
+ // TODO(mihaip): remove when ShellWindow has been implemented everywhere.
+ CHECK(host);
+
+#if defined(TOOLKIT_GTK)
+ // This object will delete itself when the window is closed.
+ // TODO(mihaip): remove the #if block when ShellWindow has been implemented
+ // everywhere.
+ return ShellWindow::CreateShellWindow(host);
+#endif
+
+ return NULL;
+}
+
+void ShellWindow::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ switch (type) {
+ case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
+ if (content::Details<ExtensionHost>(host_.get()) == details)
+ Close();
+ break;
+ default:
+ NOTREACHED() << "Received unexpected notification";
+ }
+}
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.h ('k') | chrome/browser/ui/gtk/browser_titlebar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698