Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: chrome/browser/browsing_data_remover.h

Issue 5278001: Add a preference to clear Flash LSO data in the Clear Browsing Data dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <vector> 9 #include <vector>
10 10
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "chrome/browser/appcache/chrome_appcache_service.h" 14 #include "chrome/browser/appcache/chrome_appcache_service.h"
15 #include "chrome/browser/cancelable_request.h" 15 #include "chrome/browser/cancelable_request.h"
16 #include "chrome/common/notification_registrar.h" 16 #include "chrome/common/notification_registrar.h"
17 #include "webkit/database/database_tracker.h"
18 17
18 class PluginDataRemover;
19 class Profile; 19 class Profile;
20 class URLRequestContextGetter; 20 class URLRequestContextGetter;
21 21
22 namespace disk_cache { 22 namespace disk_cache {
23 class Backend; 23 class Backend;
24 } 24 }
25 25
26 namespace webkit_database {
27 class DatabaseTracker;
28 }
29
26 // BrowsingDataRemover is responsible for removing data related to browsing: 30 // BrowsingDataRemover is responsible for removing data related to browsing:
27 // visits in url database, downloads, cookies ... 31 // visits in url database, downloads, cookies ...
28 32
29 class BrowsingDataRemover : public NotificationObserver { 33 class BrowsingDataRemover : public NotificationObserver {
30 public: 34 public:
31 // Time period ranges available when doing browsing data removals. 35 // Time period ranges available when doing browsing data removals.
32 enum TimePeriod { 36 enum TimePeriod {
33 LAST_HOUR = 0, 37 LAST_HOUR = 0,
34 LAST_DAY, 38 LAST_DAY,
35 LAST_WEEK, 39 LAST_WEEK,
36 FOUR_WEEKS, 40 FOUR_WEEKS,
37 EVERYTHING 41 EVERYTHING
38 }; 42 };
39 43
40 // Mask used for Remove. 44 // Mask used for Remove.
41 45
42 // In addition to visits, this removes keywords and the last session. 46 // In addition to visits, this removes keywords and the last session.
43 static const int REMOVE_HISTORY = 1 << 0; 47 static const int REMOVE_HISTORY = 1 << 0;
44 static const int REMOVE_DOWNLOADS = 1 << 1; 48 static const int REMOVE_DOWNLOADS = 1 << 1;
45 static const int REMOVE_COOKIES = 1 << 2; 49 static const int REMOVE_COOKIES = 1 << 2;
46 static const int REMOVE_PASSWORDS = 1 << 3; 50 static const int REMOVE_PASSWORDS = 1 << 3;
47 static const int REMOVE_FORM_DATA = 1 << 4; 51 static const int REMOVE_FORM_DATA = 1 << 4;
48 static const int REMOVE_CACHE = 1 << 5; 52 static const int REMOVE_CACHE = 1 << 5;
53 static const int REMOVE_LSO_DATA = 1 << 6;
49 54
50 // Observer is notified when the removal is done. Done means keywords have 55 // Observer is notified when the removal is done. Done means keywords have
51 // been deleted, cache cleared and all other tasks scheduled. 56 // been deleted, cache cleared and all other tasks scheduled.
52 class Observer { 57 class Observer {
53 public: 58 public:
54 virtual void OnBrowsingDataRemoverDone() = 0; 59 virtual void OnBrowsingDataRemoverDone() = 0;
55 60
56 protected: 61 protected:
57 virtual ~Observer() {} 62 virtual ~Observer() {}
58 }; 63 };
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Invoked on the IO thread to delete from the AppCache, ignoring data from 135 // Invoked on the IO thread to delete from the AppCache, ignoring data from
131 // any origins within the |origin_whitelist|. 136 // any origins within the |origin_whitelist|.
132 void ClearAppCacheOnIOThread(base::Time delete_begin, 137 void ClearAppCacheOnIOThread(base::Time delete_begin,
133 const std::vector<GURL>& origin_whitelist); 138 const std::vector<GURL>& origin_whitelist);
134 139
135 // Lower level helpers. 140 // Lower level helpers.
136 void OnGotAppCacheInfo(int rv); 141 void OnGotAppCacheInfo(int rv);
137 void OnAppCacheDeleted(int rv); 142 void OnAppCacheDeleted(int rv);
138 ChromeAppCacheService* GetAppCacheService(); 143 ChromeAppCacheService* GetAppCacheService();
139 144
145 // Callback when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone.
146 void OnClearedPluginData();
147
140 // Calculate the begin time for the deletion range specified by |time_period|. 148 // Calculate the begin time for the deletion range specified by |time_period|.
141 base::Time CalculateBeginDeleteTime(TimePeriod time_period); 149 base::Time CalculateBeginDeleteTime(TimePeriod time_period);
142 150
143 // Returns true if we're all done. 151 // Returns true if we're all done.
144 bool all_done() { 152 bool all_done() {
145 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && 153 return registrar_.IsEmpty() && !waiting_for_clear_cache_ &&
146 !waiting_for_clear_history_ && !waiting_for_clear_databases_ && 154 !waiting_for_clear_history_ && !waiting_for_clear_databases_ &&
147 !waiting_for_clear_appcache_; 155 !waiting_for_clear_appcache_ && !waiting_for_clear_lso_data_;
148 } 156 }
149 157
150 NotificationRegistrar registrar_; 158 NotificationRegistrar registrar_;
151 159
152 // Profile we're to remove from. 160 // Profile we're to remove from.
153 Profile* profile_; 161 Profile* profile_;
154 162
155 // Start time to delete from. 163 // Start time to delete from.
156 const base::Time delete_begin_; 164 const base::Time delete_begin_;
157 165
(...skipping 16 matching lines...) Expand all
174 scoped_refptr<URLRequestContextGetter> request_context_getter_; 182 scoped_refptr<URLRequestContextGetter> request_context_getter_;
175 std::vector<GURL> appcache_whitelist_; 183 std::vector<GURL> appcache_whitelist_;
176 int appcaches_to_be_deleted_count_; 184 int appcaches_to_be_deleted_count_;
177 185
178 // Used to delete data from the HTTP caches. 186 // Used to delete data from the HTTP caches.
179 CacheState next_cache_state_; 187 CacheState next_cache_state_;
180 disk_cache::Backend* cache_; 188 disk_cache::Backend* cache_;
181 scoped_refptr<URLRequestContextGetter> main_context_getter_; 189 scoped_refptr<URLRequestContextGetter> main_context_getter_;
182 scoped_refptr<URLRequestContextGetter> media_context_getter_; 190 scoped_refptr<URLRequestContextGetter> media_context_getter_;
183 191
192 // Used to delete plugin data.
193 scoped_ptr<PluginDataRemover> plugin_data_remover_;
194
184 // True if we're waiting for various data to be deleted. 195 // True if we're waiting for various data to be deleted.
185 bool waiting_for_clear_databases_; 196 bool waiting_for_clear_databases_;
186 bool waiting_for_clear_history_; 197 bool waiting_for_clear_history_;
187 bool waiting_for_clear_cache_; 198 bool waiting_for_clear_cache_;
188 bool waiting_for_clear_appcache_; 199 bool waiting_for_clear_appcache_;
200 bool waiting_for_clear_lso_data_;
189 201
190 ObserverList<Observer> observer_list_; 202 ObserverList<Observer> observer_list_;
191 203
192 // Used if we need to clear history. 204 // Used if we need to clear history.
193 CancelableRequestConsumer request_consumer_; 205 CancelableRequestConsumer request_consumer_;
194 206
195 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 207 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
196 }; 208 };
197 209
198 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ 210 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698