summaryrefslogtreecommitdiff
path: root/chromium/components/image_fetcher
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/components/image_fetcher
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/image_fetcher')
-rw-r--r--chromium/components/image_fetcher/BUILD.gn15
-rw-r--r--chromium/components/image_fetcher/DEPS3
-rw-r--r--chromium/components/image_fetcher/OWNERS2
-rw-r--r--chromium/components/image_fetcher/image_fetcher.h41
-rw-r--r--chromium/components/image_fetcher/image_fetcher_delegate.h35
5 files changed, 96 insertions, 0 deletions
diff --git a/chromium/components/image_fetcher/BUILD.gn b/chromium/components/image_fetcher/BUILD.gn
new file mode 100644
index 00000000000..ffb753a412b
--- /dev/null
+++ b/chromium/components/image_fetcher/BUILD.gn
@@ -0,0 +1,15 @@
+# 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.
+
+source_set("image_fetcher") {
+ sources = [
+ "image_fetcher.h",
+ "image_fetcher_delegate.h",
+ ]
+
+ public_deps = [
+ "//base",
+ "//url",
+ ]
+}
diff --git a/chromium/components/image_fetcher/DEPS b/chromium/components/image_fetcher/DEPS
new file mode 100644
index 00000000000..674b34dfca8
--- /dev/null
+++ b/chromium/components/image_fetcher/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+url",
+]
diff --git a/chromium/components/image_fetcher/OWNERS b/chromium/components/image_fetcher/OWNERS
new file mode 100644
index 00000000000..f5f6196034d
--- /dev/null
+++ b/chromium/components/image_fetcher/OWNERS
@@ -0,0 +1,2 @@
+mathp@chromium.org
+treib@chromium.org
diff --git a/chromium/components/image_fetcher/image_fetcher.h b/chromium/components/image_fetcher/image_fetcher.h
new file mode 100644
index 00000000000..812067608fa
--- /dev/null
+++ b/chromium/components/image_fetcher/image_fetcher.h
@@ -0,0 +1,41 @@
+// 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_IMAGE_FETCHER_H_
+#define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "components/image_fetcher/image_fetcher_delegate.h"
+#include "url/gurl.h"
+
+namespace gfx {
+class Image;
+}
+
+namespace image_fetcher {
+
+// A class used to fetch server images. It can be called from any thread and the
+// callback will be called on the thread which initiated the fetch.
+class ImageFetcher {
+ public:
+ ImageFetcher() {}
+ virtual ~ImageFetcher() {}
+
+ virtual void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) = 0;
+
+ // An empty gfx::Image will be returned to the callback in case the image
+ // could not be fetched.
+ virtual void StartOrQueueNetworkRequest(
+ const GURL& url,
+ const GURL& image_url,
+ base::Callback<void(const GURL&, const gfx::Image&)> callback) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ImageFetcher);
+};
+
+} // namespace image_fetcher
+
+#endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_H_
diff --git a/chromium/components/image_fetcher/image_fetcher_delegate.h b/chromium/components/image_fetcher/image_fetcher_delegate.h
new file mode 100644
index 00000000000..dbc9dd65dff
--- /dev/null
+++ b/chromium/components/image_fetcher/image_fetcher_delegate.h
@@ -0,0 +1,35 @@
+// 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_IMAGE_FETCHER_DELEGATE_H_
+#define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_
+
+#include "base/macros.h"
+
+class GURL;
+
+namespace gfx {
+class Image;
+}
+
+namespace image_fetcher {
+
+class ImageFetcherDelegate {
+ public:
+ ImageFetcherDelegate() {}
+
+ // Called when an image was fetched. |url| represents the website for which
+ // the image was fetched. |image| stores image data owned by the caller, and
+ // can be an empty gfx::Image.
+ virtual void OnImageFetched(const GURL& url, const gfx::Image& image) = 0;
+
+ protected:
+ virtual ~ImageFetcherDelegate() {}
+
+ DISALLOW_COPY_AND_ASSIGN(ImageFetcherDelegate);
+};
+
+} // namespace image_fetcher
+
+#endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_DELEGATE_H_