Chromium Code Reviews| 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..3b9eb0bcee47fc6ff2822c6f7d6fea438e3a4bf9 |
| --- /dev/null |
| +++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2011 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()); |
| + |
| + gtk_widget_set_size_request(GTK_WIDGET(window_), 512, 384); |
|
miket_OOO
2011/12/20 19:12:34
Original Mac resolution?
Mihai Parparita -not on Chrome
2012/01/04 22:46:46
If it was good enough in 1984, it's good enough no
|
| + 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; |
| +} |