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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/rounded_window.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.cc » ('j') | 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/status_bubble_gtk.h" 5 #include "chrome/browser/gtk/status_bubble_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "app/l10n_util.h"
12 #include "app/text_elider.h" 11 #include "app/text_elider.h"
12 #include "base/i18n/rtl.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/gtk/gtk_theme_provider.h" 15 #include "chrome/browser/gtk/gtk_theme_provider.h"
16 #include "chrome/browser/gtk/gtk_util.h" 16 #include "chrome/browser/gtk/gtk_util.h"
17 #include "chrome/browser/gtk/rounded_window.h" 17 #include "chrome/browser/gtk/rounded_window.h"
18 #include "chrome/browser/gtk/slide_animator_gtk.h" 18 #include "chrome/browser/gtk/slide_animator_gtk.h"
19 #include "chrome/common/notification_service.h" 19 #include "chrome/common/notification_service.h"
20 #include "gfx/gtk_util.h" 20 #include "gfx/gtk_util.h"
21 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 22
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool old_flip_horizontally = flip_horizontally_; 150 bool old_flip_horizontally = flip_horizontally_;
151 151
152 if (left_content) { 152 if (left_content) {
153 SetFlipHorizontally(false); 153 SetFlipHorizontally(false);
154 y_offset_ = 0; 154 y_offset_ = 0;
155 } else { 155 } else {
156 GtkWidget* toplevel = gtk_widget_get_toplevel(container_.get()); 156 GtkWidget* toplevel = gtk_widget_get_toplevel(container_.get());
157 if (!toplevel || !GTK_WIDGET_REALIZED(toplevel)) 157 if (!toplevel || !GTK_WIDGET_REALIZED(toplevel))
158 return; 158 return;
159 159
160 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); 160 bool ltr = !base::i18n::IsRTL();
161 161
162 GtkRequisition requisition; 162 GtkRequisition requisition;
163 gtk_widget_size_request(container_.get(), &requisition); 163 gtk_widget_size_request(container_.get(), &requisition);
164 164
165 // Get our base position (that is, not including the current offset) 165 // Get our base position (that is, not including the current offset)
166 // relative to the origin of the root window. 166 // relative to the origin of the root window.
167 gint toplevel_x = 0, toplevel_y = 0; 167 gint toplevel_x = 0, toplevel_y = 0;
168 gdk_window_get_position(toplevel->window, &toplevel_x, &toplevel_y); 168 gdk_window_get_position(toplevel->window, &toplevel_x, &toplevel_y);
169 gfx::Rect parent_rect = 169 gfx::Rect parent_rect =
170 gtk_util::GetWidgetRectRelativeToToplevel(parent); 170 gtk_util::GetWidgetRectRelativeToToplevel(parent);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 void StatusBubbleGtk::Observe(NotificationType type, 213 void StatusBubbleGtk::Observe(NotificationType type,
214 const NotificationSource& source, 214 const NotificationSource& source,
215 const NotificationDetails& details) { 215 const NotificationDetails& details) {
216 if (type == NotificationType::BROWSER_THEME_CHANGED) { 216 if (type == NotificationType::BROWSER_THEME_CHANGED) {
217 UserChangedTheme(); 217 UserChangedTheme();
218 } 218 }
219 } 219 }
220 220
221 void StatusBubbleGtk::InitWidgets() { 221 void StatusBubbleGtk::InitWidgets() {
222 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); 222 bool ltr = !base::i18n::IsRTL();
223 223
224 label_ = gtk_label_new(NULL); 224 label_ = gtk_label_new(NULL);
225 225
226 padding_ = gtk_alignment_new(0, 0, 1, 1); 226 padding_ = gtk_alignment_new(0, 0, 1, 1);
227 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_), 227 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_),
228 kInternalTopBottomPadding, kInternalTopBottomPadding, 228 kInternalTopBottomPadding, kInternalTopBottomPadding,
229 kInternalLeftRightPadding + (ltr ? 0 : kCornerSize), 229 kInternalLeftRightPadding + (ltr ? 0 : kCornerSize),
230 kInternalLeftRightPadding + (ltr ? kCornerSize : 0)); 230 kInternalLeftRightPadding + (ltr ? kCornerSize : 0));
231 gtk_container_add(GTK_CONTAINER(padding_), label_); 231 gtk_container_add(GTK_CONTAINER(padding_), label_);
232 232
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 gtk_util::SetRoundedWindowBorderColor(container_.get(), 268 gtk_util::SetRoundedWindowBorderColor(container_.get(),
269 theme_provider_->GetBorderColor()); 269 theme_provider_->GetBorderColor());
270 } 270 }
271 271
272 void StatusBubbleGtk::SetFlipHorizontally(bool flip_horizontally) { 272 void StatusBubbleGtk::SetFlipHorizontally(bool flip_horizontally) {
273 if (flip_horizontally == flip_horizontally_) 273 if (flip_horizontally == flip_horizontally_)
274 return; 274 return;
275 275
276 flip_horizontally_ = flip_horizontally; 276 flip_horizontally_ = flip_horizontally;
277 277
278 bool ltr = (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT); 278 bool ltr = !base::i18n::IsRTL();
279 bool on_left = (ltr && !flip_horizontally) || (!ltr && flip_horizontally); 279 bool on_left = (ltr && !flip_horizontally) || (!ltr && flip_horizontally);
280 280
281 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_), 281 gtk_alignment_set_padding(GTK_ALIGNMENT(padding_),
282 kInternalTopBottomPadding, kInternalTopBottomPadding, 282 kInternalTopBottomPadding, kInternalTopBottomPadding,
283 kInternalLeftRightPadding + (on_left ? 0 : kCornerSize), 283 kInternalLeftRightPadding + (on_left ? 0 : kCornerSize),
284 kInternalLeftRightPadding + (on_left ? kCornerSize : 0)); 284 kInternalLeftRightPadding + (on_left ? kCornerSize : 0));
285 // The rounded window code flips these arguments if we're RTL. 285 // The rounded window code flips these arguments if we're RTL.
286 gtk_util::SetRoundedWindowEdgesAndBorders( 286 gtk_util::SetRoundedWindowEdgesAndBorders(
287 container_.get(), 287 container_.get(),
288 kCornerSize, 288 kCornerSize,
289 flip_horizontally ? 289 flip_horizontally ?
290 gtk_util::ROUNDED_TOP_LEFT : 290 gtk_util::ROUNDED_TOP_LEFT :
291 gtk_util::ROUNDED_TOP_RIGHT, 291 gtk_util::ROUNDED_TOP_RIGHT,
292 gtk_util::BORDER_TOP | 292 gtk_util::BORDER_TOP |
293 (flip_horizontally ? gtk_util::BORDER_LEFT : gtk_util::BORDER_RIGHT)); 293 (flip_horizontally ? gtk_util::BORDER_LEFT : gtk_util::BORDER_RIGHT));
294 gtk_widget_queue_draw(container_.get()); 294 gtk_widget_queue_draw(container_.get());
295 } 295 }
296 296
297 gboolean StatusBubbleGtk::HandleMotionNotify(GdkEventMotion* event) { 297 gboolean StatusBubbleGtk::HandleMotionNotify(GdkEventMotion* event) {
298 MouseMoved(gfx::Point(event->x_root, event->y_root), false); 298 MouseMoved(gfx::Point(event->x_root, event->y_root), false);
299 return FALSE; 299 return FALSE;
300 } 300 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/rounded_window.cc ('k') | chrome/browser/gtk/tab_contents_container_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698