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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (!base::GetAppOutput(command_line, &reply)) { | 107 if (!base::GetAppOutput(command_line, &reply)) { |
108 DLOG(ERROR) << "Failed to get current file version"; | 108 DLOG(ERROR) << "Failed to get current file version"; |
109 return; | 109 return; |
110 } | 110 } |
111 | 111 |
112 installed_version.reset(Version::GetVersionFromString(ASCIIToUTF16(reply))); | 112 installed_version.reset(Version::GetVersionFromString(ASCIIToUTF16(reply))); |
113 #endif | 113 #endif |
114 | 114 |
115 // Get the version of the currently *running* instance of Chrome. | 115 // Get the version of the currently *running* instance of Chrome. |
116 chrome::VersionInfo version_info; | 116 chrome::VersionInfo version_info; |
117 if (!version_info.is_valid()) { | |
118 NOTREACHED() << "Failed to get current file version"; | |
119 return; | |
120 } | |
121 scoped_ptr<Version> running_version( | 117 scoped_ptr<Version> running_version( |
122 Version::GetVersionFromString(ASCIIToUTF16(version_info.Version()))); | 118 Version::GetVersionFromString(ASCIIToUTF16(version_info.Version()))); |
123 if (running_version.get() == NULL) { | 119 if (running_version.get() == NULL) { |
124 NOTREACHED() << "Failed to parse version info"; | 120 NOTREACHED() << "Failed to parse version info"; |
125 return; | 121 return; |
126 } | 122 } |
127 | 123 |
128 // |installed_version| may be NULL when the user downgrades on Linux (by | 124 // |installed_version| may be NULL when the user downgrades on Linux (by |
129 // switching from dev to beta channel, for example). The user needs a | 125 // switching from dev to beta channel, for example). The user needs a |
130 // restart in this case as well. See http://crbug.com/46547 | 126 // restart in this case as well. See http://crbug.com/46547 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 199 } |
204 | 200 |
205 void UpgradeDetector::NotifyOnUpgrade() { | 201 void UpgradeDetector::NotifyOnUpgrade() { |
206 notify_upgrade_ = true; | 202 notify_upgrade_ = true; |
207 | 203 |
208 NotificationService::current()->Notify( | 204 NotificationService::current()->Notify( |
209 NotificationType::UPGRADE_RECOMMENDED, | 205 NotificationType::UPGRADE_RECOMMENDED, |
210 Source<UpgradeDetector>(this), | 206 Source<UpgradeDetector>(this), |
211 NotificationService::NoDetails()); | 207 NotificationService::NoDetails()); |
212 } | 208 } |
OLD | NEW |