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 #ifndef COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ | 5 #ifndef COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ |
6 #define COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ | 6 #define COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 protected: | 96 protected: |
97 virtual ~UploadList(); | 97 virtual ~UploadList(); |
98 | 98 |
99 // Reads the upload log and stores the entries in |uploads|. | 99 // Reads the upload log and stores the entries in |uploads|. |
100 virtual void LoadUploadList(std::vector<UploadInfo>* uploads); | 100 virtual void LoadUploadList(std::vector<UploadInfo>* uploads); |
101 | 101 |
102 // Requests a user triggered upload for a crash report with a given id. | 102 // Requests a user triggered upload for a crash report with a given id. |
103 virtual void RequestSingleCrashUpload(const std::string& local_id); | 103 virtual void RequestSingleCrashUpload(const std::string& local_id); |
104 | 104 |
| 105 const base::FilePath& upload_log_path() const; |
| 106 |
105 private: | 107 private: |
106 friend class base::RefCountedThreadSafe<UploadList>; | 108 friend class base::RefCountedThreadSafe<UploadList>; |
107 | 109 |
108 // Manages the background thread work for LoadUploadListAsynchronously(). | 110 // Manages the background thread work for LoadUploadListAsynchronously(). |
109 void PerformLoadAndNotifyDelegate( | 111 void PerformLoadAndNotifyDelegate( |
110 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 112 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
111 | 113 |
112 // Calls the delegate's callback method, if there is a delegate. Stores | 114 // Calls the delegate's callback method, if there is a delegate. Stores |
113 // the newly loaded |uploads| into |uploads_| on the delegate's task runner. | 115 // the newly loaded |uploads| into |uploads_| on the delegate's task runner. |
114 void SetUploadsAndNotifyDelegate(std::vector<UploadInfo> uploads); | 116 void SetUploadsAndNotifyDelegate(std::vector<UploadInfo> uploads); |
115 | 117 |
116 // Parses upload log lines, converting them to UploadInfo entries. | 118 // Parses upload log lines, converting them to UploadInfo entries. |
117 void ParseLogEntries(const std::vector<std::string>& log_entries, | 119 void ParseLogEntries(const std::vector<std::string>& log_entries, |
118 std::vector<UploadInfo>* uploads); | 120 std::vector<UploadInfo>* uploads); |
119 | 121 |
120 // |thread_checker_| ensures that |uploads_| is only set from the task runner | 122 // |thread_checker_| ensures that |uploads_| is only set from the task runner |
121 // that created the UploadList. | 123 // that created the UploadList. |
122 base::ThreadChecker thread_checker_; | 124 base::ThreadChecker thread_checker_; |
123 std::vector<UploadInfo> uploads_; | 125 std::vector<UploadInfo> uploads_; |
124 Delegate* delegate_; | 126 Delegate* delegate_; |
125 | 127 |
126 const base::FilePath upload_log_path_; | 128 const base::FilePath upload_log_path_; |
127 | 129 |
128 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 130 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
129 | 131 |
130 DISALLOW_COPY_AND_ASSIGN(UploadList); | 132 DISALLOW_COPY_AND_ASSIGN(UploadList); |
131 }; | 133 }; |
132 | 134 |
133 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ | 135 #endif // COMPONENTS_UPLOAD_LIST_UPLOAD_LIST_H_ |
OLD | NEW |