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 CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "webkit/fileapi/file_system_types.h" | 19 #include "webkit/fileapi/file_system_types.h" |
20 | 20 |
| 21 namespace fileapi { |
| 22 class FileSystemContext; |
| 23 } |
| 24 |
21 class Profile; | 25 class Profile; |
22 | 26 |
23 // Defines an interface for classes that deal with aggregating and deleting | 27 // Defines an interface for classes that deal with aggregating and deleting |
24 // browsing data stored in an origin's file systems. | 28 // browsing data stored in an origin's file systems. |
25 // BrowsingDataFileSystemHelper instances for a specific profile should be | 29 // BrowsingDataFileSystemHelper instances for a specific profile should be |
26 // created via the static Create method. Each instance will lazily fetch file | 30 // created via the static Create method. Each instance will lazily fetch file |
27 // system data when a client calls StartFetching from the UI thread, and will | 31 // system data when a client calls StartFetching from the UI thread, and will |
28 // notify the client via a supplied callback when the data is available. | 32 // notify the client via a supplied callback when the data is available. |
29 // Only one StartFetching task can run at a time: executing StartFetching while | 33 // Only one StartFetching task can run at a time: executing StartFetching while |
30 // another StartFetching task is running will DCHECK. | 34 // another StartFetching task is running will DCHECK. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 int64 usage_temporary; | 67 int64 usage_temporary; |
64 }; | 68 }; |
65 | 69 |
66 // Creates a BrowsingDataFileSystemHelper instance for the file systems | 70 // Creates a BrowsingDataFileSystemHelper instance for the file systems |
67 // stored in |profile|'s user data directory. The BrowsingDataFileSystemHelper | 71 // stored in |profile|'s user data directory. The BrowsingDataFileSystemHelper |
68 // object will hold a reference to the Profile that's passed in, but is not | 72 // object will hold a reference to the Profile that's passed in, but is not |
69 // responsible for destroying it. | 73 // responsible for destroying it. |
70 // | 74 // |
71 // The BrowsingDataFileSystemHelper will not change the profile itself, but | 75 // The BrowsingDataFileSystemHelper will not change the profile itself, but |
72 // can modify data it contains (by removing file systems). | 76 // can modify data it contains (by removing file systems). |
73 static BrowsingDataFileSystemHelper* Create(Profile* profile); | 77 static BrowsingDataFileSystemHelper* Create( |
| 78 fileapi::FileSystemContext* file_system_context); |
74 | 79 |
75 // Starts the process of fetching file system data, which will call |callback| | 80 // Starts the process of fetching file system data, which will call |callback| |
76 // upon completion, passing it a constant list of FileSystemInfo objects. | 81 // upon completion, passing it a constant list of FileSystemInfo objects. |
77 // StartFetching must be called only in the UI thread; the provided Callback1 | 82 // StartFetching must be called only in the UI thread; the provided Callback1 |
78 // will likewise be executed asynchronously on the UI thread. | 83 // will likewise be executed asynchronously on the UI thread. |
79 // | 84 // |
80 // BrowsingDataFileSystemHelper takes ownership of the Callback1, and is | 85 // BrowsingDataFileSystemHelper takes ownership of the Callback1, and is |
81 // responsible for deleting it once it's no longer needed. | 86 // responsible for deleting it once it's no longer needed. |
82 virtual void StartFetching(const base::Callback< | 87 virtual void StartFetching(const base::Callback< |
83 void(const std::list<FileSystemInfo>&)>& callback) = 0; | 88 void(const std::list<FileSystemInfo>&)>& callback) = 0; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Indicates whether or not we're currently fetching information: set to true | 174 // Indicates whether or not we're currently fetching information: set to true |
170 // when StartFetching is called on the UI thread, and reset to false when | 175 // when StartFetching is called on the UI thread, and reset to false when |
171 // NotifyOnUIThread triggers the success callback. | 176 // NotifyOnUIThread triggers the success callback. |
172 // This property only mutates on the UI thread. | 177 // This property only mutates on the UI thread. |
173 bool is_fetching_; | 178 bool is_fetching_; |
174 | 179 |
175 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); | 180 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); |
176 }; | 181 }; |
177 | 182 |
178 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 183 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
OLD | NEW |