OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "webkit/plugins/npapi/gtk_plugin_container.h" | 5 #include "webkit/glue/plugins/gtk_plugin_container.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
11 namespace webkit { | |
12 namespace npapi { | |
13 | |
14 namespace { | 11 namespace { |
15 | 12 |
16 // NOTE: This class doesn't have constructors/destructors, it is created | 13 // NOTE: This class doesn't have constructors/destructors, it is created |
17 // through GLib's object management. | 14 // through GLib's object management. |
18 class GtkPluginContainer : public GtkSocket { | 15 class GtkPluginContainer : public GtkSocket { |
19 public: | 16 public: |
20 // Sets the requested size of the widget. | 17 // Sets the requested size of the widget. |
21 void set_size(int width, int height) { | 18 void set_size(int width, int height) { |
22 width_ = width; | 19 width_ = width; |
23 height_ = height; | 20 height_ = height; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 GtkPluginContainer *container = CastChecked(widget); | 64 GtkPluginContainer *container = CastChecked(widget); |
68 requisition->width = container->width_; | 65 requisition->width = container->width_; |
69 requisition->height = container->height_; | 66 requisition->height = container->height_; |
70 } | 67 } |
71 | 68 |
72 int width_; | 69 int width_; |
73 int height_; | 70 int height_; |
74 DISALLOW_IMPLICIT_CONSTRUCTORS(GtkPluginContainer); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(GtkPluginContainer); |
75 }; | 72 }; |
76 | 73 |
77 } // namespace | 74 } // anonymous namespace |
78 | 75 |
79 // Create a new instance of our GTK widget object. | 76 // Create a new instance of our GTK widget object. |
80 GtkWidget* gtk_plugin_container_new() { | 77 GtkWidget* gtk_plugin_container_new() { |
81 return GTK_WIDGET(g_object_new(GtkPluginContainer::GetType(), NULL)); | 78 return GTK_WIDGET(g_object_new(GtkPluginContainer::GetType(), NULL)); |
82 } | 79 } |
83 | 80 |
84 void gtk_plugin_container_set_size(GtkWidget *widget, int width, int height) { | 81 void gtk_plugin_container_set_size(GtkWidget *widget, int width, int height) { |
85 GtkPluginContainer::CastChecked(widget)->set_size(width, height); | 82 GtkPluginContainer::CastChecked(widget)->set_size(width, height); |
86 // Signal the parent that the size request has changed. | 83 // Signal the parent that the size request has changed. |
87 gtk_widget_queue_resize_no_redraw(widget); | 84 gtk_widget_queue_resize_no_redraw(widget); |
88 } | 85 } |
89 | |
90 } // namespace npapi | |
91 } // namespace webkit | |
OLD | NEW |