system_logs_source.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_SOURCE_H_
  5. #define COMPONENTS_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_SOURCE_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/callback.h"
  9. #include "components/feedback/feedback_common.h"
  10. namespace system_logs {
  11. using SystemLogsResponse = FeedbackCommon::SystemLogsMap;
  12. // Callback that the data sources use to return data. The data must not be null.
  13. using SysLogsSourceCallback =
  14. base::OnceCallback<void(std::unique_ptr<SystemLogsResponse>)>;
  15. // The SystemLogsSource provides an interface for the data sources that
  16. // the SystemLogsFetcher class uses to fetch logs and other information.
  17. class SystemLogsSource {
  18. public:
  19. // |source_name| provides a descriptive identifier for debugging.
  20. explicit SystemLogsSource(const std::string& source_name);
  21. virtual ~SystemLogsSource();
  22. // Fetches data and passes it by pointer to the callback
  23. virtual void Fetch(SysLogsSourceCallback callback) = 0;
  24. const std::string& source_name() const { return source_name_; }
  25. private:
  26. std::string source_name_;
  27. };
  28. } // namespace system_logs
  29. #endif // COMPONENTS_FEEDBACK_SYSTEM_LOGS_SYSTEM_LOGS_SOURCE_H_