OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
14 #include "storage/browser/blob/shareable_file_reference.h" | 16 #include "storage/browser/blob/shareable_file_reference.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 class CONTENT_EXPORT IndexedDBBlobInfo { | 20 class CONTENT_EXPORT IndexedDBBlobInfo { |
19 public: | 21 public: |
20 typedef storage::ShareableFileReference::FinalReleaseCallback ReleaseCallback; | 22 typedef storage::ShareableFileReference::FinalReleaseCallback ReleaseCallback; |
21 IndexedDBBlobInfo(); | 23 IndexedDBBlobInfo(); |
22 // These two are used for Blobs. | 24 // These two are used for Blobs. |
23 IndexedDBBlobInfo(const std::string& uuid, | 25 IndexedDBBlobInfo(const std::string& uuid, |
24 const base::string16& type, | 26 const base::string16& type, |
25 int64 size); | 27 int64_t size); |
26 IndexedDBBlobInfo(const base::string16& type, int64 size, int64 key); | 28 IndexedDBBlobInfo(const base::string16& type, int64_t size, int64_t key); |
27 // These two are used for Files. | 29 // These two are used for Files. |
28 IndexedDBBlobInfo(const std::string& uuid, | 30 IndexedDBBlobInfo(const std::string& uuid, |
29 const base::FilePath& file_path, | 31 const base::FilePath& file_path, |
30 const base::string16& file_name, | 32 const base::string16& file_name, |
31 const base::string16& type); | 33 const base::string16& type); |
32 IndexedDBBlobInfo(int64 key, | 34 IndexedDBBlobInfo(int64_t key, |
33 const base::string16& type, | 35 const base::string16& type, |
34 const base::string16& file_name); | 36 const base::string16& file_name); |
35 | 37 |
36 IndexedDBBlobInfo(const IndexedDBBlobInfo& other); | 38 IndexedDBBlobInfo(const IndexedDBBlobInfo& other); |
37 ~IndexedDBBlobInfo(); | 39 ~IndexedDBBlobInfo(); |
38 IndexedDBBlobInfo& operator=(const IndexedDBBlobInfo& other); | 40 IndexedDBBlobInfo& operator=(const IndexedDBBlobInfo& other); |
39 | 41 |
40 bool is_file() const { return is_file_; } | 42 bool is_file() const { return is_file_; } |
41 const std::string& uuid() const { return uuid_; } | 43 const std::string& uuid() const { return uuid_; } |
42 const base::string16& type() const { return type_; } | 44 const base::string16& type() const { return type_; } |
43 int64 size() const { return size_; } | 45 int64_t size() const { return size_; } |
44 const base::string16& file_name() const { return file_name_; } | 46 const base::string16& file_name() const { return file_name_; } |
45 int64 key() const { return key_; } | 47 int64_t key() const { return key_; } |
46 const base::FilePath& file_path() const { return file_path_; } | 48 const base::FilePath& file_path() const { return file_path_; } |
47 const base::Time& last_modified() const { return last_modified_; } | 49 const base::Time& last_modified() const { return last_modified_; } |
48 const base::Closure& mark_used_callback() const { | 50 const base::Closure& mark_used_callback() const { |
49 return mark_used_callback_; | 51 return mark_used_callback_; |
50 } | 52 } |
51 const ReleaseCallback& release_callback() const { return release_callback_; } | 53 const ReleaseCallback& release_callback() const { return release_callback_; } |
52 | 54 |
53 void set_size(int64 size); | 55 void set_size(int64_t size); |
54 void set_uuid(const std::string& uuid); | 56 void set_uuid(const std::string& uuid); |
55 void set_file_path(const base::FilePath& file_path); | 57 void set_file_path(const base::FilePath& file_path); |
56 void set_last_modified(const base::Time& time); | 58 void set_last_modified(const base::Time& time); |
57 void set_key(int64 key); | 59 void set_key(int64_t key); |
58 void set_mark_used_callback(const base::Closure& mark_used_callback); | 60 void set_mark_used_callback(const base::Closure& mark_used_callback); |
59 void set_release_callback(const ReleaseCallback& release_callback); | 61 void set_release_callback(const ReleaseCallback& release_callback); |
60 | 62 |
61 private: | 63 private: |
62 bool is_file_; | 64 bool is_file_; |
63 std::string uuid_; // Always for Blob; sometimes for File. | 65 std::string uuid_; // Always for Blob; sometimes for File. |
64 base::string16 type_; // Mime type. | 66 base::string16 type_; // Mime type. |
65 int64 size_; // -1 if unknown for File. | 67 int64_t size_; // -1 if unknown for File. |
66 base::string16 file_name_; // Only for File. | 68 base::string16 file_name_; // Only for File. |
67 base::FilePath file_path_; // Only for File. | 69 base::FilePath file_path_; // Only for File. |
68 base::Time last_modified_; // Only for File; valid only if size is. | 70 base::Time last_modified_; // Only for File; valid only if size is. |
69 | 71 |
70 // Valid only when this comes out of the database. | 72 // Valid only when this comes out of the database. |
71 int64 key_; | 73 int64_t key_; |
72 base::Closure mark_used_callback_; | 74 base::Closure mark_used_callback_; |
73 ReleaseCallback release_callback_; | 75 ReleaseCallback release_callback_; |
74 }; | 76 }; |
75 | 77 |
76 } // namespace content | 78 } // namespace content |
77 | 79 |
78 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ | 80 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
OLD | NEW |