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

Side by Side Diff: chrome/browser/ui/gtk/back_forward_button_gtk.cc

Issue 10546116: gtk: Extract event functions into event_utils module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
OLDNEW
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/gtk/event_utils.h"
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
15 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
16 #include "chrome/browser/ui/gtk/menu_gtk.h" 17 #include "chrome/browser/ui/gtk/menu_gtk.h"
17 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" 18 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
20 #include "grit/theme_resources_standard.h" 21 #include "grit/theme_resources_standard.h"
21 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
22 23
23 // 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.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 menu_.reset(new MenuGtk(this, menu_model_.get())); 85 menu_.reset(new MenuGtk(this, menu_model_.get()));
85 button_->SetPaintOverride(GTK_STATE_ACTIVE); 86 button_->SetPaintOverride(GTK_STATE_ACTIVE);
86 menu_->PopupForWidget(widget(), button, event_time); 87 menu_->PopupForWidget(widget(), button, event_time);
87 } 88 }
88 89
89 void BackForwardButtonGtk::OnClick(GtkWidget* widget) { 90 void BackForwardButtonGtk::OnClick(GtkWidget* widget) {
90 weak_factory_.InvalidateWeakPtrs(); 91 weak_factory_.InvalidateWeakPtrs();
91 92
92 browser_->ExecuteCommandWithDisposition( 93 browser_->ExecuteCommandWithDisposition(
93 is_forward_ ? IDC_FORWARD : IDC_BACK, 94 is_forward_ ? IDC_FORWARD : IDC_BACK,
94 gtk_util::DispositionForCurrentButtonPressEvent()); 95 event_utils::DispositionForCurrentButtonPressEvent());
95 } 96 }
96 97
97 gboolean BackForwardButtonGtk::OnButtonPress(GtkWidget* widget, 98 gboolean BackForwardButtonGtk::OnButtonPress(GtkWidget* widget,
98 GdkEventButton* event) { 99 GdkEventButton* event) {
99 if (event->button == 3) 100 if (event->button == 3)
100 ShowBackForwardMenu(event->button, event->time); 101 ShowBackForwardMenu(event->button, event->time);
101 102
102 if (event->button != 1) 103 if (event->button != 1)
103 return FALSE; 104 return FALSE;
104 105
(...skipping 19 matching lines...) Expand all
124 int drag_min_distance; 125 int drag_min_distance;
125 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); 126 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL);
126 if (event->y - y_position_of_last_press_ < drag_min_distance) 127 if (event->y - y_position_of_last_press_ < drag_min_distance)
127 return FALSE; 128 return FALSE;
128 129
129 // We will show the menu now. Cancel the delayed event. 130 // We will show the menu now. Cancel the delayed event.
130 weak_factory_.InvalidateWeakPtrs(); 131 weak_factory_.InvalidateWeakPtrs();
131 ShowBackForwardMenu(/* button */ 1, event->time); 132 ShowBackForwardMenu(/* button */ 1, event->time);
132 return FALSE; 133 return FALSE;
133 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698