| 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/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 g_signal_connect(expanded_, "size-allocate", | 92 g_signal_connect(expanded_, "size-allocate", |
| 93 G_CALLBACK(OnSizeAllocateThunk), this); | 93 G_CALLBACK(OnSizeAllocateThunk), this); |
| 94 g_signal_connect(expanded_, "child-size-request", | 94 g_signal_connect(expanded_, "child-size-request", |
| 95 G_CALLBACK(OnChildSizeRequestThunk), this); | 95 G_CALLBACK(OnChildSizeRequestThunk), this); |
| 96 g_signal_connect(floating_.get(), "set-floating-position", | 96 g_signal_connect(floating_.get(), "set-floating-position", |
| 97 G_CALLBACK(OnSetFloatingPositionThunk), this); | 97 G_CALLBACK(OnSetFloatingPositionThunk), this); |
| 98 | 98 |
| 99 gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_); | 99 gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_); |
| 100 gtk_widget_show(expanded_); | 100 gtk_widget_show(expanded_); |
| 101 gtk_widget_show(floating_.get()); | 101 gtk_widget_show(floating_.get()); |
| 102 registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, | 102 registrar_.Add(this, chrome::TAB_CONTENTS_CONNECTED, |
| 103 Source<TabContents>(tab_contents)); | 103 Source<TabContents>(tab_contents)); |
| 104 drag_source_.reset(new TabContentsDragSource(this)); | 104 drag_source_.reset(new TabContentsDragSource(this)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 TabContentsViewGtk::~TabContentsViewGtk() { | 107 TabContentsViewGtk::~TabContentsViewGtk() { |
| 108 floating_.Destroy(); | 108 floating_.Destroy(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void TabContentsViewGtk::AttachConstrainedWindow( | 111 void TabContentsViewGtk::AttachConstrainedWindow( |
| 112 ConstrainedWindowGtk* constrained_window) { | 112 ConstrainedWindowGtk* constrained_window) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (!tab_contents()->delegate()->TakeFocus(reverse)) { | 279 if (!tab_contents()->delegate()->TakeFocus(reverse)) { |
| 280 gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()), | 280 gtk_widget_child_focus(GTK_WIDGET(GetTopLevelNativeWindow()), |
| 281 reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD); | 281 reverse ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 void TabContentsViewGtk::Observe(NotificationType type, | 285 void TabContentsViewGtk::Observe(NotificationType type, |
| 286 const NotificationSource& source, | 286 const NotificationSource& source, |
| 287 const NotificationDetails& details) { | 287 const NotificationDetails& details) { |
| 288 switch (type.value) { | 288 switch (type.value) { |
| 289 case NotificationType::TAB_CONTENTS_CONNECTED: { | 289 case chrome::TAB_CONTENTS_CONNECTED: { |
| 290 // No need to remove the SadTabGtk's widget from the container since | 290 // No need to remove the SadTabGtk's widget from the container since |
| 291 // the new RenderWidgetHostViewGtk instance already removed all the | 291 // the new RenderWidgetHostViewGtk instance already removed all the |
| 292 // vbox's children. | 292 // vbox's children. |
| 293 sad_tab_.reset(); | 293 sad_tab_.reset(); |
| 294 break; | 294 break; |
| 295 } | 295 } |
| 296 default: | 296 default: |
| 297 NOTREACHED() << "Got a notification we didn't register for."; | 297 NOTREACHED() << "Got a notification we didn't register for."; |
| 298 break; | 298 break; |
| 299 } | 299 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 g_value_set_int(&value, child_x); | 447 g_value_set_int(&value, child_x); |
| 448 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 448 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 449 widget, "x", &value); | 449 widget, "x", &value); |
| 450 | 450 |
| 451 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 451 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
| 452 g_value_set_int(&value, child_y); | 452 g_value_set_int(&value, child_y); |
| 453 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 453 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 454 widget, "y", &value); | 454 widget, "y", &value); |
| 455 g_value_unset(&value); | 455 g_value_unset(&value); |
| 456 } | 456 } |
| OLD | NEW |