| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GetBounds(out, false); | 216 GetBounds(out, false); |
| 217 | 217 |
| 218 // Callers expect the requested bounds not the actual bounds. For example, | 218 // Callers expect the requested bounds not the actual bounds. For example, |
| 219 // during init callers expect 0x0, but Gtk layout enforces a min size of 1x1. | 219 // during init callers expect 0x0, but Gtk layout enforces a min size of 1x1. |
| 220 out->set_width(GetNativeView()->requisition.width); | 220 GtkRequisition requisition; |
| 221 out->set_height(GetNativeView()->requisition.height); | 221 gtk_widget_get_child_requisition(GetNativeView(), &requisition); |
| 222 out->set_width(requisition.width); |
| 223 out->set_height(requisition.height); |
| 222 } | 224 } |
| 223 | 225 |
| 224 void TabContentsViewGtk::StartDragging(const WebDropData& drop_data, | 226 void TabContentsViewGtk::StartDragging(const WebDropData& drop_data, |
| 225 WebDragOperationsMask ops, | 227 WebDragOperationsMask ops, |
| 226 const SkBitmap& image, | 228 const SkBitmap& image, |
| 227 const gfx::Point& image_offset) { | 229 const gfx::Point& image_offset) { |
| 228 drag_source_->StartDragging(drop_data, ops, &last_mouse_down_, | 230 drag_source_->StartDragging(drop_data, ops, &last_mouse_down_, |
| 229 image, image_offset); | 231 image, image_offset); |
| 230 } | 232 } |
| 231 | 233 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // not NULL, else our delegate. | 454 // not NULL, else our delegate. |
| 453 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 455 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
| 454 GdkEventMotion* event) { | 456 GdkEventMotion* event) { |
| 455 if (sad_tab_ != NULL) | 457 if (sad_tab_ != NULL) |
| 456 WidgetGtk::OnMotionNotify(widget, event); | 458 WidgetGtk::OnMotionNotify(widget, event); |
| 457 else if (tab_contents()->delegate()) | 459 else if (tab_contents()->delegate()) |
| 458 tab_contents()->delegate()->ContentsMouseEvent( | 460 tab_contents()->delegate()->ContentsMouseEvent( |
| 459 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 461 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
| 460 return FALSE; | 462 return FALSE; |
| 461 } | 463 } |
| OLD | NEW |