Chromium Code Reviews| Index: chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h |
| diff --git a/chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h b/chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..099aebe18b80ada61a9123be55e3fea1ef025378 |
| --- /dev/null |
| +++ b/chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_LOG_SOURCES_CRASH_IDS_SOURCE_H_ |
| +#define CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_LOG_SOURCES_CRASH_IDS_SOURCE_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback_forward.h" |
| +#include "chrome/browser/feedback/system_logs/system_logs_fetcher_base.h" |
| +#include "components/upload_list/crash_upload_list.h" |
| +#include "components/upload_list/upload_list.h" |
| + |
| +namespace system_logs { |
| + |
| +// Extract the most recent crash IDs (if any) and adds them to the system logs. |
| +class CrashIdsSource : public SystemLogsSource, public UploadList::Delegate { |
| + public: |
| + CrashIdsSource(); |
| + ~CrashIdsSource() override; |
| + |
| + // SystemLogsSource: |
| + void Fetch(const SysLogsSourceCallback& callback) override; |
| + |
| + // UploadList::Delegate: |
| + void OnUploadListAvailable() override; |
| + |
| + private: |
| + void RespondWithCrashIds(const SysLogsSourceCallback& callback) const; |
| + |
| + scoped_refptr<CrashUploadList> crash_upload_list_; |
| + |
| + // A comma-separated list of crash IDs as expected by the server. |
| + std::string crash_ids_list_; |
| + |
| + // Contains any pending fetch requests waiting for the crash upload list to |
| + // finish loading. |
| + using Requests = base::Closure; |
|
Rahul Chaturvedi
2016/09/08 19:58:24
This seems, not very useful. base::Closure is bare
afakhry
2016/09/09 22:20:10
Makes sense ... Done.
|
| + std::vector<Requests> pending_requests_; |
| + |
| + // True if the crash list is currently being loaded. |
| + bool pending_crash_list_loading_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CrashIdsSource); |
| +}; |
| + |
| +} // namespace system_logs |
| + |
| +#endif // CHROME_BROWSER_FEEDBACK_SYSTEM_LOGS_LOG_SOURCES_CRASH_IDS_SOURCE_H_ |