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_FILE_SYSTEM_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 // Clear this helper's list of canned filesystems. | 127 // Clear this helper's list of canned filesystems. |
128 void Reset(); | 128 void Reset(); |
129 | 129 |
130 // True if no filesystems are currently stored. | 130 // True if no filesystems are currently stored. |
131 bool empty() const; | 131 bool empty() const; |
132 | 132 |
133 // Returns the number of currently stored filesystems. | 133 // Returns the number of currently stored filesystems. |
134 size_t GetFileSystemCount() const; | 134 size_t GetFileSystemCount() const; |
135 | 135 |
| 136 // Returns the current list of filesystems. |
| 137 const std::list<FileSystemInfo>& GetFileSystemInfo() { |
| 138 return file_system_info_; |
| 139 } |
| 140 |
136 // BrowsingDataFileSystemHelper implementation. | 141 // BrowsingDataFileSystemHelper implementation. |
137 virtual void StartFetching(const base::Callback< | 142 virtual void StartFetching(const base::Callback< |
138 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; | 143 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; |
139 | 144 |
140 // Note that this doesn't actually have an implementation for this canned | 145 // Note that this doesn't actually have an implementation for this canned |
141 // class. It hasn't been necessary for anything that uses the canned | 146 // class. It hasn't been necessary for anything that uses the canned |
142 // implementation, as the canned class is only used in tests, or in read-only | 147 // implementation, as the canned class is only used in tests, or in read-only |
143 // contexts (like the non-modal cookie dialog). | 148 // contexts (like the non-modal cookie dialog). |
144 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE {} | 149 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE {} |
145 | 150 |
146 private: | 151 private: |
147 // Used by Clone() to create an object without a Profile | 152 // Used by Clone() to create an object without a Profile |
148 CannedBrowsingDataFileSystemHelper(); | 153 CannedBrowsingDataFileSystemHelper(); |
149 virtual ~CannedBrowsingDataFileSystemHelper(); | 154 virtual ~CannedBrowsingDataFileSystemHelper(); |
150 | 155 |
151 // Triggers the success callback as the end of a StartFetching workflow. This | 156 // Triggers the success callback as the end of a StartFetching workflow. This |
152 // must be called on the UI thread. | 157 // must be called on the UI thread. |
153 void NotifyOnUIThread(); | 158 void NotifyOnUIThread(); |
154 | 159 |
155 // Holds the current list of file systems returned to the client after | 160 // Holds the current list of filesystems returned to the client. Access to |
156 // StartFetching is called. | 161 // |file_system_info_| is triggered indirectly via the UI thread and guarded |
| 162 // by |is_fetching_|. This means |file_system_info_| is only accessed while |
| 163 // |is_fetching_| is true. The flag |is_fetching_| is only accessed on the UI |
| 164 // thread. |
157 std::list<FileSystemInfo> file_system_info_; | 165 std::list<FileSystemInfo> file_system_info_; |
158 | 166 |
159 // The callback passed in at the beginning of the StartFetching workflow so | 167 // The callback passed in at the beginning of the StartFetching workflow so |
160 // that it can be triggered via NotifyOnUIThread. | 168 // that it can be triggered via NotifyOnUIThread. |
161 base::Callback<void(const std::list<FileSystemInfo>&)> completion_callback_; | 169 base::Callback<void(const std::list<FileSystemInfo>&)> completion_callback_; |
162 | 170 |
163 // Indicates whether or not we're currently fetching information: set to true | 171 // Indicates whether or not we're currently fetching information: set to true |
164 // when StartFetching is called on the UI thread, and reset to false when | 172 // when StartFetching is called on the UI thread, and reset to false when |
165 // NotifyOnUIThread triggers the success callback. | 173 // NotifyOnUIThread triggers the success callback. |
166 // This property only mutates on the UI thread. | 174 // This property only mutates on the UI thread. |
167 bool is_fetching_; | 175 bool is_fetching_; |
168 | 176 |
169 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); | 177 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataFileSystemHelper); |
170 }; | 178 }; |
171 | 179 |
172 #endif // CHROME_BROWSER_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 180 #endif // CHROME_BROWSER_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
OLD | NEW |