| 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 <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // An implementation of the BrowsingDataFileSystemHelper interface that can | 90 // An implementation of the BrowsingDataFileSystemHelper interface that can |
| 91 // be manually populated with data, rather than fetching data from the file | 91 // be manually populated with data, rather than fetching data from the file |
| 92 // systems created in a particular Profile. | 92 // systems created in a particular Profile. |
| 93 class CannedBrowsingDataFileSystemHelper | 93 class CannedBrowsingDataFileSystemHelper |
| 94 : public BrowsingDataFileSystemHelper { | 94 : public BrowsingDataFileSystemHelper { |
| 95 public: | 95 public: |
| 96 // |profile| is unused in this canned implementation, but it's the interface | 96 // |profile| is unused in this canned implementation, but it's the interface |
| 97 // we're writing to, so we'll accept it, but not store it. | 97 // we're writing to, so we'll accept it, but not store it. |
| 98 explicit CannedBrowsingDataFileSystemHelper(Profile* profile); | 98 explicit CannedBrowsingDataFileSystemHelper(Profile* profile); |
| 99 | 99 |
| 100 // Creates a copy of the file system helper. StartFetching can only respond | |
| 101 // to one client at a time; we need to be able to act on multiple parallel | |
| 102 // requests in certain situations (see CookiesTreeModel and its clients). For | |
| 103 // these cases, simply clone the object and fire off another fetching process. | |
| 104 // | |
| 105 // Clone() is safe to call while StartFetching() is running. Clients of the | |
| 106 // newly created object must themselves execute StartFetching(), however: the | |
| 107 // copy will not have a pending fetch. | |
| 108 CannedBrowsingDataFileSystemHelper* Clone(); | |
| 109 | |
| 110 // Manually adds a filesystem to the set of canned file systems that this | 100 // Manually adds a filesystem to the set of canned file systems that this |
| 111 // helper returns via StartFetching. If an origin contains both a temporary | 101 // helper returns via StartFetching. If an origin contains both a temporary |
| 112 // and a persistent filesystem, AddFileSystem must be called twice (once for | 102 // and a persistent filesystem, AddFileSystem must be called twice (once for |
| 113 // each file system type). | 103 // each file system type). |
| 114 void AddFileSystem(const GURL& origin, | 104 void AddFileSystem(const GURL& origin, |
| 115 storage::FileSystemType type, | 105 storage::FileSystemType type, |
| 116 int64 size); | 106 int64 size); |
| 117 | 107 |
| 118 // Clear this helper's list of canned filesystems. | 108 // Clear this helper's list of canned filesystems. |
| 119 void Reset(); | 109 void Reset(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 133 virtual void StartFetching(const base::Callback< | 123 virtual void StartFetching(const base::Callback< |
| 134 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; | 124 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; |
| 135 | 125 |
| 136 // Note that this doesn't actually have an implementation for this canned | 126 // Note that this doesn't actually have an implementation for this canned |
| 137 // class. It hasn't been necessary for anything that uses the canned | 127 // class. It hasn't been necessary for anything that uses the canned |
| 138 // implementation, as the canned class is only used in tests, or in read-only | 128 // implementation, as the canned class is only used in tests, or in read-only |
| 139 // contexts (like the non-modal cookie dialog). | 129 // contexts (like the non-modal cookie dialog). |
| 140 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE {} | 130 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE {} |
| 141 | 131 |
| 142 private: | 132 private: |
| 143 // Used by Clone() to create an object without a Profile | |
| 144 CannedBrowsingDataFileSystemHelper(); | |
| 145 virtual ~CannedBrowsingDataFileSystemHelper(); | 133 virtual ~CannedBrowsingDataFileSystemHelper(); |
| 146 | 134 |
| 147 // Holds the current list of filesystems returned to the client. | 135 // Holds the current list of filesystems returned to the client. |
| 148 std::list<FileSystemInfo> file_system_info_; | 136 std::list<FileSystemInfo> file_system_info_; |
| 149 | 137 |
| 150 // The callback passed in at the beginning of the StartFetching workflow so | 138 // The callback passed in at the beginning of the StartFetching workflow so |
| 151 // that it can be triggered via NotifyOnUIThread. | 139 // that it can be triggered via NotifyOnUIThread. |
| 152 base::Callback<void(const std::list<FileSystemInfo>&)> completion_callback_; | 140 base::Callback<void(const std::list<FileSystemInfo>&)> completion_callback_; |
| 153 | 141 |
| 154 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); | 142 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); |
| 155 }; | 143 }; |
| 156 | 144 |
| 157 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 145 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
| OLD | NEW |