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

Side by Side Diff: chrome/browser/upgrade_detector_impl.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/upgrade_detector_impl.h" 5 #include "chrome/browser/upgrade_detector_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Windows: only enable upgrade notifications for official builds. 154 // Windows: only enable upgrade notifications for official builds.
155 // Mac: only enable them if the updater (Keystone) is present. 155 // Mac: only enable them if the updater (Keystone) is present.
156 // Linux (and other POSIX): always enable regardless of branding. 156 // Linux (and other POSIX): always enable regardless of branding.
157 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX) 157 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX)
158 #if defined(OS_MACOSX) 158 #if defined(OS_MACOSX)
159 if (keystone_glue::KeystoneEnabled()) 159 if (keystone_glue::KeystoneEnabled())
160 #endif 160 #endif
161 { 161 {
162 detect_upgrade_timer_.Start( 162 detect_upgrade_timer_.Start(
163 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), 163 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
164 this, &UpgradeDetectorImpl::CheckForUpgrade); 164 this, &UpgradeDetectorImpl::CheckForUpgrade, FROM_HERE);
165 } 165 }
166 #endif 166 #endif
167 } 167 }
168 168
169 UpgradeDetectorImpl::~UpgradeDetectorImpl() { 169 UpgradeDetectorImpl::~UpgradeDetectorImpl() {
170 } 170 }
171 171
172 void UpgradeDetectorImpl::CheckForUpgrade() { 172 void UpgradeDetectorImpl::CheckForUpgrade() {
173 method_factory_.RevokeAll(); 173 method_factory_.RevokeAll();
174 Task* callback_task = 174 Task* callback_task =
(...skipping 15 matching lines...) Expand all
190 190
191 NotifyUpgradeDetected(); 191 NotifyUpgradeDetected();
192 192
193 // Start the repeating timer for notifying the user after a certain period. 193 // Start the repeating timer for notifying the user after a certain period.
194 // The called function will eventually figure out that enough time has passed 194 // The called function will eventually figure out that enough time has passed
195 // and stop the timer. 195 // and stop the timer.
196 int cycle_time = CmdLineInterval().empty() ? kNotifyCycleTimeMs : 196 int cycle_time = CmdLineInterval().empty() ? kNotifyCycleTimeMs :
197 kNotifyCycleTimeForTestingMs; 197 kNotifyCycleTimeForTestingMs;
198 upgrade_notification_timer_.Start( 198 upgrade_notification_timer_.Start(
199 base::TimeDelta::FromMilliseconds(cycle_time), 199 base::TimeDelta::FromMilliseconds(cycle_time),
200 this, &UpgradeDetectorImpl::NotifyOnUpgrade); 200 this, &UpgradeDetectorImpl::NotifyOnUpgrade, FROM_HERE);
201 } 201 }
202 202
203 void UpgradeDetectorImpl::NotifyOnUpgrade() { 203 void UpgradeDetectorImpl::NotifyOnUpgrade() {
204 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time(); 204 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time();
205 std::string interval = CmdLineInterval(); 205 std::string interval = CmdLineInterval();
206 206
207 // A command line interval implies testing, which we'll make more convenient 207 // A command line interval implies testing, which we'll make more convenient
208 // by switching to seconds of waiting instead of days between flipping 208 // by switching to seconds of waiting instead of days between flipping
209 // severity. This works in conjunction with the similar interval.empty() 209 // severity. This works in conjunction with the similar interval.empty()
210 // check below. 210 // check below.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 // static 255 // static
256 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 256 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
257 return Singleton<UpgradeDetectorImpl>::get(); 257 return Singleton<UpgradeDetectorImpl>::get();
258 } 258 }
259 259
260 // static 260 // static
261 UpgradeDetector* UpgradeDetector::GetInstance() { 261 UpgradeDetector* UpgradeDetector::GetInstance() {
262 return UpgradeDetectorImpl::GetInstance(); 262 return UpgradeDetectorImpl::GetInstance();
263 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698