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

Unified Diff: chrome/browser/gtk/browser_toolbar_gtk.cc

Issue 164137: Modified the toolbar button handlers so that the handlers can revert the locati... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_toolbar_gtk.cc
===================================================================
--- chrome/browser/gtk/browser_toolbar_gtk.cc (revision 22898)
+++ chrome/browser/gtk/browser_toolbar_gtk.cc (working copy)
@@ -172,10 +172,14 @@
back_.reset(new BackForwardButtonGtk(browser_, false));
gtk_box_pack_start(GTK_BOX(back_forward_hbox_), back_->widget(), FALSE,
FALSE, 0);
+ g_signal_connect(back_->widget(), "clicked",
+ G_CALLBACK(OnButtonClick), this);
forward_.reset(new BackForwardButtonGtk(browser_, true));
gtk_box_pack_start(GTK_BOX(back_forward_hbox_), forward_->widget(), FALSE,
FALSE, 0);
+ g_signal_connect(forward_->widget(), "clicked",
+ G_CALLBACK(OnButtonClick), this);
gtk_box_pack_start(GTK_BOX(toolbar_), back_forward_hbox_, FALSE, FALSE, 0);
reload_.reset(BuildToolbarButton(IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0,
@@ -615,13 +619,21 @@
// static
void BrowserToolbarGtk::OnButtonClick(GtkWidget* button,
BrowserToolbarGtk* toolbar) {
+ if ((button == toolbar->back_->widget()) ||
+ (button == toolbar->forward_->widget())) {
+ toolbar->location_bar_->Revert();
+ return;
+ }
+
int tag = -1;
- if (button == toolbar->reload_->widget())
+ if (button == toolbar->reload_->widget()) {
tag = IDC_RELOAD;
- else if (toolbar->home_.get() && button == toolbar->home_->widget())
+ toolbar->location_bar_->Revert();
+ } else if (toolbar->home_.get() && button == toolbar->home_->widget()) {
tag = IDC_HOME;
- else if (button == toolbar->star_->widget())
+ } else if (button == toolbar->star_->widget()) {
tag = IDC_STAR;
+ }
DCHECK_NE(tag, -1) << "Unexpected button click callback";
toolbar->browser_->ExecuteCommandWithDisposition(tag,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698