logger_impl.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2020 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_QUERY_TILES_INTERNAL_LOGGER_IMPL_H_
  5. #define COMPONENTS_QUERY_TILES_INTERNAL_LOGGER_IMPL_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "components/query_tiles/logger.h"
  8. #include "base/observer_list.h"
  9. #include "components/query_tiles/internal/log_sink.h"
  10. #include "components/query_tiles/internal/log_source.h"
  11. namespace query_tiles {
  12. class LoggerImpl : public Logger, public LogSink {
  13. public:
  14. LoggerImpl();
  15. ~LoggerImpl() override;
  16. void SetLogSource(LogSource* log_source);
  17. private:
  18. // Logger implementation.
  19. void AddObserver(Observer* observer) override;
  20. void RemoveObserver(Observer* observer) override;
  21. base::Value GetServiceStatus() override;
  22. base::Value GetTileData() override;
  23. // LogSink implementation.
  24. void OnServiceStatusChanged() override;
  25. void OnTileDataAvailable() override;
  26. raw_ptr<LogSource> log_source_{nullptr};
  27. base::ObserverList<Observer>::Unchecked observers_;
  28. };
  29. } // namespace query_tiles
  30. #endif // COMPONENTS_QUERY_TILES_INTERNAL_LOGGER_IMPL_H_