| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <list> | 11 #include <list> |
| 9 #include <map> | 12 #include <map> |
| 10 | 13 |
| 11 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 13 #include "storage/common/fileapi/file_system_types.h" | 17 #include "storage/common/fileapi/file_system_types.h" |
| 14 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 15 | 19 |
| 16 namespace storage { | 20 namespace storage { |
| 17 class FileSystemContext; | 21 class FileSystemContext; |
| 18 } | 22 } |
| 19 | 23 |
| 20 class Profile; | 24 class Profile; |
| 21 | 25 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 public: | 42 public: |
| 39 // Detailed information about a file system, including it's origin GURL, | 43 // Detailed information about a file system, including it's origin GURL, |
| 40 // the amount of data (in bytes) for each sandboxed filesystem type. | 44 // the amount of data (in bytes) for each sandboxed filesystem type. |
| 41 struct FileSystemInfo { | 45 struct FileSystemInfo { |
| 42 explicit FileSystemInfo(const GURL& origin); | 46 explicit FileSystemInfo(const GURL& origin); |
| 43 ~FileSystemInfo(); | 47 ~FileSystemInfo(); |
| 44 | 48 |
| 45 // The origin for which the information is relevant. | 49 // The origin for which the information is relevant. |
| 46 GURL origin; | 50 GURL origin; |
| 47 // FileSystemType to usage (in bytes) map. | 51 // FileSystemType to usage (in bytes) map. |
| 48 std::map<storage::FileSystemType, int64> usage_map; | 52 std::map<storage::FileSystemType, int64_t> usage_map; |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 using FetchCallback = base::Callback<void(const std::list<FileSystemInfo>&)>; | 55 using FetchCallback = base::Callback<void(const std::list<FileSystemInfo>&)>; |
| 52 | 56 |
| 53 // Creates a BrowsingDataFileSystemHelper instance for the file systems | 57 // Creates a BrowsingDataFileSystemHelper instance for the file systems |
| 54 // stored in |profile|'s user data directory. The BrowsingDataFileSystemHelper | 58 // stored in |profile|'s user data directory. The BrowsingDataFileSystemHelper |
| 55 // object will hold a reference to the Profile that's passed in, but is not | 59 // object will hold a reference to the Profile that's passed in, but is not |
| 56 // responsible for destroying it. | 60 // responsible for destroying it. |
| 57 // | 61 // |
| 58 // The BrowsingDataFileSystemHelper will not change the profile itself, but | 62 // The BrowsingDataFileSystemHelper will not change the profile itself, but |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // |profile| is unused in this canned implementation, but it's the interface | 94 // |profile| is unused in this canned implementation, but it's the interface |
| 91 // we're writing to, so we'll accept it, but not store it. | 95 // we're writing to, so we'll accept it, but not store it. |
| 92 explicit CannedBrowsingDataFileSystemHelper(Profile* profile); | 96 explicit CannedBrowsingDataFileSystemHelper(Profile* profile); |
| 93 | 97 |
| 94 // Manually adds a filesystem to the set of canned file systems that this | 98 // Manually adds a filesystem to the set of canned file systems that this |
| 95 // helper returns via StartFetching. If an origin contains both a temporary | 99 // helper returns via StartFetching. If an origin contains both a temporary |
| 96 // and a persistent filesystem, AddFileSystem must be called twice (once for | 100 // and a persistent filesystem, AddFileSystem must be called twice (once for |
| 97 // each file system type). | 101 // each file system type). |
| 98 void AddFileSystem(const GURL& origin, | 102 void AddFileSystem(const GURL& origin, |
| 99 storage::FileSystemType type, | 103 storage::FileSystemType type, |
| 100 int64 size); | 104 int64_t size); |
| 101 | 105 |
| 102 // Clear this helper's list of canned filesystems. | 106 // Clear this helper's list of canned filesystems. |
| 103 void Reset(); | 107 void Reset(); |
| 104 | 108 |
| 105 // True if no filesystems are currently stored. | 109 // True if no filesystems are currently stored. |
| 106 bool empty() const; | 110 bool empty() const; |
| 107 | 111 |
| 108 // Returns the number of currently stored filesystems. | 112 // Returns the number of currently stored filesystems. |
| 109 size_t GetFileSystemCount() const; | 113 size_t GetFileSystemCount() const; |
| 110 | 114 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 125 private: | 129 private: |
| 126 ~CannedBrowsingDataFileSystemHelper() override; | 130 ~CannedBrowsingDataFileSystemHelper() override; |
| 127 | 131 |
| 128 // Holds the current list of filesystems returned to the client. | 132 // Holds the current list of filesystems returned to the client. |
| 129 std::list<FileSystemInfo> file_system_info_; | 133 std::list<FileSystemInfo> file_system_info_; |
| 130 | 134 |
| 131 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); | 135 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 138 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
| OLD | NEW |