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

Unified Diff: chrome/browser/ui/gtk/extensions/shell_window_gtk.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/gtk/extensions/shell_window_gtk.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..525a7dc94b11a3adfee80ec0d38b3563482e246c
--- /dev/null
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc
@@ -0,0 +1,50 @@
+// 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/gtk/extensions/shell_window_gtk.h"
+
+#include "chrome/browser/extensions/extension_host.h"
+#include "content/browser/renderer_host/render_widget_host_view_gtk.h"
+
+ShellWindowGtk::ShellWindowGtk(ExtensionHost* host)
+ : ShellWindow(host) {
+ host_->view()->SetContainer(this);
+ window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
+
+ gtk_container_add(GTK_CONTAINER(window_), host_->view()->native_view());
+
+ // TOOD(mihaip): Allow window dimensions to be specified in manifest (and
+ // restore prior window dimensions and positions on relaunch).
+ gtk_widget_set_size_request(GTK_WIDGET(window_), 512, 384);
+ gtk_window_set_decorated(window_, false);
+
+ g_signal_connect(window_, "delete-event",
+ G_CALLBACK(OnMainWindowDeleteEventThunk), this);
+
+ gtk_window_present(window_);
+}
+
+ShellWindowGtk::~ShellWindowGtk() {
+}
+
+void ShellWindowGtk::Close() {
+ gtk_widget_destroy(GTK_WIDGET(window_));
+ delete this;
+}
+
+// Callback for the delete event. This event is fired when the user tries to
+// close the window (e.g., clicking on the X in the window manager title bar).
+gboolean ShellWindowGtk::OnMainWindowDeleteEvent(GtkWidget* widget,
+ GdkEvent* event) {
+ Close();
+
+ // Return true to prevent the GTK window from being destroyed. Close will
+ // destroy it for us.
+ return TRUE;
+}
+
+// static
+ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) {
+ return new ShellWindowGtk(host);
+}
« no previous file with comments | « chrome/browser/ui/gtk/extensions/shell_window_gtk.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698