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

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

Issue 10391173: Pepper Flash settings integration: implement "deauthorize content licenses". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop_helpers.h" 13 #include "base/message_loop_helpers.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/synchronization/waitable_event_watcher.h" 15 #include "base/synchronization/waitable_event_watcher.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "chrome/browser/cancelable_request.h" 17 #include "chrome/browser/cancelable_request.h"
18 #include "chrome/browser/pepper_flash_settings_manager.h"
18 #include "chrome/browser/prefs/pref_member.h" 19 #include "chrome/browser/prefs/pref_member.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "webkit/quota/quota_types.h" 23 #include "webkit/quota/quota_types.h"
23 24
24 class ExtensionSpecialStoragePolicy; 25 class ExtensionSpecialStoragePolicy;
25 class IOThread; 26 class IOThread;
26 class Profile; 27 class Profile;
27 28
(...skipping 11 matching lines...) Expand all
39 } 40 }
40 41
41 namespace quota { 42 namespace quota {
42 class QuotaManager; 43 class QuotaManager;
43 } 44 }
44 45
45 // BrowsingDataRemover is responsible for removing data related to browsing: 46 // BrowsingDataRemover is responsible for removing data related to browsing:
46 // visits in url database, downloads, cookies ... 47 // visits in url database, downloads, cookies ...
47 48
48 class BrowsingDataRemover : public content::NotificationObserver, 49 class BrowsingDataRemover : public content::NotificationObserver,
49 public base::WaitableEventWatcher::Delegate { 50 public base::WaitableEventWatcher::Delegate,
51 public PepperFlashSettingsManager::Client {
50 public: 52 public:
51 // Time period ranges available when doing browsing data removals. 53 // Time period ranges available when doing browsing data removals.
52 enum TimePeriod { 54 enum TimePeriod {
53 LAST_HOUR = 0, 55 LAST_HOUR = 0,
54 LAST_DAY, 56 LAST_DAY,
55 LAST_WEEK, 57 LAST_WEEK,
56 FOUR_WEEKS, 58 FOUR_WEEKS,
57 EVERYTHING 59 EVERYTHING
58 }; 60 };
59 61
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // BrowsingDataRemover. 174 // BrowsingDataRemover.
173 virtual void Observe(int type, 175 virtual void Observe(int type,
174 const content::NotificationSource& source, 176 const content::NotificationSource& source,
175 const content::NotificationDetails& details) OVERRIDE; 177 const content::NotificationDetails& details) OVERRIDE;
176 178
177 // WaitableEventWatcher implementation. 179 // WaitableEventWatcher implementation.
178 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. 180 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone.
179 virtual void OnWaitableEventSignaled( 181 virtual void OnWaitableEventSignaled(
180 base::WaitableEvent* waitable_event) OVERRIDE; 182 base::WaitableEvent* waitable_event) OVERRIDE;
181 183
184 // PepperFlashSettingsManager::Client implementation.
185 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id,
186 bool success) OVERRIDE;
187
182 // 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
183 // provided |origin| is empty, data is removed for all origins. If 189 // provided |origin| is empty, data is removed for all origins. If
184 // |remove_protected_origins| is true, then data is removed even if the origin 190 // |remove_protected_origins| is true, then data is removed even if the origin
185 // is otherwise protected (e.g. as an installed application). 191 // is otherwise protected (e.g. as an installed application).
186 void RemoveImpl(int remove_mask, 192 void RemoveImpl(int remove_mask,
187 const GURL& origin, 193 const GURL& origin,
188 bool remove_protected_origins); 194 bool remove_protected_origins);
189 195
190 // 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
191 // object. 197 // object.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 base::Time CalculateBeginDeleteTime(TimePeriod time_period); 254 base::Time CalculateBeginDeleteTime(TimePeriod time_period);
249 255
250 // Returns true if we're all done. 256 // Returns true if we're all done.
251 bool all_done() { 257 bool all_done() {
252 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && 258 return registrar_.IsEmpty() && !waiting_for_clear_cache_ &&
253 !waiting_for_clear_cookies_count_&& 259 !waiting_for_clear_cookies_count_&&
254 !waiting_for_clear_history_ && 260 !waiting_for_clear_history_ &&
255 !waiting_for_clear_networking_history_ && 261 !waiting_for_clear_networking_history_ &&
256 !waiting_for_clear_server_bound_certs_ && 262 !waiting_for_clear_server_bound_certs_ &&
257 !waiting_for_clear_plugin_data_ && 263 !waiting_for_clear_plugin_data_ &&
258 !waiting_for_clear_quota_managed_data_; 264 !waiting_for_clear_quota_managed_data_ &&
265 !waiting_for_clear_content_licenses_;
259 } 266 }
260 267
261 // Setter for removing_; DCHECKs that we can only start removing if we're not 268 // Setter for removing_; DCHECKs that we can only start removing if we're not
262 // already removing, and vice-versa. 269 // already removing, and vice-versa.
263 static void set_removing(bool removing); 270 static void set_removing(bool removing);
264 271
265 content::NotificationRegistrar registrar_; 272 content::NotificationRegistrar registrar_;
266 273
267 // Profile we're to remove from. 274 // Profile we're to remove from.
268 Profile* profile_; 275 Profile* profile_;
(...skipping 18 matching lines...) Expand all
287 disk_cache::Backend* cache_; 294 disk_cache::Backend* cache_;
288 295
289 // Used to delete data from HTTP cache. 296 // Used to delete data from HTTP cache.
290 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; 297 scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
291 scoped_refptr<net::URLRequestContextGetter> media_context_getter_; 298 scoped_refptr<net::URLRequestContextGetter> media_context_getter_;
292 299
293 // Used to delete plugin data. 300 // Used to delete plugin data.
294 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; 301 scoped_ptr<content::PluginDataRemover> plugin_data_remover_;
295 base::WaitableEventWatcher watcher_; 302 base::WaitableEventWatcher watcher_;
296 303
304 // Used to deauthorize content licenses for Pepper Flash.
305 scoped_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_;
306 uint32 deauthorize_content_licenses_request_id_;
307
297 // True if we're waiting for various data to be deleted. 308 // True if we're waiting for various data to be deleted.
298 // These may only be accessed from UI thread in order to avoid races! 309 // These may only be accessed from UI thread in order to avoid races!
299 bool waiting_for_clear_cache_; 310 bool waiting_for_clear_cache_;
300 // Non-zero if waiting for cookies to be cleared. 311 // Non-zero if waiting for cookies to be cleared.
301 int waiting_for_clear_cookies_count_; 312 int waiting_for_clear_cookies_count_;
302 bool waiting_for_clear_history_; 313 bool waiting_for_clear_history_;
303 bool waiting_for_clear_networking_history_; 314 bool waiting_for_clear_networking_history_;
304 bool waiting_for_clear_server_bound_certs_; 315 bool waiting_for_clear_server_bound_certs_;
305 bool waiting_for_clear_plugin_data_; 316 bool waiting_for_clear_plugin_data_;
306 bool waiting_for_clear_quota_managed_data_; 317 bool waiting_for_clear_quota_managed_data_;
318 bool waiting_for_clear_content_licenses_;
307 319
308 // Tracking how many origins need to be deleted, and whether we're finished 320 // Tracking how many origins need to be deleted, and whether we're finished
309 // gathering origins. 321 // gathering origins.
310 int quota_managed_origins_to_delete_count_; 322 int quota_managed_origins_to_delete_count_;
311 int quota_managed_storage_types_to_delete_count_; 323 int quota_managed_storage_types_to_delete_count_;
312 324
313 // The removal mask for the current removal operation. 325 // The removal mask for the current removal operation.
314 int remove_mask_; 326 int remove_mask_;
315 327
316 // The origin for the current removal operation. 328 // The origin for the current removal operation.
317 GURL remove_origin_; 329 GURL remove_origin_;
318 330
319 // Should data for protected origins be removed? 331 // Should data for protected origins be removed?
320 bool remove_protected_; 332 bool remove_protected_;
321 333
322 ObserverList<Observer> observer_list_; 334 ObserverList<Observer> observer_list_;
323 335
324 // Used if we need to clear history. 336 // Used if we need to clear history.
325 CancelableRequestConsumer request_consumer_; 337 CancelableRequestConsumer request_consumer_;
326 338
327 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 339 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
328 }; 340 };
329 341
330 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ 342 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698