Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: Source/platform/blob/BlobInfo.h

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: small cleanup Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef HTMLSrcsetParser_h 31 #ifndef BlobInfo_h
32 #define HTMLSrcsetParser_h 32 #define BlobInfo_h
33 33
34 #include "wtf/text/WTFString.h" 34 #include "wtf/text/WTFString.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class ImageCandidate { 38 class BlobInfo {
39 public: 39 public:
40 ImageCandidate() 40 BlobInfo()
41 : m_scaleFactor(1.0) 41 : m_isFile(false)
42 , m_size(-1)
43 {
44 }
45 BlobInfo(const String& uuid, const String& type, long long size)
46 : m_isFile(false)
47 , m_uuid(uuid)
48 , m_type(type)
49 , m_size(size)
50 , m_lastModified(0)
51 {
52 }
53 BlobInfo(const String& uuid, const String& filePath, const String& fileName, const String& type, double lastModified, long long size)
54 : m_isFile(true)
55 , m_uuid(uuid)
56 , m_type(type)
57 , m_size(size)
58 , m_filePath(filePath)
59 , m_fileName(fileName)
60 , m_lastModified(lastModified)
61 {
62 }
63 BlobInfo(const String& uuid, const String& filePath, const String& fileName, const String& type)
64 : m_isFile(true)
65 , m_uuid(uuid)
66 , m_type(type)
67 , m_size(-1)
68 , m_filePath(filePath)
69 , m_fileName(fileName)
70 , m_lastModified(0)
42 { 71 {
43 } 72 }
44 73
45 ImageCandidate(const String& source, unsigned start, unsigned length, float scaleFactor) 74 bool isFile() const { return m_isFile; }
46 : m_string(source.createView(start, length)) 75 const String& uuid() const { return m_uuid; }
47 , m_scaleFactor(scaleFactor) 76 const String& type() const { return m_type; }
48 { 77 long long size() const { return m_size; }
49 } 78 const String& filePath() const { return m_filePath; }
50 79 const String& fileName() const { return m_fileName; }
51 String toString() const 80 double lastModified() const { return m_lastModified; }
52 {
53 return m_string.toString();
54 }
55
56 inline float scaleFactor() const
57 {
58 return m_scaleFactor;
59 }
60
61 inline bool isEmpty() const
62 {
63 return m_string.isEmpty();
64 }
65 81
66 private: 82 private:
67 StringView m_string; 83 bool m_isFile;
68 float m_scaleFactor; 84 String m_uuid;
85 String m_type; // mime type
86 long long m_size;
87 String m_filePath; // only for File
88 String m_fileName; // only for File
89 double m_lastModified; // only for File
69 }; 90 };
70 91
71 ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, const St ring& srcsetAttribute); 92 } // namespace WebCore
72 93
73 ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, const St ring& srcAttribute, const String& srcsetAttribute); 94 #endif // BlobInfo_h
74
75 String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& sr cAttribute, ImageCandidate& srcsetImageCandidate);
76
77 }
78
79 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698