| 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> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| 9 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 10 #include "base/time.h" | 12 #include "base/time.h" |
| 11 #include "base/task.h" | 13 #include "base/task.h" |
| 12 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 13 #include "base/version.h" | 15 #include "base/version.h" |
| 14 #include "chrome/app/chrome_version_info.h" | |
| 15 #include "chrome/browser/chrome_thread.h" | 16 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/pref_service.h" | 17 #include "chrome/browser/pref_service.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/chrome_version_info.h" |
| 18 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 19 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" |
| 20 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 21 #include "chrome/installer/util/browser_distribution.h" | 23 #include "chrome/installer/util/browser_distribution.h" |
| 22 | 24 |
| 23 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 24 #include "chrome/installer/util/install_util.h" | 26 #include "chrome/installer/util/install_util.h" |
| 25 #elif defined(OS_MACOSX) | 27 #elif defined(OS_MACOSX) |
| 26 #include "chrome/browser/cocoa/keystone_glue.h" | 28 #include "chrome/browser/cocoa/keystone_glue.h" |
| 27 #elif defined(OS_POSIX) | 29 #elif defined(OS_POSIX) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 std::string reply; | 99 std::string reply; |
| 98 if (!base::GetAppOutput(command_line, &reply)) { | 100 if (!base::GetAppOutput(command_line, &reply)) { |
| 99 DLOG(ERROR) << "Failed to get current file version"; | 101 DLOG(ERROR) << "Failed to get current file version"; |
| 100 return; | 102 return; |
| 101 } | 103 } |
| 102 | 104 |
| 103 installed_version.reset(Version::GetVersionFromString(ASCIIToUTF16(reply))); | 105 installed_version.reset(Version::GetVersionFromString(ASCIIToUTF16(reply))); |
| 104 #endif | 106 #endif |
| 105 | 107 |
| 106 // Get the version of the currently *running* instance of Chrome. | 108 // Get the version of the currently *running* instance of Chrome. |
| 107 scoped_ptr<FileVersionInfo> version(chrome_app::GetChromeVersionInfo()); | 109 scoped_ptr<FileVersionInfo> version(chrome::GetChromeVersionInfo()); |
| 108 if (version.get() == NULL) { | 110 if (version.get() == NULL) { |
| 109 NOTREACHED() << "Failed to get current file version"; | 111 NOTREACHED() << "Failed to get current file version"; |
| 110 return; | 112 return; |
| 111 } | 113 } |
| 112 | 114 |
| 113 scoped_ptr<Version> running_version( | 115 scoped_ptr<Version> running_version( |
| 114 Version::GetVersionFromString(WideToUTF16(version->file_version()))); | 116 Version::GetVersionFromString(WideToUTF16(version->file_version()))); |
| 115 if (running_version.get() == NULL) { | 117 if (running_version.get() == NULL) { |
| 116 NOTREACHED() << "Failed to parse version info"; | 118 NOTREACHED() << "Failed to parse version info"; |
| 117 return; | 119 return; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 188 } |
| 187 | 189 |
| 188 void UpgradeDetector::NotifyOnUpgrade() { | 190 void UpgradeDetector::NotifyOnUpgrade() { |
| 189 notify_upgrade_ = true; | 191 notify_upgrade_ = true; |
| 190 | 192 |
| 191 NotificationService::current()->Notify( | 193 NotificationService::current()->Notify( |
| 192 NotificationType::UPGRADE_RECOMMENDED, | 194 NotificationType::UPGRADE_RECOMMENDED, |
| 193 Source<UpgradeDetector>(this), | 195 Source<UpgradeDetector>(this), |
| 194 NotificationService::NoDetails()); | 196 NotificationService::NoDetails()); |
| 195 } | 197 } |
| OLD | NEW |