summaryrefslogtreecommitdiff
path: root/chromium/components/image_fetcher/core/image_fetcher_delegate.h
blob: fd9c362fcb97347526c2c83a2b1e4395493c0d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2014 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_IMAGE_FETCHER_CORE_IMAGE_FETCHER_DELEGATE_H_
#define COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_DELEGATE_H_

#include <string>

#include "base/macros.h"

namespace gfx {
class Image;
}

namespace image_fetcher {

class ImageFetcherDelegate {
 public:
  ImageFetcherDelegate() {}

  // Called when the data for an image was fetched. |id| is an identifier for
  // the fetch (as passed to ImageFetcher::StartOrQueueNetworkRequest); |data|
  // stores (generally compressed) image data owned by the caller, and can be
  // empty if the fetch failed.
  virtual void OnImageDataFetched(const std::string& id,
                                  const std::string& data) {}

  // Called when an image was fetched and decoded. |id| is an identifier for the
  // fetch (as passed to ImageFetcher::StartOrQueueNetworkRequest); |image|
  // stores image data owned by the caller, and can be an empty gfx::Image.
  virtual void OnImageFetched(const std::string& id, const gfx::Image& image) {}

 protected:
  virtual ~ImageFetcherDelegate() {}

  DISALLOW_COPY_AND_ASSIGN(ImageFetcherDelegate);
};

}  // namespace image_fetcher

#endif  // COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_DELEGATE_H_