Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DOM_STORAGE_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "googleurl/src/gurl.h" | |
| 14 | 15 |
| 15 class FilePath; | 16 class FilePath; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class Time; | 19 class Time; |
|
michaeln
2012/06/01 01:47:44
i've added the #include for base/time.h locally
| |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 class BrowserContext; | 24 class BrowserContext; |
| 24 | 25 |
| 25 // Represents the per-BrowserContext Local Storage data. | 26 // Represents the per-BrowserContext Local Storage data. |
| 26 class DOMStorageContext { | 27 class DOMStorageContext { |
| 27 public: | 28 public: |
| 29 struct UsageInfo { | |
| 30 GURL origin; | |
| 31 size_t data_size; | |
| 32 base::Time last_modified; | |
| 33 | |
| 34 UsageInfo(); | |
| 35 ~UsageInfo(); | |
| 36 }; | |
| 37 | |
| 38 typedef base::Callback<void(const std::vector<UsageInfo>&)> | |
| 39 GetUsageInfoCallback; | |
| 40 | |
| 41 virtual void GetUsageInfo(const GetUsageInfoCallback& callback) = 0; | |
| 42 virtual void DeleteOrigin(const GURL& origin) = 0; | |
| 43 | |
| 44 // The stuff below is DEPRECATED. | |
| 28 typedef base::Callback<void(const std::vector<FilePath>&)> | 45 typedef base::Callback<void(const std::vector<FilePath>&)> |
| 29 GetAllStorageFilesCallback; | 46 GetAllStorageFilesCallback; |
| 30 | |
| 31 // Returns all the file paths of local storage files to the given callback. | |
| 32 virtual void GetAllStorageFiles( | 47 virtual void GetAllStorageFiles( |
| 33 const GetAllStorageFilesCallback& callback) = 0; | 48 const GetAllStorageFilesCallback& callback) = 0; |
| 34 | |
| 35 // Get the file name of the local storage file for the given origin. | |
| 36 virtual FilePath GetFilePath(const string16& origin_id) const = 0; | 49 virtual FilePath GetFilePath(const string16& origin_id) const = 0; |
| 37 | |
| 38 // Deletes the local storage file for the given origin. | |
| 39 virtual void DeleteForOrigin(const string16& origin_id) = 0; | 50 virtual void DeleteForOrigin(const string16& origin_id) = 0; |
| 40 | |
| 41 // Deletes a single local storage file. | |
| 42 virtual void DeleteLocalStorageFile(const FilePath& file_path) = 0; | 51 virtual void DeleteLocalStorageFile(const FilePath& file_path) = 0; |
| 43 | |
| 44 // Delete any local storage files that have been touched since the cutoff | |
| 45 // date that's supplied. Protected origins, per the SpecialStoragePolicy, | |
| 46 // are not deleted by this method. | |
| 47 virtual void DeleteDataModifiedSince(const base::Time& cutoff) = 0; | 52 virtual void DeleteDataModifiedSince(const base::Time& cutoff) = 0; |
| 48 | 53 |
| 49 protected: | 54 protected: |
| 50 virtual ~DOMStorageContext() {} | 55 virtual ~DOMStorageContext() {} |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 } // namespace content | 58 } // namespace content |
| 54 | 59 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ | 60 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ |
| OLD | NEW |