| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 REMOVE_SERVER_BOUND_CERTS = 1 << 12, | 75 REMOVE_SERVER_BOUND_CERTS = 1 << 12, |
| 76 | 76 |
| 77 // "Site data" includes cookies, appcache, file systems, indexedDBs, local | 77 // "Site data" includes cookies, appcache, file systems, indexedDBs, local |
| 78 // storage, webSQL, and plugin data. | 78 // storage, webSQL, and plugin data. |
| 79 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | | 79 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | |
| 80 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | | 80 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | |
| 81 REMOVE_PLUGIN_DATA | REMOVE_WEBSQL | | 81 REMOVE_PLUGIN_DATA | REMOVE_WEBSQL | |
| 82 REMOVE_SERVER_BOUND_CERTS | 82 REMOVE_SERVER_BOUND_CERTS |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 enum OriginSetMask { |
| 86 UNPROTECTED_WEB = 1 << 0, |
| 87 PROTECTED_WEB = 1 << 1, |
| 88 EXTENSION = 1 << 2 |
| 89 }; |
| 90 |
| 85 // When BrowsingDataRemover successfully removes data, a notification of type | 91 // When BrowsingDataRemover successfully removes data, a notification of type |
| 86 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of | 92 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of |
| 87 // this type. | 93 // this type. |
| 88 struct NotificationDetails { | 94 struct NotificationDetails { |
| 89 NotificationDetails(); | 95 NotificationDetails(); |
| 90 NotificationDetails(const NotificationDetails& details); | 96 NotificationDetails(const NotificationDetails& details); |
| 91 NotificationDetails(base::Time removal_begin, | 97 NotificationDetails(base::Time removal_begin, |
| 92 int removal_mask); | 98 int removal_mask); |
| 93 ~NotificationDetails(); | 99 ~NotificationDetails(); |
| 94 | 100 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 112 // Creates a BrowsingDataRemover to remove browser data from the specified | 118 // Creates a BrowsingDataRemover to remove browser data from the specified |
| 113 // profile in the specified time range. Use Remove to initiate the removal. | 119 // profile in the specified time range. Use Remove to initiate the removal. |
| 114 BrowsingDataRemover(Profile* profile, base::Time delete_begin, | 120 BrowsingDataRemover(Profile* profile, base::Time delete_begin, |
| 115 base::Time delete_end); | 121 base::Time delete_end); |
| 116 | 122 |
| 117 // Creates a BrowsingDataRemover to remove browser data from the specified | 123 // Creates a BrowsingDataRemover to remove browser data from the specified |
| 118 // profile in the specified time range. | 124 // profile in the specified time range. |
| 119 BrowsingDataRemover(Profile* profile, TimePeriod time_period, | 125 BrowsingDataRemover(Profile* profile, TimePeriod time_period, |
| 120 base::Time delete_end); | 126 base::Time delete_end); |
| 121 | 127 |
| 122 // Removes the specified items related to browsing for all origins. | 128 // Removes the specified items related to browsing for all origins that match |
| 123 void Remove(int remove_mask); | 129 // the provided |origin_set_mask| (protected, unprotected, or both). |
| 130 void Remove(int remove_mask, int origin_set_mask); |
| 124 | 131 |
| 125 void AddObserver(Observer* observer); | 132 void AddObserver(Observer* observer); |
| 126 void RemoveObserver(Observer* observer); | 133 void RemoveObserver(Observer* observer); |
| 127 | 134 |
| 128 // Called when history deletion is done. | 135 // Called when history deletion is done. |
| 129 void OnHistoryDeletionDone(); | 136 void OnHistoryDeletionDone(); |
| 130 | 137 |
| 131 // Quota managed data uses a different bitmask for types than | 138 // Quota managed data uses a different bitmask for types than |
| 132 // BrowsingDataRemover uses. This method generates that mask. | 139 // BrowsingDataRemover uses. This method generates that mask. |
| 133 static int GenerateQuotaClientMask(int remove_mask); | 140 static int GenerateQuotaClientMask(int remove_mask); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 virtual void Observe(int type, | 179 virtual void Observe(int type, |
| 173 const content::NotificationSource& source, | 180 const content::NotificationSource& source, |
| 174 const content::NotificationDetails& details) OVERRIDE; | 181 const content::NotificationDetails& details) OVERRIDE; |
| 175 | 182 |
| 176 // WaitableEventWatcher implementation. | 183 // WaitableEventWatcher implementation. |
| 177 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. | 184 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. |
| 178 virtual void OnWaitableEventSignaled( | 185 virtual void OnWaitableEventSignaled( |
| 179 base::WaitableEvent* waitable_event) OVERRIDE; | 186 base::WaitableEvent* waitable_event) OVERRIDE; |
| 180 | 187 |
| 181 // Removes the specified items related to browsing for a specific host. If the | 188 // Removes the specified items related to browsing for a specific host. If the |
| 182 // provided |origin| is empty, data is removed for all origins. If | 189 // provided |origin| is empty, data is removed for all origins. The |
| 183 // |remove_protected_origins| is true, then data is removed even if the origin | 190 // |origin_set_mask| parameter defines the set of origins from which data |
| 184 // is otherwise protected (e.g. as an installed application). | 191 // should be removed (protected, unprotected, or both). |
| 185 void RemoveImpl(int remove_mask, | 192 void RemoveImpl(int remove_mask, |
| 186 const GURL& origin, | 193 const GURL& origin, |
| 187 bool remove_protected_origins); | 194 int origin_set_mask); |
| 188 | 195 |
| 189 // If we're not waiting on anything, notifies observers and deletes this | 196 // If we're not waiting on anything, notifies observers and deletes this |
| 190 // object. | 197 // object. |
| 191 void NotifyAndDeleteIfDone(); | 198 void NotifyAndDeleteIfDone(); |
| 192 | 199 |
| 193 // Callback when the network history has been deleted. Invokes | 200 // Callback when the network history has been deleted. Invokes |
| 194 // NotifyAndDeleteIfDone. | 201 // NotifyAndDeleteIfDone. |
| 195 void ClearedNetworkHistory(); | 202 void ClearedNetworkHistory(); |
| 196 | 203 |
| 197 // Invoked on the IO thread to clear the HostCache, speculative data about | 204 // Invoked on the IO thread to clear the HostCache, speculative data about |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // gathering origins. | 315 // gathering origins. |
| 309 int quota_managed_origins_to_delete_count_; | 316 int quota_managed_origins_to_delete_count_; |
| 310 int quota_managed_storage_types_to_delete_count_; | 317 int quota_managed_storage_types_to_delete_count_; |
| 311 | 318 |
| 312 // The removal mask for the current removal operation. | 319 // The removal mask for the current removal operation. |
| 313 int remove_mask_; | 320 int remove_mask_; |
| 314 | 321 |
| 315 // The origin for the current removal operation. | 322 // The origin for the current removal operation. |
| 316 GURL remove_origin_; | 323 GURL remove_origin_; |
| 317 | 324 |
| 318 // Should data for protected origins be removed? | 325 // From which types of origins should we remove data? |
| 319 bool remove_protected_; | 326 int origin_set_mask_; |
| 320 | 327 |
| 321 ObserverList<Observer> observer_list_; | 328 ObserverList<Observer> observer_list_; |
| 322 | 329 |
| 323 // Used if we need to clear history. | 330 // Used if we need to clear history. |
| 324 CancelableRequestConsumer request_consumer_; | 331 CancelableRequestConsumer request_consumer_; |
| 325 | 332 |
| 326 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 333 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 327 }; | 334 }; |
| 328 | 335 |
| 329 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 336 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |