Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/upgrade_detector.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 virtual void Run() { | 71 virtual void Run() { |
| 72 DCHECK(ChromeThread::CurrentlyOn(kDetectUpgradeTaskID)); | 72 DCHECK(ChromeThread::CurrentlyOn(kDetectUpgradeTaskID)); |
| 73 | 73 |
| 74 #if defined(OS_WIN) || defined(OS_LINUX) | 74 #if defined(OS_WIN) || defined(OS_LINUX) |
| 75 using installer::Version; | 75 using installer::Version; |
| 76 | 76 |
| 77 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
| 78 // Get the version of the currently *installed* instance of Chrome, | 78 // Get the version of the currently *installed* instance of Chrome, |
| 79 // which might be newer than the *running* instance if we have been | 79 // which might be newer than the *running* instance if we have been |
| 80 // upgraded in the background. | 80 // upgraded in the background. |
| 81 Version* installed_version = InstallUtil::GetChromeVersion(false); | 81 scoped_ptr<Version> installed_version(InstallUtil::GetChromeVersion(false)); |
|
michaeln
2010/06/15 20:01:47
We weren't calling 'detete' on this object before.
| |
| 82 if (!installed_version) { | 82 if (!installed_version.get()) { |
| 83 // User level Chrome is not installed, check system level. | 83 // User level Chrome is not installed, check system level. |
| 84 installed_version = InstallUtil::GetChromeVersion(true); | 84 installed_version.reset(InstallUtil::GetChromeVersion(true)); |
| 85 } | 85 } |
| 86 #elif defined(OS_LINUX) | 86 #elif defined(OS_LINUX) |
| 87 CommandLine command_line(*CommandLine::ForCurrentProcess()); | 87 CommandLine command_line(*CommandLine::ForCurrentProcess()); |
| 88 command_line.AppendSwitch(switches::kProductVersion); | 88 command_line.AppendSwitch(switches::kProductVersion); |
| 89 std::string reply; | 89 std::string reply; |
| 90 if (!base::GetAppOutput(command_line, &reply)) { | 90 if (!base::GetAppOutput(command_line, &reply)) { |
| 91 DLOG(ERROR) << "Failed to get current file version"; | 91 DLOG(ERROR) << "Failed to get current file version"; |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 } | 177 } |
| 178 | 178 |
| 179 void UpgradeDetector::NotifyOnUpgrade() { | 179 void UpgradeDetector::NotifyOnUpgrade() { |
| 180 notify_upgrade_ = true; | 180 notify_upgrade_ = true; |
| 181 | 181 |
| 182 NotificationService::current()->Notify( | 182 NotificationService::current()->Notify( |
| 183 NotificationType::UPGRADE_RECOMMENDED, | 183 NotificationType::UPGRADE_RECOMMENDED, |
| 184 Source<UpgradeDetector>(this), | 184 Source<UpgradeDetector>(this), |
| 185 NotificationService::NoDetails()); | 185 NotificationService::NoDetails()); |
| 186 } | 186 } |
| OLD | NEW |