Chromium Code Reviews| 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_REMOVER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 // Creates a BrowsingDataRemover to remove browser data from the specified | 115 // Creates a BrowsingDataRemover to remove browser data from the specified |
| 116 // profile in the specified time range. Use Remove to initiate the removal. | 116 // profile in the specified time range. Use Remove to initiate the removal. |
| 117 BrowsingDataRemover(Profile* profile, base::Time delete_begin, | 117 BrowsingDataRemover(Profile* profile, base::Time delete_begin, |
| 118 base::Time delete_end); | 118 base::Time delete_end); |
| 119 | 119 |
| 120 // Creates a BrowsingDataRemover to remove browser data from the specified | 120 // Creates a BrowsingDataRemover to remove browser data from the specified |
| 121 // profile in the specified time range. | 121 // profile in the specified time range. |
| 122 BrowsingDataRemover(Profile* profile, TimePeriod time_period, | 122 BrowsingDataRemover(Profile* profile, TimePeriod time_period, |
| 123 base::Time delete_end); | 123 base::Time delete_end); |
| 124 | 124 |
| 125 // Removes the specified items related to browsing for all origins. | 125 // Removes the specified items related to browsing for all origins that match |
| 126 void Remove(int remove_mask); | 126 // the provided |origin_set_mask| (protected, unprotected, or both). |
|
Bernhard Bauer
2012/05/31 15:57:31
Update the comment now there's a third bit?
Mike West
2012/06/01 13:35:17
Done.
| |
| 127 void Remove(int remove_mask, int origin_set_mask); | |
| 127 | 128 |
| 128 void AddObserver(Observer* observer); | 129 void AddObserver(Observer* observer); |
| 129 void RemoveObserver(Observer* observer); | 130 void RemoveObserver(Observer* observer); |
| 130 | 131 |
| 131 // Called when history deletion is done. | 132 // Called when history deletion is done. |
| 132 void OnHistoryDeletionDone(); | 133 void OnHistoryDeletionDone(); |
| 133 | 134 |
| 134 // Quota managed data uses a different bitmask for types than | 135 // Quota managed data uses a different bitmask for types than |
| 135 // BrowsingDataRemover uses. This method generates that mask. | 136 // BrowsingDataRemover uses. This method generates that mask. |
| 136 static int GenerateQuotaClientMask(int remove_mask); | 137 static int GenerateQuotaClientMask(int remove_mask); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 // WaitableEventWatcher implementation. | 180 // WaitableEventWatcher implementation. |
| 180 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. | 181 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. |
| 181 virtual void OnWaitableEventSignaled( | 182 virtual void OnWaitableEventSignaled( |
| 182 base::WaitableEvent* waitable_event) OVERRIDE; | 183 base::WaitableEvent* waitable_event) OVERRIDE; |
| 183 | 184 |
| 184 // PepperFlashSettingsManager::Client implementation. | 185 // PepperFlashSettingsManager::Client implementation. |
| 185 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, | 186 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, |
| 186 bool success) OVERRIDE; | 187 bool success) OVERRIDE; |
| 187 | 188 |
| 188 // Removes the specified items related to browsing for a specific host. If the | 189 // Removes the specified items related to browsing for a specific host. If the |
| 189 // provided |origin| is empty, data is removed for all origins. If | 190 // provided |origin| is empty, data is removed for all origins. The |
| 190 // |remove_protected_origins| is true, then data is removed even if the origin | 191 // |origin_set_mask| parameter defines the set of origins from which data |
| 191 // is otherwise protected (e.g. as an installed application). | 192 // should be removed (protected, unprotected, or both). |
| 192 void RemoveImpl(int remove_mask, | 193 void RemoveImpl(int remove_mask, |
| 193 const GURL& origin, | 194 const GURL& origin, |
| 194 bool remove_protected_origins); | 195 int origin_set_mask); |
| 195 | 196 |
| 196 // If we're not waiting on anything, notifies observers and deletes this | 197 // If we're not waiting on anything, notifies observers and deletes this |
| 197 // object. | 198 // object. |
| 198 void NotifyAndDeleteIfDone(); | 199 void NotifyAndDeleteIfDone(); |
| 199 | 200 |
| 200 // Callback when the network history has been deleted. Invokes | 201 // Callback when the network history has been deleted. Invokes |
| 201 // NotifyAndDeleteIfDone. | 202 // NotifyAndDeleteIfDone. |
| 202 void ClearedNetworkHistory(); | 203 void ClearedNetworkHistory(); |
| 203 | 204 |
| 204 // Invoked on the IO thread to clear the HostCache, speculative data about | 205 // Invoked on the IO thread to clear the HostCache, speculative data about |
| 205 // subresources on visited sites, and initial navigation history. | 206 // subresources on visited sites, and initial navigation history. |
| 206 void ClearNetworkingHistory(IOThread* io_thread); | 207 void ClearNetworkingHistory(IOThread* io_thread); |
| 207 | 208 |
| 208 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. | 209 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. |
| 209 void ClearedCache(); | 210 void ClearedCache(); |
| 210 | 211 |
| 211 // Invoked on the IO thread to delete from the cache. | 212 // Invoked on the IO thread to delete from the cache. |
| 212 void ClearCacheOnIOThread(); | 213 void ClearCacheOnIOThread(); |
| 213 | 214 |
| 214 // Performs the actual work to delete the cache. | 215 // Performs the actual work to delete the cache. |
| 215 void DoClearCache(int rv); | 216 void DoClearCache(int rv); |
| 216 | 217 |
| 218 // Invoked on the IO thread to delete local storage. | |
| 219 void ClearLocalStorageOnIOThread(); | |
| 220 | |
| 221 // Callback to deal with files gathered in ClearLocalStorageOnIOThread. | |
| 222 void OnGotLocalStorageFiles(const std::vector<FilePath>& files); | |
| 223 | |
| 224 // Callback on deletion of local storage data. Invokes NotifyAndDeleteIfDone. | |
| 225 void OnLocalStorageCleared(); | |
| 226 | |
| 217 // Invoked on the IO thread to delete all storage types managed by the quota | 227 // Invoked on the IO thread to delete all storage types managed by the quota |
| 218 // system: AppCache, Databases, FileSystems. | 228 // system: AppCache, Databases, FileSystems. |
| 219 void ClearQuotaManagedDataOnIOThread(); | 229 void ClearQuotaManagedDataOnIOThread(); |
| 220 | 230 |
| 221 // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the | 231 // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the |
| 222 // core of 'ClearQuotaManagedDataOnIOThread'. | 232 // core of 'ClearQuotaManagedDataOnIOThread'. |
| 223 void OnGotQuotaManagedOrigins(const std::set<GURL>& origins, | 233 void OnGotQuotaManagedOrigins(const std::set<GURL>& origins, |
| 224 quota::StorageType type); | 234 quota::StorageType type); |
| 225 | 235 |
| 226 // Callback responding to deletion of a single quota managed origin's | 236 // Callback responding to deletion of a single quota managed origin's |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 251 void OnClearedServerBoundCerts(); | 261 void OnClearedServerBoundCerts(); |
| 252 | 262 |
| 253 // Calculate the begin time for the deletion range specified by |time_period|. | 263 // Calculate the begin time for the deletion range specified by |time_period|. |
| 254 base::Time CalculateBeginDeleteTime(TimePeriod time_period); | 264 base::Time CalculateBeginDeleteTime(TimePeriod time_period); |
| 255 | 265 |
| 256 // Returns true if we're all done. | 266 // Returns true if we're all done. |
| 257 bool all_done() { | 267 bool all_done() { |
| 258 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 268 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
| 259 !waiting_for_clear_cookies_count_&& | 269 !waiting_for_clear_cookies_count_&& |
| 260 !waiting_for_clear_history_ && | 270 !waiting_for_clear_history_ && |
| 271 !waiting_for_clear_local_storage_ && | |
| 261 !waiting_for_clear_networking_history_ && | 272 !waiting_for_clear_networking_history_ && |
| 262 !waiting_for_clear_server_bound_certs_ && | 273 !waiting_for_clear_server_bound_certs_ && |
| 263 !waiting_for_clear_plugin_data_ && | 274 !waiting_for_clear_plugin_data_ && |
| 264 !waiting_for_clear_quota_managed_data_ && | 275 !waiting_for_clear_quota_managed_data_ && |
| 265 !waiting_for_clear_content_licenses_; | 276 !waiting_for_clear_content_licenses_; |
| 266 } | 277 } |
| 267 | 278 |
| 268 // Setter for removing_; DCHECKs that we can only start removing if we're not | 279 // Setter for removing_; DCHECKs that we can only start removing if we're not |
| 269 // already removing, and vice-versa. | 280 // already removing, and vice-versa. |
| 270 static void set_removing(bool removing); | 281 static void set_removing(bool removing); |
| 271 | 282 |
| 272 content::NotificationRegistrar registrar_; | 283 content::NotificationRegistrar registrar_; |
| 273 | 284 |
| 274 // Profile we're to remove from. | 285 // Profile we're to remove from. |
| 275 Profile* profile_; | 286 Profile* profile_; |
| 276 | 287 |
| 277 // The QuotaManager is owned by the profile; we can use a raw pointer here, | 288 // The QuotaManager is owned by the profile; we can use a raw pointer here, |
| 278 // and rely on the profile to destroy the object whenever it's reasonable. | 289 // and rely on the profile to destroy the object whenever it's reasonable. |
| 279 quota::QuotaManager* quota_manager_; | 290 quota::QuotaManager* quota_manager_; |
| 280 | 291 |
| 292 content::DOMStorageContext* dom_storage_context_; | |
|
Bernhard Bauer
2012/05/31 15:57:31
Can you add a comment who owns this?
Mike West
2012/06/01 13:35:17
Done.
| |
| 293 | |
| 281 // 'Protected' origins are not subject to data removal. | 294 // 'Protected' origins are not subject to data removal. |
| 282 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; | 295 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
| 283 | 296 |
| 284 // Start time to delete from. | 297 // Start time to delete from. |
| 285 const base::Time delete_begin_; | 298 const base::Time delete_begin_; |
| 286 | 299 |
| 287 // End time to delete to. | 300 // End time to delete to. |
| 288 const base::Time delete_end_; | 301 const base::Time delete_end_; |
| 289 | 302 |
| 290 // True if Remove has been invoked. | 303 // True if Remove has been invoked. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 304 // Used to deauthorize content licenses for Pepper Flash. | 317 // Used to deauthorize content licenses for Pepper Flash. |
| 305 scoped_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; | 318 scoped_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; |
| 306 uint32 deauthorize_content_licenses_request_id_; | 319 uint32 deauthorize_content_licenses_request_id_; |
| 307 | 320 |
| 308 // True if we're waiting for various data to be deleted. | 321 // True if we're waiting for various data to be deleted. |
| 309 // These may only be accessed from UI thread in order to avoid races! | 322 // These may only be accessed from UI thread in order to avoid races! |
| 310 bool waiting_for_clear_cache_; | 323 bool waiting_for_clear_cache_; |
| 311 // Non-zero if waiting for cookies to be cleared. | 324 // Non-zero if waiting for cookies to be cleared. |
| 312 int waiting_for_clear_cookies_count_; | 325 int waiting_for_clear_cookies_count_; |
| 313 bool waiting_for_clear_history_; | 326 bool waiting_for_clear_history_; |
| 327 bool waiting_for_clear_local_storage_; | |
| 314 bool waiting_for_clear_networking_history_; | 328 bool waiting_for_clear_networking_history_; |
| 315 bool waiting_for_clear_server_bound_certs_; | 329 bool waiting_for_clear_server_bound_certs_; |
| 316 bool waiting_for_clear_plugin_data_; | 330 bool waiting_for_clear_plugin_data_; |
| 317 bool waiting_for_clear_quota_managed_data_; | 331 bool waiting_for_clear_quota_managed_data_; |
| 318 bool waiting_for_clear_content_licenses_; | 332 bool waiting_for_clear_content_licenses_; |
| 319 | 333 |
| 320 // Tracking how many origins need to be deleted, and whether we're finished | 334 // Tracking how many origins need to be deleted, and whether we're finished |
| 321 // gathering origins. | 335 // gathering origins. |
| 322 int quota_managed_origins_to_delete_count_; | 336 int quota_managed_origins_to_delete_count_; |
| 323 int quota_managed_storage_types_to_delete_count_; | 337 int quota_managed_storage_types_to_delete_count_; |
| 324 | 338 |
| 325 // The removal mask for the current removal operation. | 339 // The removal mask for the current removal operation. |
| 326 int remove_mask_; | 340 int remove_mask_; |
| 327 | 341 |
| 328 // The origin for the current removal operation. | 342 // The origin for the current removal operation. |
| 329 GURL remove_origin_; | 343 GURL remove_origin_; |
| 330 | 344 |
| 331 // Should data for protected origins be removed? | 345 // From which types of origins should we remove data? |
| 332 bool remove_protected_; | 346 int origin_set_mask_; |
| 333 | 347 |
| 334 ObserverList<Observer> observer_list_; | 348 ObserverList<Observer> observer_list_; |
| 335 | 349 |
| 336 // Used if we need to clear history. | 350 // Used if we need to clear history. |
| 337 CancelableRequestConsumer request_consumer_; | 351 CancelableRequestConsumer request_consumer_; |
| 338 | 352 |
| 339 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 353 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 340 }; | 354 }; |
| 341 | 355 |
| 342 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 356 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |