| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system_logs/lsb_release_log_source.h" | 5 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 base::Bind(&LsbReleaseLogSource::ReadLSBRelease, response), | 37 base::Bind(&LsbReleaseLogSource::ReadLSBRelease, response), |
| 38 base::Bind(callback, | 38 base::Bind(callback, |
| 39 base::Owned(response))); | 39 base::Owned(response))); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) { | 42 void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) { |
| 43 DCHECK(response); | 43 DCHECK(response); |
| 44 | 44 |
| 45 const base::FilePath lsb_release_file("/etc/lsb-release"); | 45 const base::FilePath lsb_release_file("/etc/lsb-release"); |
| 46 std::string lsb_data; | 46 std::string lsb_data; |
| 47 bool read_success = file_util::ReadFileToString(lsb_release_file, &lsb_data); | 47 bool read_success = base::ReadFileToString(lsb_release_file, &lsb_data); |
| 48 // if we were using an internal temp file, the user does not need the | 48 // if we were using an internal temp file, the user does not need the |
| 49 // logs to stay past the ReadFile call - delete the file | 49 // logs to stay past the ReadFile call - delete the file |
| 50 if (!read_success) { | 50 if (!read_success) { |
| 51 LOG(ERROR) << "Can't access /etc/lsb-release file."; | 51 LOG(ERROR) << "Can't access /etc/lsb-release file."; |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 ParseLSBRelease(lsb_data, response); | 54 ParseLSBRelease(lsb_data, response); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void LsbReleaseLogSource::ParseLSBRelease(const std::string& lsb_data, | 57 void LsbReleaseLogSource::ParseLSBRelease(const std::string& lsb_data, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 | 73 |
| 74 if (value.empty()) | 74 if (value.empty()) |
| 75 (*response)[key] = kEmptyLogEntry; | 75 (*response)[key] = kEmptyLogEntry; |
| 76 else | 76 else |
| 77 (*response)[key] = value; | 77 (*response)[key] = value; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace chromeos | 81 } // namespace chromeos |
| 82 | 82 |
| OLD | NEW |