| OLD | NEW |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // |+-----------------------+----------------------------------------+| | 51 // |+-----------------------+----------------------------------------+| |
| 52 // +------------------------------------------------------------------+ | 52 // +------------------------------------------------------------------+ |
| 53 | 53 |
| 54 floating_.Own(gtk_floating_container_new()); | 54 floating_.Own(gtk_floating_container_new()); |
| 55 | 55 |
| 56 fixed_ = gtk_fixed_new(); | 56 fixed_ = gtk_fixed_new(); |
| 57 g_signal_connect(fixed_, "size-allocate", | 57 g_signal_connect(fixed_, "size-allocate", |
| 58 G_CALLBACK(OnFixedSizeAllocate), this); | 58 G_CALLBACK(OnFixedSizeAllocate), this); |
| 59 gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_); | 59 gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_); |
| 60 | 60 |
| 61 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()), | 61 if (status_bubble_) { |
| 62 status_bubble_->widget()); | 62 gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()), |
| 63 g_signal_connect(floating_.get(), "set-floating-position", | 63 status_bubble_->widget()); |
| 64 G_CALLBACK(OnSetFloatingPosition), this); | 64 g_signal_connect(floating_.get(), "set-floating-position", |
| 65 G_CALLBACK(OnSetFloatingPosition), this); |
| 66 } |
| 65 | 67 |
| 66 gtk_widget_show(fixed_); | 68 gtk_widget_show(fixed_); |
| 67 gtk_widget_show(floating_.get()); | 69 gtk_widget_show(floating_.get()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 void TabContentsContainerGtk::AddContainerToBox(GtkWidget* box) { | |
| 71 gtk_box_pack_start(GTK_BOX(box), floating_.get(), TRUE, TRUE, 0); | |
| 72 } | |
| 73 | |
| 74 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { | 72 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { |
| 75 if (tab_contents_) { | 73 if (tab_contents_) { |
| 76 gfx::NativeView widget = tab_contents_->GetNativeView(); | 74 gfx::NativeView widget = tab_contents_->GetNativeView(); |
| 77 if (widget) | 75 if (widget) |
| 78 gtk_widget_hide(widget); | 76 gtk_widget_hide(widget); |
| 79 | 77 |
| 80 tab_contents_->WasHidden(); | 78 tab_contents_->WasHidden(); |
| 81 | 79 |
| 82 registrar_.Remove(this, NotificationType::RENDER_VIEW_HOST_CHANGED, | 80 registrar_.Remove(this, NotificationType::RENDER_VIEW_HOST_CHANGED, |
| 83 Source<NavigationController>(&tab_contents_->controller())); | 81 Source<NavigationController>(&tab_contents_->controller())); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 183 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 186 widget, "x", &value); | 184 widget, "x", &value); |
| 187 | 185 |
| 188 int child_y = std::max( | 186 int child_y = std::max( |
| 189 allocation->y + allocation->height - requisition.height, 0); | 187 allocation->y + allocation->height - requisition.height, 0); |
| 190 g_value_set_int(&value, child_y); | 188 g_value_set_int(&value, child_y); |
| 191 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 189 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 192 widget, "y", &value); | 190 widget, "y", &value); |
| 193 g_value_unset(&value); | 191 g_value_unset(&value); |
| 194 } | 192 } |
| OLD | NEW |