| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <X11/XF86keysym.h> | 9 #include <X11/XF86keysym.h> |
| 10 | 10 |
| 11 #include "app/gtk_dnd_util.h" | 11 #include "app/gtk_dnd_util.h" |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/menus/accelerator_gtk.h" | 13 #include "app/menus/accelerator_gtk.h" |
| 14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
| 15 #include "base/base_paths.h" | 15 #include "base/base_paths.h" |
| 16 #include "base/i18n/rtl.h" |
| 16 #include "base/keyboard_codes_posix.h" | 17 #include "base/keyboard_codes_posix.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/singleton.h" | 20 #include "base/singleton.h" |
| 20 #include "chrome/app/chrome_dll_resource.h" | 21 #include "chrome/app/chrome_dll_resource.h" |
| 21 #include "chrome/browser/browser.h" | 22 #include "chrome/browser/browser.h" |
| 22 #include "chrome/browser/browser_theme_provider.h" | 23 #include "chrome/browser/browser_theme_provider.h" |
| 23 #include "chrome/browser/encoding_menu_controller.h" | 24 #include "chrome/browser/encoding_menu_controller.h" |
| 24 #include "chrome/browser/gtk/accelerators_gtk.h" | 25 #include "chrome/browser/gtk/accelerators_gtk.h" |
| 25 #include "chrome/browser/gtk/back_forward_button_gtk.h" | 26 #include "chrome/browser/gtk/back_forward_button_gtk.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 443 |
| 443 gfx::Rect BrowserToolbarGtk::GetLocationStackBounds() const { | 444 gfx::Rect BrowserToolbarGtk::GetLocationStackBounds() const { |
| 444 // The number of pixels from the left or right edges of the location stack to | 445 // The number of pixels from the left or right edges of the location stack to |
| 445 // "just inside the visible borders". When the omnibox bubble contents are | 446 // "just inside the visible borders". When the omnibox bubble contents are |
| 446 // aligned with this, the visible borders tacked on to the outsides will line | 447 // aligned with this, the visible borders tacked on to the outsides will line |
| 447 // up with the visible borders on the location stack. | 448 // up with the visible borders on the location stack. |
| 448 const int kLocationStackEdgeWidth = 1; | 449 const int kLocationStackEdgeWidth = 1; |
| 449 | 450 |
| 450 GtkWidget* left; | 451 GtkWidget* left; |
| 451 GtkWidget* right; | 452 GtkWidget* right; |
| 452 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { | 453 if (base::i18n::IsRTL()) { |
| 453 left = go_->widget(); | 454 left = go_->widget(); |
| 454 right = star_->widget(); | 455 right = star_->widget(); |
| 455 } else { | 456 } else { |
| 456 left = star_->widget(); | 457 left = star_->widget(); |
| 457 right = go_->widget(); | 458 right = go_->widget(); |
| 458 } | 459 } |
| 459 | 460 |
| 460 gint origin_x, origin_y; | 461 gint origin_x, origin_y; |
| 461 DCHECK_EQ(left->window, right->window); | 462 DCHECK_EQ(left->window, right->window); |
| 462 gdk_window_get_origin(left->window, &origin_x, &origin_y); | 463 gdk_window_get_origin(left->window, &origin_x, &origin_y); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 menu->PopupAsFromKeyEvent(button); | 720 menu->PopupAsFromKeyEvent(button); |
| 720 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); | 721 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); |
| 721 } | 722 } |
| 722 | 723 |
| 723 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, | 724 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, |
| 724 GtkMenuDirectionType dir) { | 725 GtkMenuDirectionType dir) { |
| 725 GtkWidget* other_button = button == page_menu_button_.get() ? | 726 GtkWidget* other_button = button == page_menu_button_.get() ? |
| 726 app_menu_button_.get() : page_menu_button_.get(); | 727 app_menu_button_.get() : page_menu_button_.get(); |
| 727 PopupForButton(other_button); | 728 PopupForButton(other_button); |
| 728 } | 729 } |
| OLD | NEW |