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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return interval_ms * 1000; // Command line value is in seconds. | 56 return interval_ms * 1000; // Command line value is in seconds. |
57 | 57 |
58 return kCheckForUpgradeMs; | 58 return kCheckForUpgradeMs; |
59 } | 59 } |
60 | 60 |
61 // This task checks the currently running version of Chrome against the | 61 // This task checks the currently running version of Chrome against the |
62 // installed version. If the installed version is newer, it runs the passed | 62 // installed version. If the installed version is newer, it runs the passed |
63 // callback task. Otherwise it just deletes the task. | 63 // callback task. Otherwise it just deletes the task. |
64 class DetectUpgradeTask : public Task { | 64 class DetectUpgradeTask : public Task { |
65 public: | 65 public: |
66 explicit DetectUpgradeTask(Task* upgrade_detected_task, | 66 DetectUpgradeTask(Task* upgrade_detected_task, bool* is_unstable_channel) |
67 bool* is_unstable_channel) | |
68 : upgrade_detected_task_(upgrade_detected_task), | 67 : upgrade_detected_task_(upgrade_detected_task), |
69 is_unstable_channel_(is_unstable_channel) { | 68 is_unstable_channel_(is_unstable_channel) { |
70 } | 69 } |
71 | 70 |
72 virtual ~DetectUpgradeTask() { | 71 virtual ~DetectUpgradeTask() { |
73 if (upgrade_detected_task_) { | 72 if (upgrade_detected_task_) { |
74 // This has to get deleted on the same thread it was created. | 73 // This has to get deleted on the same thread it was created. |
75 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 74 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
76 new DeleteTask<Task>(upgrade_detected_task_)); | 75 new DeleteTask<Task>(upgrade_detected_task_)); |
77 } | 76 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 254 |
256 // static | 255 // static |
257 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { | 256 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { |
258 return Singleton<UpgradeDetectorImpl>::get(); | 257 return Singleton<UpgradeDetectorImpl>::get(); |
259 } | 258 } |
260 | 259 |
261 // static | 260 // static |
262 UpgradeDetector* UpgradeDetector::GetInstance() { | 261 UpgradeDetector* UpgradeDetector::GetInstance() { |
263 return UpgradeDetectorImpl::GetInstance(); | 262 return UpgradeDetectorImpl::GetInstance(); |
264 } | 263 } |
OLD | NEW |