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/string16.h" | 11 #include "base/string16.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 | 14 |
15 class FilePath; | 15 class FilePath; |
16 | 16 |
17 namespace base { | 17 namespace base { |
| 18 class SequencedTaskRunner; |
18 class Time; | 19 class Time; |
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 // Call these methods only on the WebKit thread. | 27 // Call these methods only on tasks scheduled via it's task_runner(). |
27 class DOMStorageContext : public base::RefCountedThreadSafe<DOMStorageContext> { | 28 class DOMStorageContext : public base::RefCountedThreadSafe<DOMStorageContext> { |
28 public: | 29 public: |
29 virtual ~DOMStorageContext() {} | 30 virtual ~DOMStorageContext() {} |
30 | 31 |
| 32 // Returns a task runner which should be used to schedule tasks |
| 33 // which can invoke the other methods of this interface. |
| 34 virtual base::SequencedTaskRunner* task_runner() const = 0; |
| 35 |
31 // Returns all the file paths of local storage files. | 36 // Returns all the file paths of local storage files. |
32 virtual std::vector<FilePath> GetAllStorageFiles() = 0; | 37 virtual std::vector<FilePath> GetAllStorageFiles() = 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 FilePath GetFilePath(const string16& origin_id) const = 0; | 40 virtual FilePath GetFilePath(const string16& origin_id) const = 0; |
36 | 41 |
37 // Deletes the local storage file for the given origin. | 42 // Deletes the local storage file for the given origin. |
38 virtual void DeleteForOrigin(const string16& origin_id) = 0; | 43 virtual void DeleteForOrigin(const string16& origin_id) = 0; |
39 | 44 |
40 // Deletes a single local storage file. | 45 // Deletes a single local storage file. |
41 virtual void DeleteLocalStorageFile(const FilePath& file_path) = 0; | 46 virtual void DeleteLocalStorageFile(const FilePath& file_path) = 0; |
42 | 47 |
43 // Delete any local storage files that have been touched since the cutoff | 48 // Delete any local storage files that have been touched since the cutoff |
44 // date that's supplied. Protected origins, per the SpecialStoragePolicy, | 49 // date that's supplied. Protected origins, per the SpecialStoragePolicy, |
45 // are not deleted by this method. | 50 // are not deleted by this method. |
46 virtual void DeleteDataModifiedSince(const base::Time& cutoff) = 0; | 51 virtual void DeleteDataModifiedSince(const base::Time& cutoff) = 0; |
47 }; | 52 }; |
48 | 53 |
49 } // namespace content | 54 } // namespace content |
50 | 55 |
51 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ | 56 #endif // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_ |
OLD | NEW |