| 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/back_forward_button_gtk.h" | 5 #include "chrome/browser/gtk/back_forward_button_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 active = IDR_BACK_P; | 34 active = IDR_BACK_P; |
| 35 highlight = IDR_BACK_H; | 35 highlight = IDR_BACK_H; |
| 36 depressed = IDR_BACK_D; | 36 depressed = IDR_BACK_D; |
| 37 tooltip = IDS_TOOLTIP_BACK; | 37 tooltip = IDS_TOOLTIP_BACK; |
| 38 } | 38 } |
| 39 button_.reset(new CustomDrawButton(normal, active, highlight, depressed)); | 39 button_.reset(new CustomDrawButton(normal, active, highlight, depressed)); |
| 40 gtk_widget_set_tooltip_text(widget(), | 40 gtk_widget_set_tooltip_text(widget(), |
| 41 l10n_util::GetStringUTF8(tooltip).c_str()); | 41 l10n_util::GetStringUTF8(tooltip).c_str()); |
| 42 menu_model_.reset(new BackForwardMenuModelGtk(browser, | 42 menu_model_.reset(new BackForwardMenuModelGtk(browser, |
| 43 is_forward ? | 43 is_forward ? |
| 44 BackForwardMenuModel::FORWARD_MENU_DELEGATE : | 44 BackForwardMenuModel::FORWARD_MENU : |
| 45 BackForwardMenuModel::BACKWARD_MENU_DELEGATE, | 45 BackForwardMenuModel::BACKWARD_MENU, |
| 46 this)); | 46 this)); |
| 47 | 47 |
| 48 g_signal_connect(widget(), "clicked", | 48 g_signal_connect(widget(), "clicked", |
| 49 G_CALLBACK(OnClick), this); | 49 G_CALLBACK(OnClick), this); |
| 50 g_signal_connect(widget(), "button-press-event", | 50 g_signal_connect(widget(), "button-press-event", |
| 51 G_CALLBACK(OnButtonPress), this); | 51 G_CALLBACK(OnButtonPress), this); |
| 52 gtk_widget_add_events(widget(), GDK_POINTER_MOTION_MASK); | 52 gtk_widget_add_events(widget(), GDK_POINTER_MOTION_MASK); |
| 53 g_signal_connect(widget(), "motion-notify-event", | 53 g_signal_connect(widget(), "motion-notify-event", |
| 54 G_CALLBACK(OnMouseMove), this); | 54 G_CALLBACK(OnMouseMove), this); |
| 55 | 55 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int drag_min_distance; | 113 int drag_min_distance; |
| 114 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); | 114 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); |
| 115 if (event->y - button->y_position_of_last_press_ < drag_min_distance) | 115 if (event->y - button->y_position_of_last_press_ < drag_min_distance) |
| 116 return FALSE; | 116 return FALSE; |
| 117 | 117 |
| 118 // We will show the menu now. Cancel the delayed event. | 118 // We will show the menu now. Cancel the delayed event. |
| 119 button->show_menu_factory_.RevokeAll(); | 119 button->show_menu_factory_.RevokeAll(); |
| 120 button->ShowBackForwardMenu(); | 120 button->ShowBackForwardMenu(); |
| 121 return FALSE; | 121 return FALSE; |
| 122 } | 122 } |
| OLD | NEW |