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

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

Issue 2847079: Remove support for background masks. These are no longer necessary in the ne... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 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/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 "app/menus/menu_model.h" 10 #include "app/menus/menu_model.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "chrome/app/chrome_dll_resource.h" 12 #include "chrome/app/chrome_dll_resource.h"
13 #include "chrome/browser/back_forward_menu_model.h" 13 #include "chrome/browser/back_forward_menu_model.h"
14 #include "chrome/browser/browser.h" 14 #include "chrome/browser/browser.h"
15 #include "chrome/browser/gtk/gtk_theme_provider.h" 15 #include "chrome/browser/gtk/gtk_theme_provider.h"
16 #include "chrome/browser/gtk/gtk_util.h" 16 #include "chrome/browser/gtk/gtk_util.h"
17 #include "chrome/browser/gtk/menu_gtk.h" 17 #include "chrome/browser/gtk/menu_gtk.h"
18 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
21 21
22 // The time in milliseconds between when the user clicks and the menu appears. 22 // The time in milliseconds between when the user clicks and the menu appears.
23 static const int kMenuTimerDelay = 500; 23 static const int kMenuTimerDelay = 500;
24 24
25 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward) 25 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward)
26 : browser_(browser), 26 : browser_(browser),
27 is_forward_(is_forward), 27 is_forward_(is_forward),
28 show_menu_factory_(this) { 28 show_menu_factory_(this) {
29 int normal, pushed, hover, disabled, background, tooltip; 29 int normal, pushed, hover, disabled, tooltip;
30 const char* stock; 30 const char* stock;
31 if (is_forward) { 31 if (is_forward) {
32 normal = IDR_FORWARD; 32 normal = IDR_FORWARD;
33 pushed = IDR_FORWARD_P; 33 pushed = IDR_FORWARD_P;
34 hover = IDR_FORWARD_H; 34 hover = IDR_FORWARD_H;
35 disabled = IDR_FORWARD_D; 35 disabled = IDR_FORWARD_D;
36 background = IDR_FORWARD_MASK;
37 tooltip = IDS_TOOLTIP_FORWARD; 36 tooltip = IDS_TOOLTIP_FORWARD;
38 stock = GTK_STOCK_GO_FORWARD; 37 stock = GTK_STOCK_GO_FORWARD;
39 } else { 38 } else {
40 normal = IDR_BACK; 39 normal = IDR_BACK;
41 pushed = IDR_BACK_P; 40 pushed = IDR_BACK_P;
42 hover = IDR_BACK_H; 41 hover = IDR_BACK_H;
43 disabled = IDR_BACK_D; 42 disabled = IDR_BACK_D;
44 background = IDR_BACK_MASK;
45 tooltip = IDS_TOOLTIP_BACK; 43 tooltip = IDS_TOOLTIP_BACK;
46 stock = GTK_STOCK_GO_BACK; 44 stock = GTK_STOCK_GO_BACK;
47 } 45 }
48 button_.reset(new CustomDrawButton( 46 button_.reset(new CustomDrawButton(
49 GtkThemeProvider::GetFrom(browser_->profile()), 47 GtkThemeProvider::GetFrom(browser_->profile()),
50 normal, pushed, hover, disabled, background, stock, 48 normal, pushed, hover, disabled, stock, GTK_ICON_SIZE_SMALL_TOOLBAR));
51 GTK_ICON_SIZE_SMALL_TOOLBAR));
52 gtk_widget_set_tooltip_text(widget(), 49 gtk_widget_set_tooltip_text(widget(),
53 l10n_util::GetStringUTF8(tooltip).c_str()); 50 l10n_util::GetStringUTF8(tooltip).c_str());
54 menu_model_.reset(new BackForwardMenuModel(browser, is_forward ? 51 menu_model_.reset(new BackForwardMenuModel(browser, is_forward ?
55 BackForwardMenuModel::FORWARD_MENU : 52 BackForwardMenuModel::FORWARD_MENU :
56 BackForwardMenuModel::BACKWARD_MENU)); 53 BackForwardMenuModel::BACKWARD_MENU));
57 54
58 g_signal_connect(widget(), "clicked", 55 g_signal_connect(widget(), "clicked",
59 G_CALLBACK(OnClickThunk), this); 56 G_CALLBACK(OnClickThunk), this);
60 g_signal_connect(widget(), "button-press-event", 57 g_signal_connect(widget(), "button-press-event",
61 G_CALLBACK(OnButtonPressThunk), this); 58 G_CALLBACK(OnButtonPressThunk), this);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 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);
131 if (event->y - y_position_of_last_press_ < drag_min_distance) 128 if (event->y - y_position_of_last_press_ < drag_min_distance)
132 return FALSE; 129 return FALSE;
133 130
134 // We will show the menu now. Cancel the delayed event. 131 // We will show the menu now. Cancel the delayed event.
135 show_menu_factory_.RevokeAll(); 132 show_menu_factory_.RevokeAll();
136 ShowBackForwardMenu(); 133 ShowBackForwardMenu();
137 return FALSE; 134 return FALSE;
138 } 135 }
139 136
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698