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 |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (theme_provider_->UseGtkTheme()) { | 692 if (theme_provider_->UseGtkTheme()) { |
693 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), | 693 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), |
694 location_hbox, &e->area, | 694 location_hbox, &e->area, |
695 &location_hbox->allocation); | 695 &location_hbox->allocation); |
696 } | 696 } |
697 | 697 |
698 return FALSE; | 698 return FALSE; |
699 } | 699 } |
700 | 700 |
701 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { | 701 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { |
702 if ((button == back_->widget()) || | 702 if ((button == back_->widget()) || (button == forward_->widget())) { |
703 (button == forward_->widget())) { | 703 if (gtk_util::DispositionForCurrentButtonPressEvent() == CURRENT_TAB) |
704 location_bar_->Revert(); | 704 location_bar_->Revert(); |
705 return; | 705 return; |
706 } | 706 } |
707 | 707 |
708 int tag = -1; | 708 int command = -1; |
| 709 GdkModifierType modifier_state; |
| 710 gtk_get_current_event_state(&modifier_state); |
| 711 guint modifier_state_uint = modifier_state; |
709 if (button == reload_->widget()) { | 712 if (button == reload_->widget()) { |
710 GdkModifierType modifier_state; | 713 if (modifier_state_uint & GDK_SHIFT_MASK) { |
711 if (gtk_get_current_event_state(&modifier_state) && | 714 command = IDC_RELOAD_IGNORING_CACHE; |
712 modifier_state & GDK_SHIFT_MASK) { | 715 // Mask off shift so it isn't interpreted as affecting the disposition |
713 tag = IDC_RELOAD_IGNORING_CACHE; | 716 // below. |
| 717 modifier_state_uint &= ~GDK_SHIFT_MASK; |
714 } else { | 718 } else { |
715 tag = IDC_RELOAD; | 719 command = IDC_RELOAD; |
716 } | 720 } |
717 location_bar_->Revert(); | 721 if (event_utils::DispositionFromEventFlags(modifier_state_uint) == |
| 722 CURRENT_TAB) |
| 723 location_bar_->Revert(); |
718 } else if (home_.get() && button == home_->widget()) { | 724 } else if (home_.get() && button == home_->widget()) { |
719 tag = IDC_HOME; | 725 command = IDC_HOME; |
720 } | 726 } |
721 | 727 |
722 DCHECK_NE(tag, -1) << "Unexpected button click callback"; | 728 DCHECK_NE(command, -1) << "Unexpected button click callback"; |
723 browser_->ExecuteCommandWithDisposition(tag, | 729 browser_->ExecuteCommandWithDisposition(command, |
724 gtk_util::DispositionForCurrentButtonPressEvent()); | 730 event_utils::DispositionFromEventFlags(modifier_state_uint)); |
725 } | 731 } |
726 | 732 |
727 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, | 733 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, |
728 GdkEventButton* event) { | 734 GdkEventButton* event) { |
729 if (event->button != 1) | 735 if (event->button != 1) |
730 return FALSE; | 736 return FALSE; |
731 | 737 |
732 gtk_chrome_button_set_paint_state(GTK_CHROME_BUTTON(button), | 738 gtk_chrome_button_set_paint_state(GTK_CHROME_BUTTON(button), |
733 GTK_STATE_ACTIVE); | 739 GTK_STATE_ACTIVE); |
734 MenuGtk* menu = button == page_menu_button_.get() ? | 740 MenuGtk* menu = button == page_menu_button_.get() ? |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 int x_offset = base::i18n::IsRTL() ? | 850 int x_offset = base::i18n::IsRTL() ? |
845 sender->allocation.width - kUpgradeDotOffset - badge.width() : | 851 sender->allocation.width - kUpgradeDotOffset - badge.width() : |
846 kUpgradeDotOffset; | 852 kUpgradeDotOffset; |
847 canvas.DrawBitmapInt( | 853 canvas.DrawBitmapInt( |
848 badge, | 854 badge, |
849 sender->allocation.x + x_offset, | 855 sender->allocation.x + x_offset, |
850 sender->allocation.y + sender->allocation.height - badge.height()); | 856 sender->allocation.y + sender->allocation.height - badge.height()); |
851 | 857 |
852 return FALSE; | 858 return FALSE; |
853 } | 859 } |
OLD | NEW |