0
Files
src/components/ntp_snippets/callbacks.h
Dan Harrington 343f6d9f44 Change ImageFetcher API
There is a need to fetch images without decoding them, so the
ImageFetcher's API was modified to allow callbacks for
image data and/or the decoded image. This made the ImageFetcherDelegate
superfluous and confusing, so it was removed.

Bug: 794828
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I809a692f5ee55fbe101adbb33210f456a4fdb27d
Reviewed-on: https://chromium-review.googlesource.com/955958
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544100}
2018-03-19 19:11:16 +00:00

43 lines
1.3 KiB
C++

// 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 COMPONENTS_NTP_SNIPPETS_CALLBACKS_H_
#define COMPONENTS_NTP_SNIPPETS_CALLBACKS_H_
#include <string>
#include <vector>
#include "base/callback_forward.h"
namespace gfx {
class Image;
} // namespace gfx
namespace ntp_snippets {
class ContentSuggestion;
struct Status;
// Returns the result of a |Fetch| call by a ContentSuggestionsProvider.
using FetchDoneCallback =
base::OnceCallback<void(Status status_code,
std::vector<ContentSuggestion> suggestions)>;
// Returns the resulting image of a |FetchSuggestionImage| call by a
// ContentSuggestionsProvider.
using ImageFetchedCallback = base::OnceCallback<void(const gfx::Image&)>;
using ImageDataFetchedCallback =
base::OnceCallback<void(const std::string& image_data)>;
// Returns the list of dismissed suggestions when invoked. Currently only used
// for debugging methods to check the internal state of a provider.
using DismissedSuggestionsCallback = base::OnceCallback<void(
std::vector<ContentSuggestion> dismissed_suggestions)>;
} // namespace ntp_snippets
#endif // COMPONENTS_NTP_SNIPPETS_CALLBACKS_H_