OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/back_forward_button_gtk.h" | 5 #include "chrome/browser/ui/gtk/back_forward_button_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
15 #include "chrome/browser/ui/gtk/event_utils.h" | 15 #include "chrome/browser/ui/gtk/event_utils.h" |
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
18 #include "chrome/browser/ui/gtk/menu_gtk.h" | 18 #include "chrome/browser/ui/gtk/menu_gtk.h" |
19 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 19 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
22 #include "grit/theme_resources_standard.h" | |
23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
24 | 23 |
25 // The time in milliseconds between when the user clicks and the menu appears. | 24 // The time in milliseconds between when the user clicks and the menu appears. |
26 static const int kMenuTimerDelay = 500; | 25 static const int kMenuTimerDelay = 500; |
27 | 26 |
28 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward) | 27 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward) |
29 : browser_(browser), | 28 : browser_(browser), |
30 is_forward_(is_forward), | 29 is_forward_(is_forward), |
31 weak_factory_(this) { | 30 weak_factory_(this) { |
32 int normal, pushed, hover, disabled, tooltip; | 31 int normal, pushed, hover, disabled, tooltip; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 int drag_min_distance; | 126 int drag_min_distance; |
128 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); | 127 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); |
129 if (event->y - y_position_of_last_press_ < drag_min_distance) | 128 if (event->y - y_position_of_last_press_ < drag_min_distance) |
130 return FALSE; | 129 return FALSE; |
131 | 130 |
132 // We will show the menu now. Cancel the delayed event. | 131 // We will show the menu now. Cancel the delayed event. |
133 weak_factory_.InvalidateWeakPtrs(); | 132 weak_factory_.InvalidateWeakPtrs(); |
134 ShowBackForwardMenu(/* button */ 1, event->time); | 133 ShowBackForwardMenu(/* button */ 1, event->time); |
135 return FALSE; | 134 return FALSE; |
136 } | 135 } |
OLD | NEW |