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

Side by Side Diff: chrome/browser/chromeos/setting_level_bubble.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/chromeos/setting_level_bubble.h" 5 #include "chrome/browser/chromeos/setting_level_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // value on the disappearing bubble; ideally we'd have a way to cancel the 141 // value on the disappearing bubble; ideally we'd have a way to cancel the
142 // fade and show the bubble at full opacity for another 142 // fade and show the bubble at full opacity for another
143 // kBubbleShowTimeoutMs. 143 // kBubbleShowTimeoutMs.
144 } else { 144 } else {
145 DCHECK(view_); 145 DCHECK(view_);
146 hide_timer_.Stop(); 146 hide_timer_.Stop();
147 view_->SetIcon(icon); 147 view_->SetIcon(icon);
148 view_->SetEnabled(enabled); 148 view_->SetEnabled(enabled);
149 } 149 }
150 150
151 hide_timer_.Start(base::TimeDelta::FromMilliseconds(kBubbleShowTimeoutMs), 151 hide_timer_.Start(FROM_HERE,
152 base::TimeDelta::FromMilliseconds(kBubbleShowTimeoutMs),
152 this, &SettingLevelBubble::OnHideTimeout); 153 this, &SettingLevelBubble::OnHideTimeout);
153 } 154 }
154 155
155 void SettingLevelBubble::HideBubble() { 156 void SettingLevelBubble::HideBubble() {
156 if (bubble_) 157 if (bubble_)
157 bubble_->Close(); 158 bubble_->Close();
158 } 159 }
159 160
160 void SettingLevelBubble::UpdateWithoutShowingBubble(double percent, 161 void SettingLevelBubble::UpdateWithoutShowingBubble(double percent,
161 bool enabled) { 162 bool enabled) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // animation. This makes us automatically adapt to the repeat rate if a key 226 // animation. This makes us automatically adapt to the repeat rate if a key
226 // is being held down to change a setting (which prevents us from lagging 227 // is being held down to change a setting (which prevents us from lagging
227 // behind when the key is finally released). 228 // behind when the key is finally released).
228 int64 duration_ms = kInitialAnimationDurationMs; 229 int64 duration_ms = kInitialAnimationDurationMs;
229 if (!last_target_update_time_.is_null()) 230 if (!last_target_update_time_.is_null())
230 duration_ms = min(kInitialAnimationDurationMs, 231 duration_ms = min(kInitialAnimationDurationMs,
231 (now - last_target_update_time_).InMilliseconds()); 232 (now - last_target_update_time_).InMilliseconds());
232 target_time_ = now + TimeDelta::FromMilliseconds(duration_ms); 233 target_time_ = now + TimeDelta::FromMilliseconds(duration_ms);
233 234
234 if (!is_animating_) { 235 if (!is_animating_) {
235 animation_timer_.Start(TimeDelta::FromMilliseconds(kAnimationIntervalMs), 236 animation_timer_.Start(FROM_HERE,
237 TimeDelta::FromMilliseconds(kAnimationIntervalMs),
236 this, 238 this,
237 &SettingLevelBubble::OnAnimationTimeout); 239 &SettingLevelBubble::OnAnimationTimeout);
238 is_animating_ = true; 240 is_animating_ = true;
239 last_animation_update_time_ = now; 241 last_animation_update_time_ = now;
240 } 242 }
241 } 243 }
242 244
243 last_target_update_time_ = now; 245 last_target_update_time_ = now;
244 } 246 }
245 247
246 void SettingLevelBubble::StopAnimation() { 248 void SettingLevelBubble::StopAnimation() {
247 animation_timer_.Stop(); 249 animation_timer_.Stop();
248 is_animating_ = false; 250 is_animating_ = false;
249 } 251 }
250 252
251 } // namespace chromeos 253 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | chrome/browser/chromeos/status/clock_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698