Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: chrome/browser/gtk/tab_contents_container_gtk.cc

Issue 147163: GTK: Another attempt at fixing gtk_floating_container_forall() crasher. (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/gtk/tab_contents_container_gtk.h" 5 #include "chrome/browser/gtk/tab_contents_container_gtk.h"
6 6
7 #include "base/gfx/native_widget_types.h" 7 #include "base/gfx/native_widget_types.h"
8 #include "chrome/browser/gtk/gtk_floating_container.h" 8 #include "chrome/browser/gtk/gtk_floating_container.h"
9 #include "chrome/browser/gtk/status_bubble_gtk.h" 9 #include "chrome/browser/gtk/status_bubble_gtk.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 16 matching lines...) Expand all
27 27
28 } // namespace 28 } // namespace
29 29
30 TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble) 30 TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble)
31 : tab_contents_(NULL), 31 : tab_contents_(NULL),
32 status_bubble_(status_bubble) { 32 status_bubble_(status_bubble) {
33 Init(); 33 Init();
34 } 34 }
35 35
36 TabContentsContainerGtk::~TabContentsContainerGtk() { 36 TabContentsContainerGtk::~TabContentsContainerGtk() {
37 floating_.Destroy();
37 } 38 }
38 39
39 void TabContentsContainerGtk::Init() { 40 void TabContentsContainerGtk::Init() {
40 // A high level overview of the TabContentsContainer: 41 // A high level overview of the TabContentsContainer:
41 // 42 //
42 // +- GtkFloatingContainer |floating_| -------------------------------+ 43 // +- GtkFloatingContainer |floating_| -------------------------------+
43 // |+- GtkFixedContainer |fixed_| -----------------------------------+| 44 // |+- GtkFixedContainer |fixed_| -----------------------------------+|
44 // || || 45 // || ||
45 // || || 46 // || ||
46 // || || 47 // || ||
47 // || || 48 // || ||
48 // |+- (StatusBubble) ------+ +- (Popups) ------------+| 49 // |+- (StatusBubble) ------+ ||
49 // |+ +----------------+ || 50 // |+ + ||
50 // |+-----------------------+ +-----------------------+| 51 // |+-----------------------+----------------------------------------+|
51 // +------------------------------------------------------------------+ 52 // +------------------------------------------------------------------+
52 53
53 floating_ = gtk_floating_container_new(); 54 floating_.Own(gtk_floating_container_new());
54 55
55 fixed_ = gtk_fixed_new(); 56 fixed_ = gtk_fixed_new();
56 g_signal_connect(fixed_, "size-allocate", 57 g_signal_connect(fixed_, "size-allocate",
57 G_CALLBACK(OnFixedSizeAllocate), this); 58 G_CALLBACK(OnFixedSizeAllocate), this);
58 gtk_container_add(GTK_CONTAINER(floating_), fixed_); 59 gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_);
59 60
60 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_), 61 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
61 status_bubble_->widget()); 62 status_bubble_->widget());
62 g_signal_connect(floating_, "set-floating-position", 63 g_signal_connect(floating_.get(), "set-floating-position",
63 G_CALLBACK(OnSetFloatingPosition), this); 64 G_CALLBACK(OnSetFloatingPosition), this);
64 65
65 gtk_widget_show(fixed_); 66 gtk_widget_show(fixed_);
66 gtk_widget_show(floating_); 67 gtk_widget_show(floating_.get());
67 } 68 }
68 69
69 void TabContentsContainerGtk::AddContainerToBox(GtkWidget* box) { 70 void TabContentsContainerGtk::AddContainerToBox(GtkWidget* box) {
70 gtk_box_pack_start(GTK_BOX(box), floating_, TRUE, TRUE, 0); 71 gtk_box_pack_start(GTK_BOX(box), floating_.get(), TRUE, TRUE, 0);
71 } 72 }
72 73
73 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { 74 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
74 if (tab_contents_) { 75 if (tab_contents_) {
75 gfx::NativeView widget = tab_contents_->GetNativeView(); 76 gfx::NativeView widget = tab_contents_->GetNativeView();
76 if (widget) 77 if (widget)
77 gtk_widget_hide(widget); 78 gtk_widget_hide(widget);
78 79
79 tab_contents_->WasHidden(); 80 tab_contents_->WasHidden();
80 81
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 gtk_container_child_set_property(GTK_CONTAINER(floating_container), 185 gtk_container_child_set_property(GTK_CONTAINER(floating_container),
185 widget, "x", &value); 186 widget, "x", &value);
186 187
187 int child_y = std::max( 188 int child_y = std::max(
188 allocation->y + allocation->height - requisition.height, 0); 189 allocation->y + allocation->height - requisition.height, 0);
189 g_value_set_int(&value, child_y); 190 g_value_set_int(&value, child_y);
190 gtk_container_child_set_property(GTK_CONTAINER(floating_container), 191 gtk_container_child_set_property(GTK_CONTAINER(floating_container),
191 widget, "y", &value); 192 widget, "y", &value);
192 g_value_unset(&value); 193 g_value_unset(&value);
193 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698