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

Side by Side Diff: chrome/browser/upgrade_detector_impl.cc

Issue 11440020: Add an outdated upgrade bubble view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exclude Chrome OS correctly Created 7 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 9 #include "base/bind.h"
10 #include "base/build_time.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/file_path.h" 12 #include "base/file_path.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
14 #include "base/path_service.h" 15 #include "base/path_service.h"
15 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "base/version.h"
20 #include "chrome/browser/browser_process.h"
19 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/chrome_version_info.h" 22 #include "chrome/common/chrome_version_info.h"
21 #include "chrome/installer/util/browser_distribution.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "googleurl/src/gurl.h"
25 #include "net/base/load_flags.h"
26 #include "net/http/http_response_headers.h"
27 #include "net/url_request/url_fetcher.h"
28 #include "net/url_request/url_request_status.h"
23 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
24 30
25 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "chrome/installer/util/browser_distribution.h"
33 #include "chrome/installer/util/google_update_settings.h"
34 #include "chrome/installer/util/helper.h"
26 #include "chrome/installer/util/install_util.h" 35 #include "chrome/installer/util/install_util.h"
27 #elif defined(OS_MACOSX) 36 #elif defined(OS_MACOSX)
28 #include "chrome/browser/mac/keystone_glue.h" 37 #include "chrome/browser/mac/keystone_glue.h"
29 #elif defined(OS_POSIX) 38 #elif defined(OS_POSIX)
30 #include "base/process_util.h" 39 #include "base/process_util.h"
31 #include "base/version.h"
32 #endif 40 #endif
33 41
34 using content::BrowserThread; 42 using content::BrowserThread;
35 43
36 namespace { 44 namespace {
37 45
38 // How long (in milliseconds) to wait (each cycle) before checking whether 46 // How long (in milliseconds) to wait (each cycle) before checking whether
39 // Chrome's been upgraded behind our back. 47 // Chrome's been upgraded behind our back.
40 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours. 48 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours.
41 49
42 // How long to wait (each cycle) before checking which severity level we should 50 // How long to wait (each cycle) before checking which severity level we should
43 // be at. Once we reach the highest severity, the timer will stop. 51 // be at. Once we reach the highest severity, the timer will stop.
44 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes. 52 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes.
45 53
46 // Same as kNotifyCycleTimeMs but only used during testing. 54 // Same as kNotifyCycleTimeMs but only used during testing.
47 const int kNotifyCycleTimeForTestingMs = 500; // Half a second. 55 const int kNotifyCycleTimeForTestingMs = 500; // Half a second.
48 56
57 // Default server of Variations seed info.
58 const char kTimeServerURL[] = "https://www.google.com";
Finnur 2013/01/25 11:39:22 This worries me. Chrome's user base is, as you kno
MAD 2013/01/29 21:13:10 I had looked it up and all I found was the followi
59 const int kMaxRetryTimeFetch = 5;
60
49 std::string CmdLineInterval() { 61 std::string CmdLineInterval() {
50 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 62 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
51 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec); 63 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec);
52 } 64 }
53 65
54 bool IsTesting() { 66 bool IsTesting() {
55 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 67 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
56 return cmd_line.HasSwitch(switches::kSimulateUpgrade) || 68 return cmd_line.HasSwitch(switches::kSimulateUpgrade) ||
57 cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec); 69 cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec) ||
70 cmd_line.HasSwitch(switches::kSimulateCriticalUpdate) ||
71 cmd_line.HasSwitch(switches::kSimulateOutdated);
58 } 72 }
59 73
60 // How often to check for an upgrade. 74 // How often to check for an upgrade.
61 int GetCheckForUpgradeEveryMs() { 75 int GetCheckForUpgradeEveryMs() {
62 // Check for a value passed via the command line. 76 // Check for a value passed via the command line.
63 int interval_ms; 77 int interval_ms;
64 std::string interval = CmdLineInterval(); 78 std::string interval = CmdLineInterval();
65 if (!interval.empty() && base::StringToInt(interval, &interval_ms)) 79 if (!interval.empty() && base::StringToInt(interval, &interval_ms))
66 return interval_ms * 1000; // Command line value is in seconds. 80 return interval_ms * 1000; // Command line value is in seconds.
67 81
68 return kCheckForUpgradeMs; 82 return kCheckForUpgradeMs;
69 } 83 }
70 84
85 #if defined(OS_WIN)
86 bool IsSystemInstall() {
87 FilePath exe_path;
88 if (!PathService::Get(base::DIR_EXE, &exe_path)) {
89 NOTREACHED() << "Failed to find executable path";
90 return false;
91 }
92
93 return !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
94 }
95 #endif
96
71 // This task checks the currently running version of Chrome against the 97 // This task checks the currently running version of Chrome against the
72 // installed version. If the installed version is newer, it runs the passed 98 // installed version. If the installed version is newer, it runs the passed
73 // callback task. Otherwise it just deletes the task. 99 // callback task. Otherwise it just deletes the task.
74 void DetectUpgradeTask(const base::Closure& upgrade_detected_task, 100 void DetectUpgradeTask(const base::Closure& upgrade_detected_task,
75 bool* is_unstable_channel, 101 bool* is_unstable_channel,
76 bool* is_critical_upgrade) { 102 bool* is_critical_upgrade) {
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
78 104
79 Version installed_version; 105 Version installed_version;
80 Version critical_update; 106 Version critical_update;
81 107
82 #if defined(OS_WIN) 108 #if defined(OS_WIN)
83 // Get the version of the currently *installed* instance of Chrome, 109 // Get the version of the currently *installed* instance of Chrome,
84 // which might be newer than the *running* instance if we have been 110 // which might be newer than the *running* instance if we have been
85 // upgraded in the background. 111 // upgraded in the background.
86 FilePath exe_path; 112 bool system_install = IsSystemInstall();
87 if (!PathService::Get(base::DIR_EXE, &exe_path)) {
88 NOTREACHED() << "Failed to find executable path";
89 return;
90 }
91
92 bool system_install =
93 !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
94 113
95 // TODO(tommi): Check if using the default distribution is always the right 114 // TODO(tommi): Check if using the default distribution is always the right
96 // thing to do. 115 // thing to do.
97 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 116 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
98 InstallUtil::GetChromeVersion(dist, system_install, &installed_version); 117 InstallUtil::GetChromeVersion(dist, system_install, &installed_version);
99 118
100 if (installed_version.IsValid()) { 119 if (installed_version.IsValid()) {
101 InstallUtil::GetCriticalUpdateVersion(dist, system_install, 120 InstallUtil::GetCriticalUpdateVersion(dist, system_install,
102 &critical_update); 121 &critical_update);
103 } 122 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 *is_critical_upgrade = 162 *is_critical_upgrade =
144 critical_update.IsValid() && 163 critical_update.IsValid() &&
145 (critical_update.CompareTo(running_version) > 0); 164 (critical_update.CompareTo(running_version) > 0);
146 165
147 // Fire off the upgrade detected task. 166 // Fire off the upgrade detected task.
148 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 167 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
149 upgrade_detected_task); 168 upgrade_detected_task);
150 } 169 }
151 } 170 }
152 171
172 #if defined(OS_WIN)
173 // This task checks the update policy and calls back the task only if automatic
174 // updates are allowed.
175 void DetectUpdatability(const base::Closure& updates_enabled) {
176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
177
178 CommandLine command_line(*CommandLine::ForCurrentProcess());
179 if (command_line.HasSwitch(switches::kSimulateOutdated)) {
180 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
181 updates_enabled);
182 return;
183 }
184
185 string16 app_guid = installer::GetAppGuidForUpdates(IsSystemInstall());
186 DCHECK(!app_guid.empty());
187 if (GoogleUpdateSettings::GetAppUpdatePolicy(app_guid, NULL) ==
188 GoogleUpdateSettings::AUTOMATIC_UPDATES) {
Finnur 2013/01/25 11:39:22 I didn't think that the 'prevent any updates' ente
MAD 2013/01/29 21:13:10 I couldn't find an implementation for other platfo
189 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
190 updates_enabled);
191 }
192 }
193 #endif // defined(OS_WIN)
194
153 } // namespace 195 } // namespace
154 196
155 UpgradeDetectorImpl::UpgradeDetectorImpl() 197 UpgradeDetectorImpl::UpgradeDetectorImpl()
156 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 198 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
157 is_unstable_channel_(false) { 199 is_unstable_channel_(false),
200 build_date_(base::GetBuildTime()) {
158 CommandLine command_line(*CommandLine::ForCurrentProcess()); 201 CommandLine command_line(*CommandLine::ForCurrentProcess());
159 if (command_line.HasSwitch(switches::kDisableBackgroundNetworking)) 202 if (command_line.HasSwitch(switches::kDisableBackgroundNetworking))
160 return; 203 return;
161 if (command_line.HasSwitch(switches::kSimulateUpgrade)) { 204 if (command_line.HasSwitch(switches::kSimulateUpgrade)) {
162 UpgradeDetected(); 205 UpgradeDetected();
163 return; 206 return;
164 } 207 }
208 if (command_line.HasSwitch(switches::kSimulateCriticalUpdate)) {
209 is_critical_upgrade_ = true;
210 UpgradeDetected();
211 return;
212 }
213 if (command_line.HasSwitch(switches::kSimulateOutdated)) {
214 std::string build_date = command_line.GetSwitchValueASCII(
215 switches::kSimulateOutdated);
216 base::Time maybe_build_time;
217 bool result = base::Time::FromString(build_date.c_str(), &maybe_build_time);
218 if (result && !maybe_build_time.is_null()) {
219 build_date_ = maybe_build_time;
220 detect_upgrade_timer_.Start(FROM_HERE,
221 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
222 this, &UpgradeDetectorImpl::CheckForUpgrade);
223 } else {
224 is_outdated_install_ = true;
225 UpgradeDetected();
Finnur 2013/01/25 11:39:22 I don't quite grok this... If we fail to parse th
MAD 2013/01/29 21:13:10 Done.
226 }
227 return;
228 }
165 // Windows: only enable upgrade notifications for official builds. 229 // Windows: only enable upgrade notifications for official builds.
166 // Mac: only enable them if the updater (Keystone) is present. 230 // Mac: only enable them if the updater (Keystone) is present.
167 // Linux (and other POSIX): always enable regardless of branding. 231 // Linux (and other POSIX): always enable regardless of branding.
168 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX) 232 #if (defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)) || defined(OS_POSIX)
169 #if defined(OS_MACOSX) 233 #if defined(OS_MACOSX)
170 if (keystone_glue::KeystoneEnabled()) 234 if (keystone_glue::KeystoneEnabled())
171 #endif 235 #endif
172 { 236 {
173 detect_upgrade_timer_.Start(FROM_HERE, 237 detect_upgrade_timer_.Start(FROM_HERE,
174 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), 238 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
(...skipping 12 matching lines...) Expand all
187 weak_factory_.GetWeakPtr()); 251 weak_factory_.GetWeakPtr());
188 // We use FILE as the thread to run the upgrade detection code on all 252 // We use FILE as the thread to run the upgrade detection code on all
189 // platforms. For Linux, this is because we don't want to block the UI thread 253 // platforms. For Linux, this is because we don't want to block the UI thread
190 // while launching a background process and reading its output; on the Mac and 254 // while launching a background process and reading its output; on the Mac and
191 // on Windows checking for an upgrade requires reading a file. 255 // on Windows checking for an upgrade requires reading a file.
192 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 256 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
193 base::Bind(&DetectUpgradeTask, 257 base::Bind(&DetectUpgradeTask,
194 callback_task, 258 callback_task,
195 &is_unstable_channel_, 259 &is_unstable_channel_,
196 &is_critical_upgrade_)); 260 &is_critical_upgrade_));
261 // On Windows, there might be a policy preventing updates, so validate
262 // updatability before comparing build time to sane time.
263 #if defined(OS_WIN)
264 if (!is_outdated_install_ && !pending_time_request_.get()) {
265 base::Closure callback_task =
266 base::Bind(&UpgradeDetectorImpl::CompareBuildTimeToSaneTime,
267 weak_factory_.GetWeakPtr());
268 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
269 base::Bind(&DetectUpdatability,
270 callback_task));
271 }
272 #else // defined(OS_WIN)
Finnur 2013/01/25 11:39:22 nit: shouldn't this just be on the endif?
MAD 2013/01/29 21:13:10 Done.
273 CompareBuildTimeToSaneTime();
274 #endif
275 }
276
277 void UpgradeDetectorImpl::CompareBuildTimeToSaneTime() {
278 // Check again, in case we got posted more than once by CheckForUpgrade.
279 if (!is_outdated_install_ && !pending_time_request_.get()) {
280 // Now get the current time from a URL request to ensure we get a sane time.
281 pending_time_request_.reset(net::URLFetcher::Create(
282 GURL(kTimeServerURL), net::URLFetcher::GET, this));
283 pending_time_request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
284 net::LOAD_DO_NOT_SAVE_COOKIES);
285 pending_time_request_->SetRequestContext(
286 g_browser_process->system_request_context());
287 pending_time_request_->SetMaxRetriesOn5xx(kMaxRetryTimeFetch);
288 pending_time_request_->Start();
289 }
197 } 290 }
198 291
199 void UpgradeDetectorImpl::UpgradeDetected() { 292 void UpgradeDetectorImpl::UpgradeDetected() {
200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
201 294
202 // Stop the recurring timer (that is checking for changes). 295 // Stop the recurring timer (that is checking for changes).
203 detect_upgrade_timer_.Stop(); 296 detect_upgrade_timer_.Stop();
204 297
205 NotifyUpgradeDetected(); 298 NotifyUpgradeDetected();
206 299
207 // Start the repeating timer for notifying the user after a certain period. 300 // Start the repeating timer for notifying the user after a certain period.
208 // The called function will eventually figure out that enough time has passed 301 // The called function will eventually figure out that enough time has passed
209 // and stop the timer. 302 // and stop the timer.
210 int cycle_time = IsTesting() ? 303 int cycle_time = IsTesting() ?
211 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs; 304 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs;
212 upgrade_notification_timer_.Start(FROM_HERE, 305 upgrade_notification_timer_.Start(FROM_HERE,
213 base::TimeDelta::FromMilliseconds(cycle_time), 306 base::TimeDelta::FromMilliseconds(cycle_time),
214 this, &UpgradeDetectorImpl::NotifyOnUpgrade); 307 this, &UpgradeDetectorImpl::NotifyOnUpgrade);
215 } 308 }
216 309
217 void UpgradeDetectorImpl::NotifyOnUpgrade() { 310 void UpgradeDetectorImpl::NotifyOnUpgrade() {
218 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time(); 311 base::TimeDelta delta = base::Time::Now() - upgrade_detected_time();
219 312
220 // We'll make testing more convenient by switching to seconds of waiting 313 // We'll make testing more convenient by switching to seconds of waiting
221 // instead of days between flipping severity. 314 // instead of days between flipping severity.
222 bool is_testing = IsTesting(); 315 bool is_testing = IsTesting();
223 int64 time_passed = is_testing ? delta.InSeconds() : delta.InHours(); 316 int64 time_passed = is_testing ? delta.InSeconds() : delta.InHours();
224 317
318 bool is_critical_or_oudated = is_critical_upgrade_ || is_outdated_install_;
225 if (is_unstable_channel_) { 319 if (is_unstable_channel_) {
226 // There's only one threat level for unstable channels like dev and 320 // There's only one threat level for unstable channels like dev and
227 // canary, and it hits after one hour. During testing, it hits after one 321 // canary, and it hits after one hour. During testing, it hits after one
228 // minute. 322 // minute.
229 const int kUnstableThreshold = 1; 323 const int kUnstableThreshold = 1;
230 324
231 if (is_critical_upgrade_) 325 if (is_critical_or_oudated)
232 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_CRITICAL); 326 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_CRITICAL);
233 else if (time_passed >= kUnstableThreshold) { 327 else if (time_passed >= kUnstableThreshold) {
234 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW); 328 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW);
235 329
236 // That's as high as it goes. 330 // That's as high as it goes.
237 upgrade_notification_timer_.Stop(); 331 upgrade_notification_timer_.Stop();
238 } else { 332 } else {
239 return; // Not ready to recommend upgrade. 333 return; // Not ready to recommend upgrade.
240 } 334 }
241 } else { 335 } else {
242 const int kMultiplier = is_testing ? 1 : 24; 336 const int kMultiplier = is_testing ? 1 : 24;
243 // 14 days when not testing, otherwise 14 seconds. 337 // 14 days when not testing, otherwise 14 seconds.
244 const int kSevereThreshold = 14 * kMultiplier; 338 const int kSevereThreshold = 14 * kMultiplier;
245 const int kHighThreshold = 7 * kMultiplier; 339 const int kHighThreshold = 7 * kMultiplier;
246 const int kElevatedThreshold = 4 * kMultiplier; 340 const int kElevatedThreshold = 4 * kMultiplier;
247 const int kLowThreshold = 2 * kMultiplier; 341 const int kLowThreshold = 2 * kMultiplier;
248 342
249 // These if statements must be sorted (highest interval first). 343 // These if statements must be sorted (highest interval first).
250 if (time_passed >= kSevereThreshold || is_critical_upgrade_) { 344 if (time_passed >= kSevereThreshold || is_critical_or_oudated) {
251 set_upgrade_notification_stage( 345 set_upgrade_notification_stage(
252 is_critical_upgrade_ ? UPGRADE_ANNOYANCE_CRITICAL : 346 is_critical_or_oudated ? UPGRADE_ANNOYANCE_CRITICAL :
253 UPGRADE_ANNOYANCE_SEVERE); 347 UPGRADE_ANNOYANCE_SEVERE);
254 348
255 // We can't get any higher, baby. 349 // We can't get any higher, baby.
256 upgrade_notification_timer_.Stop(); 350 upgrade_notification_timer_.Stop();
257 } else if (time_passed >= kHighThreshold) { 351 } else if (time_passed >= kHighThreshold) {
258 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_HIGH); 352 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_HIGH);
259 } else if (time_passed >= kElevatedThreshold) { 353 } else if (time_passed >= kElevatedThreshold) {
260 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_ELEVATED); 354 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_ELEVATED);
261 } else if (time_passed >= kLowThreshold) { 355 } else if (time_passed >= kLowThreshold) {
262 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW); 356 set_upgrade_notification_stage(UPGRADE_ANNOYANCE_LOW);
263 } else { 357 } else {
264 return; // Not ready to recommend upgrade. 358 return; // Not ready to recommend upgrade.
265 } 359 }
266 } 360 }
267 361
268 NotifyUpgradeRecommended(); 362 NotifyUpgradeRecommended();
269 } 363 }
270 364
365 void UpgradeDetectorImpl::OnURLFetchComplete(const net::URLFetcher* source) {
366 // The fetcher will be deleted when the request is handled.
367 scoped_ptr<const net::URLFetcher> request(
368 pending_time_request_.release());
369 if (request->GetStatus().status() != net::URLRequestStatus::SUCCESS) {
370 DVLOG(1) << "Variations server request failed.";
Finnur 2013/01/25 11:39:22 Of course, this might be a moot point (if you swit
MAD 2013/01/29 21:13:10 Copy/Paste error... Cleared... Not really needed..
371 return;
372 }
373
374 base::Time response_date;
375 bool success = request->GetResponseHeaders()->GetDateValue(&response_date);
376 if (success) {
377 DCHECK(!response_date.is_null() && response_date >= build_date_);
378 if (response_date - build_date_ > base::TimeDelta::FromDays(12 * 7))
Finnur 2013/01/25 11:39:22 Chrome has issued 1 major stable release per quart
MAD 2013/01/29 21:13:10 This is the spec as debated with JeffC and ALaforg
379 is_outdated_install_ = true;
380 }
381 }
Finnur 2013/01/25 11:39:22 Essentially you are setting the |is_outdated_insta
MAD 2013/01/29 21:13:10 Ho... Actually, I needed to add a call to UpgradeD
382
271 // static 383 // static
272 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 384 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
273 return Singleton<UpgradeDetectorImpl>::get(); 385 return Singleton<UpgradeDetectorImpl>::get();
274 } 386 }
275 387
276 // static 388 // static
277 UpgradeDetector* UpgradeDetector::GetInstance() { 389 UpgradeDetector* UpgradeDetector::GetInstance() {
278 return UpgradeDetectorImpl::GetInstance(); 390 return UpgradeDetectorImpl::GetInstance();
279 } 391 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698