| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time.h" |
| 12 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 13 | 15 #include "googleurl/src/gurl.h" |
| 14 class GURL; | |
| 15 | |
| 16 namespace base { | |
| 17 class Time; | |
| 18 } | |
| 19 | 16 |
| 20 namespace content { | 17 namespace content { |
| 21 | 18 |
| 19 struct IndexedDBInfo { |
| 20 GURL origin; |
| 21 int64 size; |
| 22 base::Time last_modified; |
| 23 }; |
| 24 |
| 22 // Represents the per-BrowserContext IndexedDB data. | 25 // Represents the per-BrowserContext IndexedDB data. |
| 23 // Call these methods only on the WebKit thread. | 26 // Call these methods only on the WebKit thread. |
| 24 class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { | 27 class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> { |
| 25 public: | 28 public: |
| 29 |
| 26 // Methods used in response to QuotaManager requests. | 30 // Methods used in response to QuotaManager requests. |
| 27 virtual std::vector<GURL> GetAllOrigins() = 0; | 31 virtual std::vector<GURL> GetAllOrigins() = 0; |
| 32 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() = 0; |
| 28 virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0; | 33 virtual int64 GetOriginDiskUsage(const GURL& origin_url) = 0; |
| 29 virtual base::Time GetOriginLastModified(const GURL& origin_url) = 0; | 34 virtual base::Time GetOriginLastModified(const GURL& origin_url) = 0; |
| 30 | 35 |
| 31 // Deletes all indexed db files for the given origin. | 36 // Deletes all indexed db files for the given origin. |
| 32 virtual void DeleteForOrigin(const GURL& origin_url) = 0; | 37 virtual void DeleteForOrigin(const GURL& origin_url) = 0; |
| 33 | 38 |
| 34 // Get the file name of the local storage file for the given origin. | 39 // Get the file name of the local storage file for the given origin. |
| 35 virtual base::FilePath GetFilePathForTesting( | 40 virtual base::FilePath GetFilePathForTesting( |
| 36 const string16& origin_id) const = 0; | 41 const string16& origin_id) const = 0; |
| 37 | 42 |
| 38 protected: | 43 protected: |
| 39 friend class base::RefCountedThreadSafe<IndexedDBContext>; | 44 friend class base::RefCountedThreadSafe<IndexedDBContext>; |
| 40 virtual ~IndexedDBContext() {} | 45 virtual ~IndexedDBContext() {} |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 } // namespace content | 48 } // namespace content |
| 44 | 49 |
| 45 #endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ | 50 #endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_ |
| OLD | NEW |