OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/time/time.h" |
| 11 #include "url/gurl.h" |
| 12 #include "webkit/common/blob/shareable_file_reference.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class IndexedDBBlobInfo { |
| 17 public: |
| 18 typedef webkit_blob::ShareableFileReference::FinalReleaseCallback |
| 19 ReleaseCallback; |
| 20 IndexedDBBlobInfo(); |
| 21 IndexedDBBlobInfo(const GURL& url, const string16& type, int64 size); |
| 22 IndexedDBBlobInfo(const base::FilePath& file_path, |
| 23 const string16& file_name, |
| 24 const string16& type); |
| 25 IndexedDBBlobInfo(const string16& type, int64 size, int64 key); |
| 26 IndexedDBBlobInfo(const string16& type, |
| 27 const string16& file_name, |
| 28 int64 key); |
| 29 |
| 30 bool is_file() const { return is_file_; } |
| 31 const GURL& url() const { return url_; } |
| 32 const string16& type() const { return type_; } |
| 33 int64 size() const { return size_; } |
| 34 const string16& file_name() const { return file_name_; } |
| 35 int64 key() const { return key_; } |
| 36 const base::FilePath& file_path() const { return file_path_; } |
| 37 const base::Time& last_modified() const { return last_modified_; } |
| 38 const base::Closure& mark_used_callback() const { |
| 39 return mark_used_callback_; |
| 40 } |
| 41 const ReleaseCallback& release_callback() const { return release_callback_; } |
| 42 |
| 43 void set_size(int64 size); |
| 44 void set_url(const GURL& url); |
| 45 void set_file_path(const base::FilePath& file_path); |
| 46 void set_last_modified(const base::Time& time); |
| 47 void set_key(int64 key); |
| 48 void set_mark_used_callback(const base::Closure& mark_used_callback); |
| 49 void set_release_callback(const ReleaseCallback& release_callback); |
| 50 |
| 51 private: |
| 52 bool is_file_; |
| 53 GURL url_; // Always for Blob; sometimes for File. |
| 54 string16 type_; // Mime type. |
| 55 int64 size_; // -1 if unknown for File. |
| 56 string16 file_name_; // Only for File. |
| 57 base::FilePath file_path_; // Only for File. |
| 58 base::Time last_modified_; // Only for File; valid only if size is. |
| 59 |
| 60 // Valid only when this comes out of the database. |
| 61 int64 key_; |
| 62 base::Closure mark_used_callback_; |
| 63 ReleaseCallback release_callback_; |
| 64 }; |
| 65 |
| 66 } // namespace content |
| 67 |
| 68 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ |
OLD | NEW |