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

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

Issue 155367: Revert "Add button tinting to the toolbar buttons." (Closed)
Patch Set: Created 11 years, 5 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
« 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) 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"
11 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
12 #include "chrome/browser/browser.h" 12 #include "chrome/browser/browser.h"
13 #include "chrome/browser/gtk/back_forward_menu_model_gtk.h" 13 #include "chrome/browser/gtk/back_forward_menu_model_gtk.h"
14 #include "chrome/browser/gtk/menu_gtk.h" 14 #include "chrome/browser/gtk/menu_gtk.h"
15 #include "chrome/browser/profile.h"
16 #include "chrome/common/gtk_util.h" 15 #include "chrome/common/gtk_util.h"
17 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
18 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
19 18
20 // The time in milliseconds between when the user clicks and the menu appears. 19 // The time in milliseconds between when the user clicks and the menu appears.
21 static const int kMenuTimerDelay = 500; 20 static const int kMenuTimerDelay = 500;
22 21
23 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward) 22 BackForwardButtonGtk::BackForwardButtonGtk(Browser* browser, bool is_forward)
24 : browser_(browser), 23 : browser_(browser),
25 is_forward_(is_forward), 24 is_forward_(is_forward),
26 last_release_event_flags_(0), 25 last_release_event_flags_(0),
27 show_menu_factory_(this) { 26 show_menu_factory_(this) {
28 int normal, active, highlight, depressed, tooltip; 27 int normal, active, highlight, depressed, tooltip;
29 const char* stock; 28 const char* stock;
30 if (is_forward) { 29 if (is_forward) {
31 normal = IDR_FORWARD; 30 normal = IDR_FORWARD;
32 active = IDR_FORWARD_P; 31 active = IDR_FORWARD_P;
33 highlight = IDR_FORWARD_H; 32 highlight = IDR_FORWARD_H;
34 depressed = IDR_FORWARD_D; 33 depressed = IDR_FORWARD_D;
35 tooltip = IDS_TOOLTIP_FORWARD; 34 tooltip = IDS_TOOLTIP_FORWARD;
36 stock = GTK_STOCK_GO_FORWARD; 35 stock = GTK_STOCK_GO_FORWARD;
37 } else { 36 } else {
38 normal = IDR_BACK; 37 normal = IDR_BACK;
39 active = IDR_BACK_P; 38 active = IDR_BACK_P;
40 highlight = IDR_BACK_H; 39 highlight = IDR_BACK_H;
41 depressed = IDR_BACK_D; 40 depressed = IDR_BACK_D;
42 tooltip = IDS_TOOLTIP_BACK; 41 tooltip = IDS_TOOLTIP_BACK;
43 stock = GTK_STOCK_GO_BACK; 42 stock = GTK_STOCK_GO_BACK;
44 } 43 }
45 button_.reset(new CustomDrawButton(browser_->profile()->GetThemeProvider(), 44 button_.reset(new CustomDrawButton(normal, active, highlight, depressed,
46 normal, active, highlight, depressed, stock)); 45 stock));
47 gtk_widget_set_tooltip_text(widget(), 46 gtk_widget_set_tooltip_text(widget(),
48 l10n_util::GetStringUTF8(tooltip).c_str()); 47 l10n_util::GetStringUTF8(tooltip).c_str());
49 menu_model_.reset(new BackForwardMenuModelGtk(browser, 48 menu_model_.reset(new BackForwardMenuModelGtk(browser,
50 is_forward ? 49 is_forward ?
51 BackForwardMenuModel::FORWARD_MENU : 50 BackForwardMenuModel::FORWARD_MENU :
52 BackForwardMenuModel::BACKWARD_MENU, 51 BackForwardMenuModel::BACKWARD_MENU,
53 this)); 52 this));
54 53
55 g_signal_connect(widget(), "clicked", 54 g_signal_connect(widget(), "clicked",
56 G_CALLBACK(OnClick), this); 55 G_CALLBACK(OnClick), this);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 int drag_min_distance; 142 int drag_min_distance;
144 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL); 143 g_object_get(settings, "gtk-dnd-drag-threshold", &drag_min_distance, NULL);
145 if (event->y - button->y_position_of_last_press_ < drag_min_distance) 144 if (event->y - button->y_position_of_last_press_ < drag_min_distance)
146 return FALSE; 145 return FALSE;
147 146
148 // We will show the menu now. Cancel the delayed event. 147 // We will show the menu now. Cancel the delayed event.
149 button->show_menu_factory_.RevokeAll(); 148 button->show_menu_factory_.RevokeAll();
150 button->ShowBackForwardMenu(); 149 button->ShowBackForwardMenu();
151 return FALSE; 150 return FALSE;
152 } 151 }
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