| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 (base::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     uploads_.clear(); | 
| 57     ParseLogEntries(log_entries); | 58     ParseLogEntries(log_entries); | 
| 58   } | 59   } | 
| 59 } | 60 } | 
| 60 | 61 | 
| 61 void UploadList::AppendUploadInfo(const UploadInfo& info) { | 62 void UploadList::AppendUploadInfo(const UploadInfo& info) { | 
| 62   uploads_.push_back(info); | 63   uploads_.push_back(info); | 
| 63 } | 64 } | 
| 64 | 65 | 
| 65 void UploadList::ParseLogEntries( | 66 void UploadList::ParseLogEntries( | 
| 66     const std::vector<std::string>& log_entries) { | 67     const std::vector<std::string>& log_entries) { | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 86     delegate_->OnUploadListAvailable(); | 87     delegate_->OnUploadListAvailable(); | 
| 87 } | 88 } | 
| 88 | 89 | 
| 89 void UploadList::GetUploads(unsigned int max_count, | 90 void UploadList::GetUploads(unsigned int max_count, | 
| 90                             std::vector<UploadInfo>* uploads) { | 91                             std::vector<UploadInfo>* uploads) { | 
| 91   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 92   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 92   std::copy(uploads_.begin(), | 93   std::copy(uploads_.begin(), | 
| 93             uploads_.begin() + std::min<size_t>(uploads_.size(), max_count), | 94             uploads_.begin() + std::min<size_t>(uploads_.size(), max_count), | 
| 94             std::back_inserter(*uploads)); | 95             std::back_inserter(*uploads)); | 
| 95 } | 96 } | 
| OLD | NEW | 
|---|