Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/gtk/extensions/shell_window_gtk.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/extension_host.h" | |
| 8 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | |
| 9 | |
| 10 ShellWindowGtk::ShellWindowGtk(ExtensionHost* host) | |
| 11 : ShellWindow(host) { | |
| 12 host_->view()->SetContainer(this); | |
| 13 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | |
| 14 | |
| 15 gtk_container_add(GTK_CONTAINER(window_), host_->view()->native_view()); | |
| 16 | |
| 17 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
| |
| 18 gtk_window_set_decorated(window_, false); | |
| 19 | |
| 20 g_signal_connect(window_, "delete-event", | |
| 21 G_CALLBACK(OnMainWindowDeleteEventThunk), this); | |
| 22 | |
| 23 gtk_window_present(window_); | |
| 24 } | |
| 25 | |
| 26 ShellWindowGtk::~ShellWindowGtk() { | |
| 27 } | |
| 28 | |
| 29 void ShellWindowGtk::Close() { | |
| 30 gtk_widget_destroy(GTK_WIDGET(window_)); | |
| 31 delete this; | |
| 32 } | |
| 33 | |
| 34 // Callback for the delete event. This event is fired when the user tries to | |
| 35 // close the window (e.g., clicking on the X in the window manager title bar). | |
| 36 gboolean ShellWindowGtk::OnMainWindowDeleteEvent(GtkWidget* widget, | |
| 37 GdkEvent* event) { | |
| 38 Close(); | |
| 39 | |
| 40 // Return true to prevent the GTK window from being destroyed. Close will | |
| 41 // destroy it for us. | |
| 42 return TRUE; | |
| 43 } | |
| OLD | NEW |