OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 return NULL; | 206 return NULL; |
207 return rwhv->GetNativeView(); | 207 return rwhv->GetNativeView(); |
208 } | 208 } |
209 | 209 |
210 gfx::NativeWindow TabContentsViewGtk::GetTopLevelNativeWindow() const { | 210 gfx::NativeWindow TabContentsViewGtk::GetTopLevelNativeWindow() const { |
211 GtkWidget* window = gtk_widget_get_ancestor(GetNativeView(), GTK_TYPE_WINDOW); | 211 GtkWidget* window = gtk_widget_get_ancestor(GetNativeView(), GTK_TYPE_WINDOW); |
212 return window ? GTK_WINDOW(window) : NULL; | 212 return window ? GTK_WINDOW(window) : NULL; |
213 } | 213 } |
214 | 214 |
215 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { | 215 void TabContentsViewGtk::GetContainerBounds(gfx::Rect* out) const { |
| 216 // Callers expect the requested bounds not the actual bounds. For example, |
| 217 // during init callers expect 0x0, but Gtk layout enforces a min size of 1x1. |
216 GetBounds(out, false); | 218 GetBounds(out, false); |
217 | 219 |
218 // Callers expect the requested bounds not the actual bounds. For example, | 220 gfx::Size size; |
219 // during init callers expect 0x0, but Gtk layout enforces a min size of 1x1. | 221 WidgetGtk::GetRequestedSize(&size); |
220 GtkRequisition requisition; | 222 out->set_size(size); |
221 gtk_widget_get_child_requisition(GetNativeView(), &requisition); | |
222 out->set_width(requisition.width); | |
223 out->set_height(requisition.height); | |
224 } | 223 } |
225 | 224 |
226 void TabContentsViewGtk::StartDragging(const WebDropData& drop_data, | 225 void TabContentsViewGtk::StartDragging(const WebDropData& drop_data, |
227 WebDragOperationsMask ops, | 226 WebDragOperationsMask ops, |
228 const SkBitmap& image, | 227 const SkBitmap& image, |
229 const gfx::Point& image_offset) { | 228 const gfx::Point& image_offset) { |
230 drag_source_->StartDragging(drop_data, ops, &last_mouse_down_, | 229 drag_source_->StartDragging(drop_data, ops, &last_mouse_down_, |
231 image, image_offset); | 230 image, image_offset); |
232 } | 231 } |
233 | 232 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // not NULL, else our delegate. | 453 // not NULL, else our delegate. |
455 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 454 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
456 GdkEventMotion* event) { | 455 GdkEventMotion* event) { |
457 if (sad_tab_ != NULL) | 456 if (sad_tab_ != NULL) |
458 WidgetGtk::OnMotionNotify(widget, event); | 457 WidgetGtk::OnMotionNotify(widget, event); |
459 else if (tab_contents()->delegate()) | 458 else if (tab_contents()->delegate()) |
460 tab_contents()->delegate()->ContentsMouseEvent( | 459 tab_contents()->delegate()->ContentsMouseEvent( |
461 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 460 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
462 return FALSE; | 461 return FALSE; |
463 } | 462 } |
OLD | NEW |