callbacks.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2016 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_NTP_SNIPPETS_CALLBACKS_H_
  5. #define COMPONENTS_NTP_SNIPPETS_CALLBACKS_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/callback_forward.h"
  9. namespace gfx {
  10. class Image;
  11. } // namespace gfx
  12. namespace ntp_snippets {
  13. class ContentSuggestion;
  14. struct Status;
  15. // Returns the result of a |Fetch| call by a ContentSuggestionsProvider.
  16. using FetchDoneCallback =
  17. base::OnceCallback<void(Status status_code,
  18. std::vector<ContentSuggestion> suggestions)>;
  19. // Returns the resulting image of a |FetchSuggestionImage| call by a
  20. // ContentSuggestionsProvider.
  21. using ImageFetchedCallback = base::OnceCallback<void(const gfx::Image&)>;
  22. using ImageDataFetchedCallback =
  23. base::OnceCallback<void(const std::string& image_data)>;
  24. // Returns the list of dismissed suggestions when invoked. Currently only used
  25. // for debugging methods to check the internal state of a provider.
  26. using DismissedSuggestionsCallback = base::OnceCallback<void(
  27. std::vector<ContentSuggestion> dismissed_suggestions)>;
  28. } // namespace ntp_snippets
  29. #endif // COMPONENTS_NTP_SNIPPETS_CALLBACKS_H_