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

Unified Diff: content/browser/indexed_db/indexed_db_blob_info.h

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge fixes [builds, untested] Created 7 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_blob_info.h
diff --git a/content/browser/indexed_db/indexed_db_blob_info.h b/content/browser/indexed_db/indexed_db_blob_info.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d50279c226ca17f4d358ec9e5f703f13af39515
--- /dev/null
+++ b/content/browser/indexed_db/indexed_db_blob_info.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_
+#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/time/time.h"
+#include "url/gurl.h"
+#include "webkit/common/blob/shareable_file_reference.h"
+
+namespace content {
+
+class IndexedDBBlobInfo {
+public:
+ typedef webkit_blob::ShareableFileReference::FinalReleaseCallback
+ ReleaseCallback;
+ IndexedDBBlobInfo();
+ IndexedDBBlobInfo(const GURL& url, const string16& type, int64 size);
+ IndexedDBBlobInfo(const base::FilePath& file_path,
+ const string16& file_name,
+ const string16& type);
+ IndexedDBBlobInfo(const string16& type, int64 size, int64 key);
+ IndexedDBBlobInfo(const string16& type,
+ const string16& file_name,
+ int64 key);
+
+ bool is_file() const { return is_file_; }
+ const GURL& url() const { return url_; }
+ const string16& type() const { return type_; }
+ int64 size() const { return size_; }
+ const string16& file_name() const { return file_name_; }
+ int64 key() const { return key_; }
+ const base::FilePath& file_path() const { return file_path_; }
+ const base::Time& last_modified() const { return last_modified_; }
+ const base::Closure& mark_used_callback() const {
+ return mark_used_callback_;
+ }
+ const ReleaseCallback& release_callback() const { return release_callback_; }
+
+ void set_size(int64 size);
+ void set_url(const GURL& url);
+ void set_file_path(const base::FilePath& file_path);
+ void set_last_modified(const base::Time& time);
+ void set_key(int64 key);
+ void set_mark_used_callback(const base::Closure& mark_used_callback);
+ void set_release_callback(const ReleaseCallback& release_callback);
+
+private:
+ bool is_file_;
+ GURL url_; // Always for Blob; sometimes for File.
+ string16 type_; // Mime type.
+ int64 size_; // -1 if unknown for File.
+ string16 file_name_; // Only for File.
+ base::FilePath file_path_; // Only for File.
+ base::Time last_modified_; // Only for File; valid only if size is.
+
+ // Valid only when this comes out of the database.
+ int64 key_;
+ base::Closure mark_used_callback_;
+ ReleaseCallback release_callback_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_

Powered by Google App Engine
This is Rietveld 408576698