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

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

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/reload_button_gtk.h" 5 #include "chrome/browser/ui/gtk/reload_button_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 GTK_STATE_INSENSITIVE); 113 GTK_STATE_INSENSITIVE);
114 114
115 // If we're in GTK theme mode, we need to also render the correct icon for 115 // If we're in GTK theme mode, we need to also render the correct icon for
116 // the stop/insensitive since we won't be using |stop_| to render the icon. 116 // the stop/insensitive since we won't be using |stop_| to render the icon.
117 UpdateThemeButtons(); 117 UpdateThemeButtons();
118 118
119 // Go ahead and change to reload after a bit, which allows repeated reloads 119 // Go ahead and change to reload after a bit, which allows repeated reloads
120 // without moving the mouse. 120 // without moving the mouse.
121 if (!stop_to_reload_timer_.IsRunning()) { 121 if (!stop_to_reload_timer_.IsRunning()) {
122 stop_to_reload_timer_.Start(stop_to_reload_timer_delay_, this, 122 stop_to_reload_timer_.Start(stop_to_reload_timer_delay_, this,
123 &ReloadButtonGtk::OnStopToReloadTimer); 123 &ReloadButtonGtk::OnStopToReloadTimer,
124 FROM_HERE);
124 } 125 }
125 } 126 }
126 } 127 }
127 128
128 //////////////////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////////////////
129 // ReloadButtonGtk, NotificationObserver implementation: 130 // ReloadButtonGtk, NotificationObserver implementation:
130 131
131 void ReloadButtonGtk::Observe(int type, 132 void ReloadButtonGtk::Observe(int type,
132 const NotificationSource& source, 133 const NotificationSource& source,
133 const NotificationDetails& /* details */) { 134 const NotificationDetails& /* details */) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // action. 180 // action.
180 location_bar_->Revert(); 181 location_bar_->Revert();
181 } 182 }
182 183
183 // Start a timer - while this timer is running, the reload button cannot be 184 // Start a timer - while this timer is running, the reload button cannot be
184 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP 185 // changed to a stop button. We do not set |intended_mode_| to MODE_STOP
185 // here as the browser will do that when it actually starts loading (which 186 // here as the browser will do that when it actually starts loading (which
186 // may happen synchronously, thus the need to do this before telling the 187 // may happen synchronously, thus the need to do this before telling the
187 // browser to execute the reload command). 188 // browser to execute the reload command).
188 double_click_timer_.Start(double_click_timer_delay_, this, 189 double_click_timer_.Start(double_click_timer_delay_, this,
189 &ReloadButtonGtk::OnDoubleClickTimer); 190 &ReloadButtonGtk::OnDoubleClickTimer, FROM_HERE);
190 191
191 if (browser_) 192 if (browser_)
192 browser_->ExecuteCommandWithDisposition(command, disposition); 193 browser_->ExecuteCommandWithDisposition(command, disposition);
193 ++testing_reload_count_; 194 ++testing_reload_count_;
194 } 195 }
195 } 196 }
196 197
197 gboolean ReloadButtonGtk::OnExpose(GtkWidget* widget, 198 gboolean ReloadButtonGtk::OnExpose(GtkWidget* widget,
198 GdkEventExpose* e) { 199 GdkEventExpose* e) {
199 if (theme_service_ && theme_service_->UsingNativeTheme()) 200 if (theme_service_ && theme_service_->UsingNativeTheme())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk); 272 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk);
272 } 273 }
273 274
274 void ReloadButtonGtk::OnDoubleClickTimer() { 275 void ReloadButtonGtk::OnDoubleClickTimer() {
275 ChangeMode(intended_mode_, false); 276 ChangeMode(intended_mode_, false);
276 } 277 }
277 278
278 void ReloadButtonGtk::OnStopToReloadTimer() { 279 void ReloadButtonGtk::OnStopToReloadTimer() {
279 ChangeMode(intended_mode_, true); 280 ChangeMode(intended_mode_, true);
280 } 281 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698