| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/upload_list.h" | 5 #include "chrome/browser/upload_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 void UploadList::LoadUploadListAndInformDelegateOfCompletion() { | 43 void UploadList::LoadUploadListAndInformDelegateOfCompletion() { |
| 44 LoadUploadList(); | 44 LoadUploadList(); |
| 45 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
| 46 BrowserThread::UI, | 46 BrowserThread::UI, |
| 47 FROM_HERE, | 47 FROM_HERE, |
| 48 base::Bind(&UploadList::InformDelegateOfCompletion, this)); | 48 base::Bind(&UploadList::InformDelegateOfCompletion, this)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void UploadList::LoadUploadList() { | 51 void UploadList::LoadUploadList() { |
| 52 if (file_util::PathExists(upload_log_path_)) { | 52 if (base::PathExists(upload_log_path_)) { |
| 53 std::string contents; | 53 std::string contents; |
| 54 file_util::ReadFileToString(upload_log_path_, &contents); | 54 file_util::ReadFileToString(upload_log_path_, &contents); |
| 55 std::vector<std::string> log_entries; | 55 std::vector<std::string> log_entries; |
| 56 base::SplitStringAlongWhitespace(contents, &log_entries); | 56 base::SplitStringAlongWhitespace(contents, &log_entries); |
| 57 ParseLogEntries(log_entries); | 57 ParseLogEntries(log_entries); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void UploadList::AppendUploadInfo(const UploadInfo& info) { | 61 void UploadList::AppendUploadInfo(const UploadInfo& info) { |
| 62 uploads_.push_back(info); | 62 uploads_.push_back(info); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 delegate_->OnUploadListAvailable(); | 86 delegate_->OnUploadListAvailable(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void UploadList::GetUploads(unsigned int max_count, | 89 void UploadList::GetUploads(unsigned int max_count, |
| 90 std::vector<UploadInfo>* uploads) { | 90 std::vector<UploadInfo>* uploads) { |
| 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 92 std::copy(uploads_.begin(), | 92 std::copy(uploads_.begin(), |
| 93 uploads_.begin() + std::min<size_t>(uploads_.size(), max_count), | 93 uploads_.begin() + std::min<size_t>(uploads_.size(), max_count), |
| 94 std::back_inserter(*uploads)); | 94 std::back_inserter(*uploads)); |
| 95 } | 95 } |
| OLD | NEW |