| 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/chromeos/version_loader.h" | 5 #include "chrome/browser/chromeos/version_loader.h" | 
| 6 | 6 | 
| 7 #include <vector> | 7 #include <vector> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128   } | 128   } | 
| 129   return std::string(); | 129   return std::string(); | 
| 130 } | 130 } | 
| 131 | 131 | 
| 132 void VersionLoader::Backend::GetVersion(VersionFormat format, | 132 void VersionLoader::Backend::GetVersion(VersionFormat format, | 
| 133                                         std::string* version) { | 133                                         std::string* version) { | 
| 134   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 134   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 
| 135 | 135 | 
| 136   std::string contents; | 136   std::string contents; | 
| 137   const base::FilePath file_path(kPathVersion); | 137   const base::FilePath file_path(kPathVersion); | 
| 138   if (file_util::ReadFileToString(file_path, &contents)) { | 138   if (base::ReadFileToString(file_path, &contents)) { | 
| 139     *version = ParseVersion( | 139     *version = ParseVersion( | 
| 140         contents, | 140         contents, | 
| 141         (format == VERSION_FULL) ? kFullVersionPrefix : kVersionPrefix); | 141         (format == VERSION_FULL) ? kFullVersionPrefix : kVersionPrefix); | 
| 142   } | 142   } | 
| 143 | 143 | 
| 144   if (format == VERSION_SHORT_WITH_DATE) { | 144   if (format == VERSION_SHORT_WITH_DATE) { | 
| 145     base::PlatformFileInfo fileinfo; | 145     base::PlatformFileInfo fileinfo; | 
| 146     if (file_util::GetFileInfo(file_path, &fileinfo)) { | 146     if (file_util::GetFileInfo(file_path, &fileinfo)) { | 
| 147       base::Time::Exploded ctime; | 147       base::Time::Exploded ctime; | 
| 148       fileinfo.creation_time.UTCExplode(&ctime); | 148       fileinfo.creation_time.UTCExplode(&ctime); | 
| 149       *version += base::StringPrintf("-%02u.%02u.%02u", | 149       *version += base::StringPrintf("-%02u.%02u.%02u", | 
| 150                                      ctime.year % 100, | 150                                      ctime.year % 100, | 
| 151                                      ctime.month, | 151                                      ctime.month, | 
| 152                                      ctime.day_of_month); | 152                                      ctime.day_of_month); | 
| 153     } | 153     } | 
| 154   } | 154   } | 
| 155 } | 155 } | 
| 156 | 156 | 
| 157 void VersionLoader::Backend::GetFirmware(std::string* firmware) { | 157 void VersionLoader::Backend::GetFirmware(std::string* firmware) { | 
| 158   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 158   DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 
| 159 | 159 | 
| 160   std::string contents; | 160   std::string contents; | 
| 161   const base::FilePath file_path(kPathFirmware); | 161   const base::FilePath file_path(kPathFirmware); | 
| 162   if (file_util::ReadFileToString(file_path, &contents)) { | 162   if (base::ReadFileToString(file_path, &contents)) { | 
| 163     *firmware = ParseFirmware(contents); | 163     *firmware = ParseFirmware(contents); | 
| 164   } | 164   } | 
| 165 } | 165 } | 
| 166 | 166 | 
| 167 }  // namespace chromeos | 167 }  // namespace chromeos | 
| OLD | NEW | 
|---|