| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/cancelable_request.h" | 10 #include "chrome/browser/cancelable_request.h" |
| 11 #include "chrome/common/notification_registrar.h" | 11 #include "chrome/common/notification_registrar.h" |
| 12 | 12 |
| 13 class MessageLoop; | 13 class MessageLoop; |
| 14 class Profile; | 14 class Profile; |
| 15 class URLRequestContextGetter; |
| 15 | 16 |
| 16 // BrowsingDataRemover is responsible for removing data related to browsing: | 17 // BrowsingDataRemover is responsible for removing data related to browsing: |
| 17 // visits in url database, downloads, cookies ... | 18 // visits in url database, downloads, cookies ... |
| 18 | 19 |
| 19 class BrowsingDataRemover : public NotificationObserver { | 20 class BrowsingDataRemover : public NotificationObserver { |
| 20 public: | 21 public: |
| 21 // Time period ranges available when doing browsing data removals. | 22 // Time period ranges available when doing browsing data removals. |
| 22 enum TimePeriod { | 23 enum TimePeriod { |
| 23 LAST_DAY = 0, | 24 LAST_DAY = 0, |
| 24 LAST_WEEK, | 25 LAST_WEEK, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const NotificationDetails& details); | 80 const NotificationDetails& details); |
| 80 | 81 |
| 81 // If we're not waiting on anything, notifies observers and deletes this | 82 // If we're not waiting on anything, notifies observers and deletes this |
| 82 // object. | 83 // object. |
| 83 void NotifyAndDeleteIfDone(); | 84 void NotifyAndDeleteIfDone(); |
| 84 | 85 |
| 85 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. | 86 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. |
| 86 void ClearedCache(); | 87 void ClearedCache(); |
| 87 | 88 |
| 88 // Invoked on the IO thread to delete from the cache. | 89 // Invoked on the IO thread to delete from the cache. |
| 89 void ClearCacheOnIOThread(base::Time delete_begin, | 90 void ClearCacheOnIOThread(URLRequestContextGetter* context_getter, |
| 91 base::Time delete_begin, |
| 90 base::Time delete_end, | 92 base::Time delete_end, |
| 91 MessageLoop* ui_loop); | 93 MessageLoop* ui_loop); |
| 92 | 94 |
| 93 // Calculate the begin time for the deletion range specified by |time_period|. | 95 // Calculate the begin time for the deletion range specified by |time_period|. |
| 94 base::Time CalculateBeginDeleteTime(TimePeriod time_period); | 96 base::Time CalculateBeginDeleteTime(TimePeriod time_period); |
| 95 | 97 |
| 96 // Returns true if we're all done. | 98 // Returns true if we're all done. |
| 97 bool all_done() { | 99 bool all_done() { |
| 98 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 100 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
| 99 !waiting_for_clear_history_; | 101 !waiting_for_clear_history_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 | 123 |
| 122 ObserverList<Observer> observer_list_; | 124 ObserverList<Observer> observer_list_; |
| 123 | 125 |
| 124 // Used if we need to clear history. | 126 // Used if we need to clear history. |
| 125 CancelableRequestConsumer request_consumer_; | 127 CancelableRequestConsumer request_consumer_; |
| 126 | 128 |
| 127 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 129 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 132 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |