OLD | NEW |
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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 class DetectUpgradeTask : public Task { | 69 class DetectUpgradeTask : public Task { |
70 public: | 70 public: |
71 DetectUpgradeTask(const base::Closure& upgrade_detected_task, | 71 DetectUpgradeTask(const base::Closure& upgrade_detected_task, |
72 bool* is_unstable_channel, | 72 bool* is_unstable_channel, |
73 bool* is_critical_upgrade) | 73 bool* is_critical_upgrade) |
74 : upgrade_detected_task_(upgrade_detected_task), | 74 : upgrade_detected_task_(upgrade_detected_task), |
75 is_unstable_channel_(is_unstable_channel), | 75 is_unstable_channel_(is_unstable_channel), |
76 is_critical_upgrade_(is_critical_upgrade) { | 76 is_critical_upgrade_(is_critical_upgrade) { |
77 } | 77 } |
78 | 78 |
79 virtual ~DetectUpgradeTask() { | |
80 if (!upgrade_detected_task_.is_null()) { | |
81 // This has to get deleted on the same thread it was created. | |
82 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
83 upgrade_detected_task_); | |
84 } | |
85 } | |
86 | |
87 virtual void Run() { | 79 virtual void Run() { |
88 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
89 | 81 |
90 scoped_ptr<Version> installed_version; | 82 scoped_ptr<Version> installed_version; |
91 scoped_ptr<Version> critical_update; | 83 scoped_ptr<Version> critical_update; |
92 | 84 |
93 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
94 // Get the version of the currently *installed* instance of Chrome, | 86 // Get the version of the currently *installed* instance of Chrome, |
95 // which might be newer than the *running* instance if we have been | 87 // which might be newer than the *running* instance if we have been |
96 // upgraded in the background. | 88 // upgraded in the background. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 280 |
289 // static | 281 // static |
290 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { | 282 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { |
291 return Singleton<UpgradeDetectorImpl>::get(); | 283 return Singleton<UpgradeDetectorImpl>::get(); |
292 } | 284 } |
293 | 285 |
294 // static | 286 // static |
295 UpgradeDetector* UpgradeDetector::GetInstance() { | 287 UpgradeDetector* UpgradeDetector::GetInstance() { |
296 return UpgradeDetectorImpl::GetInstance(); | 288 return UpgradeDetectorImpl::GetInstance(); |
297 } | 289 } |
OLD | NEW |