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_observer.h" | 11 #include "chrome/common/notification_registrar.h" |
12 | 12 |
13 class MessageLoop; | 13 class MessageLoop; |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 // BrowsingDataRemover is responsible for removing data related to browsing: | 16 // BrowsingDataRemover is responsible for removing data related to browsing: |
17 // visits in url database, downloads, cookies ... | 17 // visits in url database, downloads, cookies ... |
18 | 18 |
19 class BrowsingDataRemover : public NotificationObserver { | 19 class BrowsingDataRemover : public NotificationObserver { |
20 public: | 20 public: |
21 // Mask used for Remove. | 21 // Mask used for Remove. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. | 67 // Callback when the cache has been deleted. Invokes NotifyAndDeleteIfDone. |
68 void ClearedCache(); | 68 void ClearedCache(); |
69 | 69 |
70 // Invoked on the IO thread to delete from the cache. | 70 // Invoked on the IO thread to delete from the cache. |
71 void ClearCacheOnIOThread(base::Time delete_begin, | 71 void ClearCacheOnIOThread(base::Time delete_begin, |
72 base::Time delete_end, | 72 base::Time delete_end, |
73 MessageLoop* ui_loop); | 73 MessageLoop* ui_loop); |
74 | 74 |
75 // Returns true if we're all done. | 75 // Returns true if we're all done. |
76 bool all_done() { | 76 bool all_done() { |
77 return !waiting_for_keywords_ && !waiting_for_clear_cache_ && | 77 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
78 !waiting_for_clear_history_; | 78 !waiting_for_clear_history_; |
79 } | 79 } |
80 | 80 |
| 81 NotificationRegistrar registrar_; |
| 82 |
81 // Profile we're to remove from. | 83 // Profile we're to remove from. |
82 Profile* profile_; | 84 Profile* profile_; |
83 | 85 |
84 // Start time to delete from. | 86 // Start time to delete from. |
85 const base::Time delete_begin_; | 87 const base::Time delete_begin_; |
86 | 88 |
87 // End time to delete to. | 89 // End time to delete to. |
88 const base::Time delete_end_; | 90 const base::Time delete_end_; |
89 | 91 |
90 // True if Remove has been invoked. | 92 // True if Remove has been invoked. |
91 static bool removing_; | 93 static bool removing_; |
92 | 94 |
93 // True if we're waiting for the TemplateURLModel to finish loading. | |
94 bool waiting_for_keywords_; | |
95 | |
96 // True if we're waiting for the history to be deleted. | 95 // True if we're waiting for the history to be deleted. |
97 bool waiting_for_clear_history_; | 96 bool waiting_for_clear_history_; |
98 | 97 |
99 // True if we're waiting for the cache to be cleared. | 98 // True if we're waiting for the cache to be cleared. |
100 bool waiting_for_clear_cache_; | 99 bool waiting_for_clear_cache_; |
101 | 100 |
102 ObserverList<Observer> observer_list_; | 101 ObserverList<Observer> observer_list_; |
103 | 102 |
104 // Used if we need to clear history. | 103 // Used if we need to clear history. |
105 CancelableRequestConsumer request_consumer_; | 104 CancelableRequestConsumer request_consumer_; |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 106 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
108 }; | 107 }; |
109 | 108 |
110 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 109 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |