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

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

Issue 2248403002: Implement origin-based deletion of plugin data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plugins done. Created 4 years, 4 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
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_BROWSING_DATA_REMOVER_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 14 matching lines...) Expand all
25 #include "components/browsing_data/core/browsing_data_utils.h" 25 #include "components/browsing_data/core/browsing_data_utils.h"
26 #include "components/content_settings/core/common/content_settings_pattern.h" 26 #include "components/content_settings/core/common/content_settings_pattern.h"
27 #include "components/content_settings/core/common/content_settings_types.h" 27 #include "components/content_settings/core/common/content_settings_types.h"
28 #include "components/keyed_service/core/keyed_service.h" 28 #include "components/keyed_service/core/keyed_service.h"
29 #include "components/offline_pages/offline_page_model.h" 29 #include "components/offline_pages/offline_page_model.h"
30 #include "components/prefs/pref_member.h" 30 #include "components/prefs/pref_member.h"
31 #include "components/search_engines/template_url_service.h" 31 #include "components/search_engines/template_url_service.h"
32 #include "storage/common/quota/quota_types.h" 32 #include "storage/common/quota/quota_types.h"
33 #include "url/gurl.h" 33 #include "url/gurl.h"
34 34
35 #if defined(ENABLE_PLUGINS)
36 #include "chrome/browser/pepper_flash_settings_manager.h"
37 #endif
38
39 #if defined(OS_CHROMEOS) 35 #if defined(OS_CHROMEOS)
40 #include "chromeos/dbus/dbus_method_call_status.h" 36 #include "chromeos/dbus/dbus_method_call_status.h"
41 #endif 37 #endif
42 38
39 #if defined(ENABLE_PLUGINS)
40 #include "chrome/browser/pepper_flash_settings_manager.h"
41
42 class BrowsingDataFlashLSOHelper;
Bernhard Bauer 2016/08/18 18:35:59 This looks kinda odd… You could probably forward-d
msramek 2016/08/19 11:16:46 Done. OK, then I'll just forward-declare it withou
43 #endif
44
43 class BrowsingDataRemoverFactory; 45 class BrowsingDataRemoverFactory;
44 class HostContentSettingsMap; 46 class HostContentSettingsMap;
45 class IOThread; 47 class IOThread;
46 class BrowsingDataFilterBuilder; 48 class BrowsingDataFilterBuilder;
47 class Profile; 49 class Profile;
48 50
49 namespace chrome_browser_net { 51 namespace chrome_browser_net {
50 class Predictor; 52 class Predictor;
51 } 53 }
52 54
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 292
291 // Used for testing. 293 // Used for testing.
292 void OverrideStoragePartitionForTesting( 294 void OverrideStoragePartitionForTesting(
293 content::StoragePartition* storage_partition); 295 content::StoragePartition* storage_partition);
294 296
295 #if BUILDFLAG(ANDROID_JAVA_UI) 297 #if BUILDFLAG(ANDROID_JAVA_UI)
296 void OverrideWebappRegistryForTesting( 298 void OverrideWebappRegistryForTesting(
297 std::unique_ptr<WebappRegistry> webapp_registry); 299 std::unique_ptr<WebappRegistry> webapp_registry);
298 #endif 300 #endif
299 301
302 #if defined(ENABLE_PLUGINS)
303 void OverrideFlashLSOHelperForTesting(
304 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper);
305 #endif
306
300 // Parameters of the last call are exposed to be used by tests. Removal and 307 // Parameters of the last call are exposed to be used by tests. Removal and
301 // origin type masks equal to -1 mean that no removal has ever been executed. 308 // origin type masks equal to -1 mean that no removal has ever been executed.
302 // TODO(msramek): If other consumers than tests are interested in this, 309 // TODO(msramek): If other consumers than tests are interested in this,
303 // consider returning them in OnBrowsingDataRemoverDone() callback. 310 // consider returning them in OnBrowsingDataRemoverDone() callback.
304 const base::Time& GetLastUsedBeginTime(); 311 const base::Time& GetLastUsedBeginTime();
305 const base::Time& GetLastUsedEndTime(); 312 const base::Time& GetLastUsedEndTime();
306 int GetLastUsedRemovalMask(); 313 int GetLastUsedRemovalMask();
307 int GetLastUsedOriginTypeMask(); 314 int GetLastUsedOriginTypeMask();
308 315
309 protected: 316 protected:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void SetRemoving(bool is_removing); 381 void SetRemoving(bool is_removing);
375 382
376 // Callback for when TemplateURLService has finished loading. Clears the data, 383 // Callback for when TemplateURLService has finished loading. Clears the data,
377 // clears the respective waiting flag, and invokes NotifyIfDone. 384 // clears the respective waiting flag, and invokes NotifyIfDone.
378 void OnKeywordsLoaded(); 385 void OnKeywordsLoaded();
379 386
380 #if defined(ENABLE_PLUGINS) 387 #if defined(ENABLE_PLUGINS)
381 // Called when plugin data has been cleared. Invokes NotifyIfDone. 388 // Called when plugin data has been cleared. Invokes NotifyIfDone.
382 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); 389 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event);
383 390
391 // Called when the list of |sites| storing Flash LSO cookies is fetched.
392 void OnSitesWithFlashDataFetched(
393 base::Callback<bool(const std::string&)> plugin_filter,
394 const std::vector<std::string>& sites);
395
396 // Indicates that LSO cookies for one website have been deleted.
397 void OnFlashDataDeleted();
398
384 // PepperFlashSettingsManager::Client implementation. 399 // PepperFlashSettingsManager::Client implementation.
385 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id, 400 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id,
386 bool success) override; 401 bool success) override;
387 #endif 402 #endif
388 403
389 #if defined (OS_CHROMEOS) 404 #if defined (OS_CHROMEOS)
390 void OnClearPlatformKeys(chromeos::DBusMethodCallStatus call_status, 405 void OnClearPlatformKeys(chromeos::DBusMethodCallStatus call_status,
391 bool result); 406 bool result);
392 #endif 407 #endif
393 408
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 513
499 // Profile we're to remove from. 514 // Profile we're to remove from.
500 Profile* profile_; 515 Profile* profile_;
501 516
502 // Start time to delete from. 517 // Start time to delete from.
503 base::Time delete_begin_; 518 base::Time delete_begin_;
504 519
505 // End time to delete to. 520 // End time to delete to.
506 base::Time delete_end_; 521 base::Time delete_end_;
507 522
523 // The removal mask for the current removal operation.
524 int remove_mask_ = 0;
525
526 // From which types of origins should we remove data?
527 int origin_type_mask_ = 0;
528
508 // True if Remove has been invoked. 529 // True if Remove has been invoked.
509 bool is_removing_; 530 bool is_removing_;
510 531
511 // Removal tasks to be processed. 532 // Removal tasks to be processed.
512 std::queue<RemovalTask> task_queue_; 533 std::queue<RemovalTask> task_queue_;
513 534
514 // If non-NULL, the |completion_inhibitor_| is notified each time an instance 535 // If non-NULL, the |completion_inhibitor_| is notified each time an instance
515 // is about to complete a browsing data removal process, and has the ability 536 // is about to complete a browsing data removal process, and has the ability
516 // to artificially delay completion. Used for testing. 537 // to artificially delay completion. Used for testing.
517 static CompletionInhibitor* completion_inhibitor_; 538 static CompletionInhibitor* completion_inhibitor_;
518 539
519 #if defined(ENABLE_PLUGINS) 540 #if defined(ENABLE_PLUGINS)
520 // Used to delete plugin data. 541 // Used to delete plugin data.
521 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_; 542 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_;
522 base::WaitableEventWatcher watcher_; 543 base::WaitableEventWatcher watcher_;
523 544
545 // Used for per-site plugin data deletion.
546 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_;
547
524 // Used to deauthorize content licenses for Pepper Flash. 548 // Used to deauthorize content licenses for Pepper Flash.
525 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; 549 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_;
526 #endif 550 #endif
527 551
528 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; 552 uint32_t deauthorize_flash_content_licenses_request_id_ = 0;
529 // True if we're waiting for various data to be deleted. 553 // True if we're waiting for various data to be deleted.
530 // These may only be accessed from UI thread in order to avoid races! 554 // These may only be accessed from UI thread in order to avoid races!
531 bool waiting_for_synchronous_clear_operations_ = false; 555 bool waiting_for_synchronous_clear_operations_ = false;
532 bool waiting_for_clear_autofill_origin_urls_ = false; 556 bool waiting_for_clear_autofill_origin_urls_ = false;
533 bool waiting_for_clear_cache_ = false; 557 bool waiting_for_clear_cache_ = false;
534 bool waiting_for_clear_channel_ids_ = false; 558 bool waiting_for_clear_channel_ids_ = false;
535 bool waiting_for_clear_flash_content_licenses_ = false; 559 bool waiting_for_clear_flash_content_licenses_ = false;
536 // Non-zero if waiting for cookies to be cleared. 560 // Non-zero if waiting for cookies to be cleared.
537 int waiting_for_clear_cookies_count_ = 0; 561 int waiting_for_clear_cookies_count_ = 0;
562 // Counts the number of plugin data tasks. Should be the number of LSO cookies
563 // to be deleted, or 1 while we're fetching LSO cookies or deleting in bulk.
564 int waiting_for_clear_plugin_data_count_ = 0;
538 bool waiting_for_clear_domain_reliability_monitor_ = false; 565 bool waiting_for_clear_domain_reliability_monitor_ = false;
539 bool waiting_for_clear_form_ = false; 566 bool waiting_for_clear_form_ = false;
540 bool waiting_for_clear_history_ = false; 567 bool waiting_for_clear_history_ = false;
541 bool waiting_for_clear_hostname_resolution_cache_ = false; 568 bool waiting_for_clear_hostname_resolution_cache_ = false;
542 bool waiting_for_clear_keyword_data_ = false; 569 bool waiting_for_clear_keyword_data_ = false;
543 bool waiting_for_clear_nacl_cache_ = false; 570 bool waiting_for_clear_nacl_cache_ = false;
544 bool waiting_for_clear_network_predictor_ = false; 571 bool waiting_for_clear_network_predictor_ = false;
545 bool waiting_for_clear_networking_history_ = false; 572 bool waiting_for_clear_networking_history_ = false;
546 bool waiting_for_clear_passwords_ = false; 573 bool waiting_for_clear_passwords_ = false;
547 bool waiting_for_clear_passwords_stats_ = false; 574 bool waiting_for_clear_passwords_stats_ = false;
548 bool waiting_for_clear_platform_keys_ = false; 575 bool waiting_for_clear_platform_keys_ = false;
549 bool waiting_for_clear_plugin_data_ = false;
550 bool waiting_for_clear_pnacl_cache_ = false; 576 bool waiting_for_clear_pnacl_cache_ = false;
551 #if BUILDFLAG(ANDROID_JAVA_UI) 577 #if BUILDFLAG(ANDROID_JAVA_UI)
552 bool waiting_for_clear_precache_history_ = false; 578 bool waiting_for_clear_precache_history_ = false;
553 bool waiting_for_clear_webapp_data_ = false; 579 bool waiting_for_clear_webapp_data_ = false;
554 bool waiting_for_clear_webapp_history_ = false; 580 bool waiting_for_clear_webapp_history_ = false;
555 bool waiting_for_clear_offline_page_data_ = false; 581 bool waiting_for_clear_offline_page_data_ = false;
556 #endif 582 #endif
557 bool waiting_for_clear_storage_partition_data_ = false; 583 bool waiting_for_clear_storage_partition_data_ = false;
558 #if defined(ENABLE_WEBRTC) 584 #if defined(ENABLE_WEBRTC)
559 bool waiting_for_clear_webrtc_logs_ = false; 585 bool waiting_for_clear_webrtc_logs_ = false;
560 #endif 586 #endif
561 bool waiting_for_clear_auto_sign_in_ = false; 587 bool waiting_for_clear_auto_sign_in_ = false;
562 588
563 // The removal mask for the current removal operation.
564 int remove_mask_ = 0;
565
566 // From which types of origins should we remove data?
567 int origin_type_mask_ = 0;
568
569 // Observers of the global state and individual tasks. 589 // Observers of the global state and individual tasks.
570 base::ObserverList<Observer, true> observer_list_; 590 base::ObserverList<Observer, true> observer_list_;
571 591
572 // Used if we need to clear history. 592 // Used if we need to clear history.
573 base::CancelableTaskTracker history_task_tracker_; 593 base::CancelableTaskTracker history_task_tracker_;
574 594
575 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; 595 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
576 596
577 // We do not own this. 597 // We do not own this.
578 content::StoragePartition* storage_partition_for_testing_ = nullptr; 598 content::StoragePartition* storage_partition_for_testing_ = nullptr;
579 599
580 #if BUILDFLAG(ANDROID_JAVA_UI) 600 #if BUILDFLAG(ANDROID_JAVA_UI)
581 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is 601 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is
582 // not initialised, so the registry must be mocked out. 602 // not initialised, so the registry must be mocked out.
583 std::unique_ptr<WebappRegistry> webapp_registry_; 603 std::unique_ptr<WebappRegistry> webapp_registry_;
584 #endif 604 #endif
585 605
586 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; 606 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_;
587 607
588 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 608 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
589 }; 609 };
590 610
591 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 611 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698