| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 constrained_window); | 143 constrained_window); |
| 144 DCHECK(item != constrained_windows_.end()); | 144 DCHECK(item != constrained_windows_.end()); |
| 145 RemoveChild((*item)->widget()); | 145 RemoveChild((*item)->widget()); |
| 146 constrained_windows_.erase(item); | 146 constrained_windows_.erase(item); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { | 149 void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { |
| 150 set_delete_on_destroy(false); | 150 set_delete_on_destroy(false); |
| 151 WidgetGtk::Init(NULL, gfx::Rect(0, 0, initial_size.width(), | 151 WidgetGtk::Init(NULL, gfx::Rect(0, 0, initial_size.width(), |
| 152 initial_size.height())); | 152 initial_size.height())); |
| 153 // We need to own the widget in order to attach/detach the native view |
| 154 // to container. |
| 155 gtk_object_ref(GTK_OBJECT(GetNativeView())); |
| 153 } | 156 } |
| 154 | 157 |
| 155 RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget( | 158 RenderWidgetHostView* TabContentsViewGtk::CreateViewForWidget( |
| 156 RenderWidgetHost* render_widget_host) { | 159 RenderWidgetHost* render_widget_host) { |
| 157 if (render_widget_host->view()) { | 160 if (render_widget_host->view()) { |
| 158 // During testing, the view will already be set up in most cases to the | 161 // During testing, the view will already be set up in most cases to the |
| 159 // test view, so we don't want to clobber it with a real one. To verify that | 162 // test view, so we don't want to clobber it with a real one. To verify that |
| 160 // this actually is happening (and somebody isn't accidentally creating the | 163 // this actually is happening (and somebody isn't accidentally creating the |
| 161 // view twice), we check for the RVH Factory, which will be set when we're | 164 // view twice), we check for the RVH Factory, which will be set when we're |
| 162 // making special ones (which go along with the special views). | 165 // making special ones (which go along with the special views). |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 // not NULL, else our delegate. | 409 // not NULL, else our delegate. |
| 407 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, | 410 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, |
| 408 GdkEventMotion* event) { | 411 GdkEventMotion* event) { |
| 409 if (sad_tab_ != NULL) | 412 if (sad_tab_ != NULL) |
| 410 WidgetGtk::OnMotionNotify(widget, event); | 413 WidgetGtk::OnMotionNotify(widget, event); |
| 411 else if (tab_contents()->delegate()) | 414 else if (tab_contents()->delegate()) |
| 412 tab_contents()->delegate()->ContentsMouseEvent( | 415 tab_contents()->delegate()->ContentsMouseEvent( |
| 413 tab_contents(), views::Screen::GetCursorScreenPoint(), true); | 416 tab_contents(), views::Screen::GetCursorScreenPoint(), true); |
| 414 return FALSE; | 417 return FALSE; |
| 415 } | 418 } |
| 416 | |
| OLD | NEW |