| Index: content/child/notifications/notification_image_loader.h
|
| diff --git a/content/child/notifications/notification_image_loader.h b/content/child/notifications/notification_image_loader.h
|
| index 14a36dafa72c4398e7a47f0d99b654a034ef52b9..1cbfff73fc2df0e2b58e03e468bc9b438d17d8ac 100644
|
| --- a/content/child/notifications/notification_image_loader.h
|
| +++ b/content/child/notifications/notification_image_loader.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
|
|
|
| +class GURL;
|
| class SkBitmap;
|
|
|
| namespace base {
|
| @@ -26,12 +27,6 @@ class WebURLLoader;
|
|
|
| namespace content {
|
|
|
| -class NotificationImageLoader;
|
| -
|
| -// Callback to be invoked when an image load has been completed.
|
| -using NotificationImageLoadedCallback =
|
| - base::Callback<void(scoped_refptr<NotificationImageLoader>)>;
|
| -
|
| // Downloads the image associated with a notification and decodes the received
|
| // image. This must be completed before notifications are shown to the user.
|
| // Image downloaders must not be re-used for multiple notifications. The image
|
| @@ -40,19 +35,16 @@ using NotificationImageLoadedCallback =
|
| class NotificationImageLoader
|
| : public blink::WebURLLoaderClient,
|
| public base::RefCountedThreadSafe<NotificationImageLoader> {
|
| + using ImageLoadCompletedCallback = base::Callback<void(int, const SkBitmap&)>;
|
| +
|
| public:
|
| - explicit NotificationImageLoader(
|
| - const NotificationImageLoadedCallback& callback);
|
| -
|
| - // Asynchronously starts loading |image_url|.
|
| - // Must be called on the main thread. The callback should be executed by
|
| - // |worker_task_runner|.
|
| - void StartOnMainThread(
|
| - const blink::WebURL& image_url,
|
| + NotificationImageLoader(
|
| + const ImageLoadCompletedCallback& callback,
|
| const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner);
|
|
|
| - // Returns the SkBitmap resulting from decoding the loaded buffer.
|
| - SkBitmap GetDecodedImage() const;
|
| + // Asynchronously starts loading |image_url| using a Blink WebURLLoader. Must
|
| + // only be called on the main thread.
|
| + void StartOnMainThread(int notification_id, const GURL& image_url);
|
|
|
| // blink::WebURLLoaderClient implementation.
|
| virtual void didReceiveData(blink::WebURLLoader* loader,
|
| @@ -74,13 +66,16 @@ class NotificationImageLoader
|
| // For all other threads a task will be posted to the appropriate task runner.
|
| void RunCallbackOnWorkerThread();
|
|
|
| - NotificationImageLoadedCallback callback_;
|
| + ImageLoadCompletedCallback callback_;
|
|
|
| - scoped_ptr<blink::WebURLLoader> url_loader_;
|
| scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_;
|
| scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
|
| +
|
| + int notification_id_;
|
| bool completed_;
|
|
|
| + scoped_ptr<blink::WebURLLoader> url_loader_;
|
| +
|
| std::vector<uint8_t> buffer_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NotificationImageLoader);
|
|
|