| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // TODO(tommi): Check if using the default distribution is always the right | 89 // TODO(tommi): Check if using the default distribution is always the right |
| 90 // thing to do. | 90 // thing to do. |
| 91 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 91 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 92 installed_version.reset(InstallUtil::GetChromeVersion(dist, false)); | 92 installed_version.reset(InstallUtil::GetChromeVersion(dist, false)); |
| 93 if (!installed_version.get()) { | 93 if (!installed_version.get()) { |
| 94 // User level Chrome is not installed, check system level. | 94 // User level Chrome is not installed, check system level. |
| 95 installed_version.reset(InstallUtil::GetChromeVersion(dist, true)); | 95 installed_version.reset(InstallUtil::GetChromeVersion(dist, true)); |
| 96 } | 96 } |
| 97 #elif defined(OS_MACOSX) | 97 #elif defined(OS_MACOSX) |
| 98 installed_version.reset( | 98 installed_version.reset( |
| 99 Version::GetVersionFromString(UTF16ToWideHack( | 99 Version::GetVersionFromString(UTF16ToASCII( |
| 100 keystone_glue::CurrentlyInstalledVersion()))); | 100 keystone_glue::CurrentlyInstalledVersion()))); |
| 101 #elif defined(OS_POSIX) | 101 #elif defined(OS_POSIX) |
| 102 // POSIX but not Mac OS X: Linux, etc. | 102 // POSIX but not Mac OS X: Linux, etc. |
| 103 CommandLine command_line(*CommandLine::ForCurrentProcess()); | 103 CommandLine command_line(*CommandLine::ForCurrentProcess()); |
| 104 command_line.AppendSwitch(switches::kProductVersion); | 104 command_line.AppendSwitch(switches::kProductVersion); |
| 105 std::string reply; | 105 std::string reply; |
| 106 if (!base::GetAppOutput(command_line, &reply)) { | 106 if (!base::GetAppOutput(command_line, &reply)) { |
| 107 DLOG(ERROR) << "Failed to get current file version"; | 107 DLOG(ERROR) << "Failed to get current file version"; |
| 108 return; | 108 return; |
| 109 } | 109 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 202 } |
| 203 | 203 |
| 204 void UpgradeDetector::NotifyOnUpgrade() { | 204 void UpgradeDetector::NotifyOnUpgrade() { |
| 205 notify_upgrade_ = true; | 205 notify_upgrade_ = true; |
| 206 | 206 |
| 207 NotificationService::current()->Notify( | 207 NotificationService::current()->Notify( |
| 208 NotificationType::UPGRADE_RECOMMENDED, | 208 NotificationType::UPGRADE_RECOMMENDED, |
| 209 Source<UpgradeDetector>(this), | 209 Source<UpgradeDetector>(this), |
| 210 NotificationService::NoDetails()); | 210 NotificationService::NoDetails()); |
| 211 } | 211 } |
| OLD | NEW |