| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/extensions/shell_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/shell_window_gtk.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/platform_app_host.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "content/public/browser/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
| 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/browser/web_contents_view.h" |
| 10 #include "ui/base/x/active_window_watcher_x.h" | 12 #include "ui/base/x/active_window_watcher_x.h" |
| 11 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 12 | 14 |
| 13 ShellWindowGtk::ShellWindowGtk(ExtensionHost* host) | 15 ShellWindowGtk::ShellWindowGtk(PlatformAppHost* host, |
| 14 : ShellWindow(host), | 16 const Extension* extension) |
| 17 : ShellWindow(host, extension), |
| 15 state_(GDK_WINDOW_STATE_WITHDRAWN), | 18 state_(GDK_WINDOW_STATE_WITHDRAWN), |
| 16 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()) { | 19 is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()) { |
| 17 host_->view()->SetContainer(this); | |
| 18 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 20 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
| 19 | 21 |
| 20 gtk_container_add(GTK_CONTAINER(window_), host_->view()->native_view()); | 22 gfx::NativeView native_view = |
| 21 | 23 host->host_contents()->GetView()->GetNativeView(); |
| 22 const Extension* extension = host_->extension(); | 24 gtk_container_add(GTK_CONTAINER(window_), native_view); |
| 23 | 25 |
| 24 // TOOD(mihaip): restore prior window dimensions and positions on relaunch. | 26 // TOOD(mihaip): restore prior window dimensions and positions on relaunch. |
| 25 gtk_window_set_default_size( | 27 gtk_window_set_default_size( |
| 26 window_, extension->launch_width(), extension->launch_height()); | 28 window_, extension->launch_width(), extension->launch_height()); |
| 27 | 29 |
| 28 int min_width = extension->launch_min_width(); | 30 int min_width = extension->launch_min_width(); |
| 29 int min_height = extension->launch_min_height(); | 31 int min_height = extension->launch_min_height(); |
| 30 int max_width = extension->launch_max_width(); | 32 int max_width = extension->launch_max_width(); |
| 31 int max_height = extension->launch_max_height(); | 33 int max_height = extension->launch_max_height(); |
| 32 GdkGeometry hints; | 34 GdkGeometry hints; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return FALSE; | 185 return FALSE; |
| 184 } | 186 } |
| 185 | 187 |
| 186 gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender, | 188 gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender, |
| 187 GdkEventWindowState* event) { | 189 GdkEventWindowState* event) { |
| 188 state_ = event->new_window_state; | 190 state_ = event->new_window_state; |
| 189 return FALSE; | 191 return FALSE; |
| 190 } | 192 } |
| 191 | 193 |
| 192 // static | 194 // static |
| 193 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { | 195 ShellWindow* ShellWindow::CreateShellWindow(PlatformAppHost* host, |
| 194 return new ShellWindowGtk(host); | 196 const Extension* extension) { |
| 197 return new ShellWindowGtk(host, extension); |
| 195 } | 198 } |
| OLD | NEW |