| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/owned_widget_gtk.h" | 5 #include "ui/base/gtk/owned_widget_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 namespace ui { |
| 12 |
| 11 OwnedWidgetGtk::~OwnedWidgetGtk() { | 13 OwnedWidgetGtk::~OwnedWidgetGtk() { |
| 12 Destroy(); | 14 Destroy(); |
| 13 } | 15 } |
| 14 | 16 |
| 15 void OwnedWidgetGtk::Own(GtkWidget* widget) { | 17 void OwnedWidgetGtk::Own(GtkWidget* widget) { |
| 16 if (!widget) | 18 if (!widget) |
| 17 return; | 19 return; |
| 18 | 20 |
| 19 DCHECK(!widget_); | 21 DCHECK(!widget_); |
| 20 // We want to make sure that Own() was called properly, right after the | 22 // We want to make sure that Own() was called properly, right after the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 | 34 |
| 33 GtkWidget* widget = widget_; | 35 GtkWidget* widget = widget_; |
| 34 widget_ = NULL; | 36 widget_ = NULL; |
| 35 gtk_widget_destroy(widget); | 37 gtk_widget_destroy(widget); |
| 36 | 38 |
| 37 DCHECK(!g_object_is_floating(widget)); | 39 DCHECK(!g_object_is_floating(widget)); |
| 38 // NOTE: Assumes some implementation details about glib internals. | 40 // NOTE: Assumes some implementation details about glib internals. |
| 39 DCHECK_EQ(G_OBJECT(widget)->ref_count, 1U); | 41 DCHECK_EQ(G_OBJECT(widget)->ref_count, 1U); |
| 40 g_object_unref(widget); | 42 g_object_unref(widget); |
| 41 } | 43 } |
| 44 |
| 45 } // namespace ui |
| OLD | NEW |