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 "app/l10n_util.h" | 7 #include "base/i18n/rtl.h" |
8 #include "chrome/browser/gtk/gtk_expanded_container.h" | 8 #include "chrome/browser/gtk/gtk_expanded_container.h" |
9 #include "chrome/browser/gtk/gtk_floating_container.h" | 9 #include "chrome/browser/gtk/gtk_floating_container.h" |
10 #include "chrome/browser/gtk/status_bubble_gtk.h" | 10 #include "chrome/browser/gtk/status_bubble_gtk.h" |
11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
12 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 12 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
13 #include "chrome/common/notification_service.h" | 13 #include "chrome/common/notification_service.h" |
14 #include "gfx/native_widget_types.h" | 14 #include "gfx/native_widget_types.h" |
15 | 15 |
16 TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble) | 16 TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble) |
17 : tab_contents_(NULL), | 17 : tab_contents_(NULL), |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void TabContentsContainerGtk::OnSetFloatingPosition( | 160 void TabContentsContainerGtk::OnSetFloatingPosition( |
161 GtkFloatingContainer* floating_container, GtkAllocation* allocation, | 161 GtkFloatingContainer* floating_container, GtkAllocation* allocation, |
162 TabContentsContainerGtk* tab_contents_container) { | 162 TabContentsContainerGtk* tab_contents_container) { |
163 StatusBubbleGtk* status = tab_contents_container->status_bubble_; | 163 StatusBubbleGtk* status = tab_contents_container->status_bubble_; |
164 | 164 |
165 // Look at the size request of the status bubble and tell the | 165 // Look at the size request of the status bubble and tell the |
166 // GtkFloatingContainer where we want it positioned. | 166 // GtkFloatingContainer where we want it positioned. |
167 GtkRequisition requisition; | 167 GtkRequisition requisition; |
168 gtk_widget_size_request(status->widget(), &requisition); | 168 gtk_widget_size_request(status->widget(), &requisition); |
169 | 169 |
170 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); | 170 bool ltr = !base::i18n::IsRTL(); |
171 | 171 |
172 GValue value = { 0, }; | 172 GValue value = { 0, }; |
173 g_value_init(&value, G_TYPE_INT); | 173 g_value_init(&value, G_TYPE_INT); |
174 if (ltr ^ status->flip_horizontally()) // Is it on the left? | 174 if (ltr ^ status->flip_horizontally()) // Is it on the left? |
175 g_value_set_int(&value, 0); | 175 g_value_set_int(&value, 0); |
176 else | 176 else |
177 g_value_set_int(&value, allocation->width - requisition.width); | 177 g_value_set_int(&value, allocation->width - requisition.width); |
178 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 178 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
179 status->widget(), "x", &value); | 179 status->widget(), "x", &value); |
180 | 180 |
181 int child_y = std::max( | 181 int child_y = std::max( |
182 allocation->y + allocation->height - requisition.height, 0); | 182 allocation->y + allocation->height - requisition.height, 0); |
183 g_value_set_int(&value, child_y + status->y_offset()); | 183 g_value_set_int(&value, child_y + status->y_offset()); |
184 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 184 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
185 status->widget(), "y", &value); | 185 status->widget(), "y", &value); |
186 g_value_unset(&value); | 186 g_value_unset(&value); |
187 } | 187 } |
OLD | NEW |