1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_IMAGE_ENCODERS_IMAGE_ENCODER_UTILS_H_
6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_IMAGE_ENCODERS_IMAGE_ENCODER_UTILS_H_
7 
8 #include "third_party/blink/renderer/platform/graphics/graphics_types.h"
9 #include "third_party/blink/renderer/platform/platform_export.h"
10 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
11 #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
12 
13 namespace blink {
14 
15 class PLATFORM_EXPORT ImageEncoderUtils {
16   STATIC_ONLY(ImageEncoderUtils);
17 
18  public:
19   enum EncodeReason {
20     kEncodeReasonToDataURL = 0,
21     kEncodeReasonToBlobCallback = 1,
22     kEncodeReasonConvertToBlobPromise = 2,
23     kNumberOfEncodeReasons
24   };
25 
26   // Default image mime type for toDataURL and toBlob functions
27   static const char kDefaultRequestedMimeType[];
28   static const ImageEncodingMimeType kDefaultEncodingMimeType;
29 
30   static ImageEncodingMimeType ToEncodingMimeType(const String&,
31                                                   const EncodeReason);
32 };
33 
34 }  // namespace blink
35 
36 #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_IMAGE_ENCODERS_IMAGE_ENCODER_UTILS_H_
37