| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 namespace chromeos { | 50 namespace chromeos { |
| 51 | 51 |
| 52 VersionLoader::VersionLoader() : backend_(new Backend()) {} | 52 VersionLoader::VersionLoader() : backend_(new Backend()) {} |
| 53 | 53 |
| 54 VersionLoader::~VersionLoader() {} | 54 VersionLoader::~VersionLoader() {} |
| 55 | 55 |
| 56 CancelableTaskTracker::TaskId VersionLoader::GetVersion( | 56 base::CancelableTaskTracker::TaskId VersionLoader::GetVersion( |
| 57 VersionFormat format, | 57 VersionFormat format, |
| 58 const GetVersionCallback& callback, | 58 const GetVersionCallback& callback, |
| 59 CancelableTaskTracker* tracker) { | 59 base::CancelableTaskTracker* tracker) { |
| 60 std::string* version = new std::string(); | 60 std::string* version = new std::string(); |
| 61 return tracker->PostTaskAndReply( | 61 return tracker->PostTaskAndReply( |
| 62 BrowserThread::GetBlockingPool(), | 62 BrowserThread::GetBlockingPool(), |
| 63 FROM_HERE, | 63 FROM_HERE, |
| 64 base::Bind(&Backend::GetVersion, backend_.get(), format, version), | 64 base::Bind(&Backend::GetVersion, backend_.get(), format, version), |
| 65 base::Bind(&VersionLoaderCallbackHelper, callback, base::Owned(version))); | 65 base::Bind(&VersionLoaderCallbackHelper, callback, base::Owned(version))); |
| 66 } | 66 } |
| 67 | 67 |
| 68 CancelableTaskTracker::TaskId VersionLoader::GetFirmware( | 68 base::CancelableTaskTracker::TaskId VersionLoader::GetFirmware( |
| 69 const GetFirmwareCallback& callback, | 69 const GetFirmwareCallback& callback, |
| 70 CancelableTaskTracker* tracker) { | 70 base::CancelableTaskTracker* tracker) { |
| 71 std::string* firmware = new std::string(); | 71 std::string* firmware = new std::string(); |
| 72 return tracker->PostTaskAndReply( | 72 return tracker->PostTaskAndReply( |
| 73 BrowserThread::GetBlockingPool(), | 73 BrowserThread::GetBlockingPool(), |
| 74 FROM_HERE, | 74 FROM_HERE, |
| 75 base::Bind(&Backend::GetFirmware, backend_.get(), firmware), | 75 base::Bind(&Backend::GetFirmware, backend_.get(), firmware), |
| 76 base::Bind(&VersionLoaderCallbackHelper, | 76 base::Bind(&VersionLoaderCallbackHelper, |
| 77 callback, base::Owned(firmware))); | 77 callback, base::Owned(firmware))); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 124 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 125 | 125 |
| 126 std::string contents; | 126 std::string contents; |
| 127 const base::FilePath file_path(kPathFirmware); | 127 const base::FilePath file_path(kPathFirmware); |
| 128 if (base::ReadFileToString(file_path, &contents)) { | 128 if (base::ReadFileToString(file_path, &contents)) { |
| 129 *firmware = ParseFirmware(contents); | 129 *firmware = ParseFirmware(contents); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace chromeos | 133 } // namespace chromeos |
| OLD | NEW |