| Index: third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
|
| diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
|
| index ea0cc3d4a9c541bf763eb3fbcf0b578503130d98..46e6be46c399c734f96f6cb5aea2d0a1a5cde986 100644
|
| --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
|
| +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.h
|
| @@ -10,12 +10,11 @@
|
| #include "modules/ModulesExport.h"
|
| #include "platform/SharedBuffer.h"
|
| #include "platform/heap/Handle.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| #include "wtf/Functional.h"
|
| #include "wtf/RefPtr.h"
|
| #include <memory>
|
|
|
| -class SkBitmap;
|
| -
|
| namespace blink {
|
|
|
| class ExecutionContext;
|
| @@ -28,13 +27,20 @@ class MODULES_EXPORT NotificationImageLoader final
|
| : public GarbageCollectedFinalized<NotificationImageLoader>,
|
| public ThreadableLoaderClient {
|
| public:
|
| + // Type names are used in UMAs, so do not rename.
|
| + enum class Type { Image, Icon, Badge, ActionIcon };
|
| +
|
| // The bitmap may be empty if the request failed or the image data could not
|
| // be decoded.
|
| using ImageCallback = Function<void(const SkBitmap&)>;
|
|
|
| - NotificationImageLoader();
|
| + explicit NotificationImageLoader(Type);
|
| ~NotificationImageLoader() override;
|
|
|
| + // Scales down |image| according to its type and returns result. If it is
|
| + // already small enough, |image| is returned unchanged.
|
| + static SkBitmap scaleDownIfNeeded(const SkBitmap& image, Type);
|
| +
|
| // Asynchronously downloads an image from the given url, decodes the loaded
|
| // data, and passes the bitmap to the callback. Times out if the load takes
|
| // too long and ImageCallback is invoked with an empty bitmap.
|
| @@ -56,6 +62,7 @@ class MODULES_EXPORT NotificationImageLoader final
|
| private:
|
| void runCallbackWithEmptyBitmap();
|
|
|
| + Type m_type;
|
| bool m_stopped;
|
| double m_startTime;
|
| RefPtr<SharedBuffer> m_data;
|
|
|