OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "url/gurl.h" | 33 #include "url/gurl.h" |
34 | 34 |
35 #if defined(ENABLE_PLUGINS) | 35 #if defined(ENABLE_PLUGINS) |
36 #include "chrome/browser/pepper_flash_settings_manager.h" | 36 #include "chrome/browser/pepper_flash_settings_manager.h" |
37 #endif | 37 #endif |
38 | 38 |
39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
40 #include "chromeos/dbus/dbus_method_call_status.h" | 40 #include "chromeos/dbus/dbus_method_call_status.h" |
41 #endif | 41 #endif |
42 | 42 |
| 43 class BrowsingDataFilterBuilder; |
| 44 class BrowsingDataFlashLSOHelper; |
43 class BrowsingDataRemoverFactory; | 45 class BrowsingDataRemoverFactory; |
44 class HostContentSettingsMap; | 46 class HostContentSettingsMap; |
45 class IOThread; | 47 class IOThread; |
46 class BrowsingDataFilterBuilder; | |
47 class Profile; | 48 class Profile; |
| 49 class WebappRegistry; |
48 | 50 |
49 namespace chrome_browser_net { | 51 namespace chrome_browser_net { |
50 class Predictor; | 52 class Predictor; |
51 } | 53 } |
52 | 54 |
53 namespace content { | 55 namespace content { |
54 class BrowserContext; | 56 class BrowserContext; |
55 class PluginDataRemover; | 57 class PluginDataRemover; |
56 class StoragePartition; | 58 class StoragePartition; |
57 } | 59 } |
58 | 60 |
59 namespace net { | 61 namespace net { |
60 class URLRequestContextGetter; | 62 class URLRequestContextGetter; |
61 } | 63 } |
62 | 64 |
63 #if BUILDFLAG(ANDROID_JAVA_UI) | |
64 class WebappRegistry; | |
65 #endif | |
66 | |
67 //////////////////////////////////////////////////////////////////////////////// | 65 //////////////////////////////////////////////////////////////////////////////// |
68 // BrowsingDataRemover is responsible for removing data related to browsing: | 66 // BrowsingDataRemover is responsible for removing data related to browsing: |
69 // visits in url database, downloads, cookies ... | 67 // visits in url database, downloads, cookies ... |
70 // | 68 // |
71 // USAGE: | 69 // USAGE: |
72 // | 70 // |
73 // 0. Instantiation. | 71 // 0. Instantiation. |
74 // | 72 // |
75 // BrowsingDataRemover remover = | 73 // BrowsingDataRemover remover = |
76 // BrowsingDataRemoverFactory::GetForBrowserContext(profile); | 74 // BrowsingDataRemoverFactory::GetForBrowserContext(profile); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 288 |
291 // Used for testing. | 289 // Used for testing. |
292 void OverrideStoragePartitionForTesting( | 290 void OverrideStoragePartitionForTesting( |
293 content::StoragePartition* storage_partition); | 291 content::StoragePartition* storage_partition); |
294 | 292 |
295 #if BUILDFLAG(ANDROID_JAVA_UI) | 293 #if BUILDFLAG(ANDROID_JAVA_UI) |
296 void OverrideWebappRegistryForTesting( | 294 void OverrideWebappRegistryForTesting( |
297 std::unique_ptr<WebappRegistry> webapp_registry); | 295 std::unique_ptr<WebappRegistry> webapp_registry); |
298 #endif | 296 #endif |
299 | 297 |
| 298 #if defined(ENABLE_PLUGINS) |
| 299 void OverrideFlashLSOHelperForTesting( |
| 300 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper); |
| 301 #endif |
| 302 |
300 // Parameters of the last call are exposed to be used by tests. Removal and | 303 // 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. | 304 // 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, | 305 // TODO(msramek): If other consumers than tests are interested in this, |
303 // consider returning them in OnBrowsingDataRemoverDone() callback. | 306 // consider returning them in OnBrowsingDataRemoverDone() callback. |
304 const base::Time& GetLastUsedBeginTime(); | 307 const base::Time& GetLastUsedBeginTime(); |
305 const base::Time& GetLastUsedEndTime(); | 308 const base::Time& GetLastUsedEndTime(); |
306 int GetLastUsedRemovalMask(); | 309 int GetLastUsedRemovalMask(); |
307 int GetLastUsedOriginTypeMask(); | 310 int GetLastUsedOriginTypeMask(); |
308 | 311 |
309 protected: | 312 protected: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 void SetRemoving(bool is_removing); | 377 void SetRemoving(bool is_removing); |
375 | 378 |
376 // Callback for when TemplateURLService has finished loading. Clears the data, | 379 // Callback for when TemplateURLService has finished loading. Clears the data, |
377 // clears the respective waiting flag, and invokes NotifyIfDone. | 380 // clears the respective waiting flag, and invokes NotifyIfDone. |
378 void OnKeywordsLoaded(); | 381 void OnKeywordsLoaded(); |
379 | 382 |
380 #if defined(ENABLE_PLUGINS) | 383 #if defined(ENABLE_PLUGINS) |
381 // Called when plugin data has been cleared. Invokes NotifyIfDone. | 384 // Called when plugin data has been cleared. Invokes NotifyIfDone. |
382 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 385 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
383 | 386 |
| 387 // Called when the list of |sites| storing Flash LSO cookies is fetched. |
| 388 void OnSitesWithFlashDataFetched( |
| 389 base::Callback<bool(const std::string&)> plugin_filter, |
| 390 const std::vector<std::string>& sites); |
| 391 |
| 392 // Indicates that LSO cookies for one website have been deleted. |
| 393 void OnFlashDataDeleted(); |
| 394 |
384 // PepperFlashSettingsManager::Client implementation. | 395 // PepperFlashSettingsManager::Client implementation. |
385 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id, | 396 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id, |
386 bool success) override; | 397 bool success) override; |
387 #endif | 398 #endif |
388 | 399 |
389 #if defined (OS_CHROMEOS) | 400 #if defined (OS_CHROMEOS) |
390 void OnClearPlatformKeys(chromeos::DBusMethodCallStatus call_status, | 401 void OnClearPlatformKeys(chromeos::DBusMethodCallStatus call_status, |
391 bool result); | 402 bool result); |
392 #endif | 403 #endif |
393 | 404 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 509 |
499 // Profile we're to remove from. | 510 // Profile we're to remove from. |
500 Profile* profile_; | 511 Profile* profile_; |
501 | 512 |
502 // Start time to delete from. | 513 // Start time to delete from. |
503 base::Time delete_begin_; | 514 base::Time delete_begin_; |
504 | 515 |
505 // End time to delete to. | 516 // End time to delete to. |
506 base::Time delete_end_; | 517 base::Time delete_end_; |
507 | 518 |
| 519 // The removal mask for the current removal operation. |
| 520 int remove_mask_ = 0; |
| 521 |
| 522 // From which types of origins should we remove data? |
| 523 int origin_type_mask_ = 0; |
| 524 |
508 // True if Remove has been invoked. | 525 // True if Remove has been invoked. |
509 bool is_removing_; | 526 bool is_removing_; |
510 | 527 |
511 // Removal tasks to be processed. | 528 // Removal tasks to be processed. |
512 std::queue<RemovalTask> task_queue_; | 529 std::queue<RemovalTask> task_queue_; |
513 | 530 |
514 // If non-NULL, the |completion_inhibitor_| is notified each time an instance | 531 // 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 | 532 // is about to complete a browsing data removal process, and has the ability |
516 // to artificially delay completion. Used for testing. | 533 // to artificially delay completion. Used for testing. |
517 static CompletionInhibitor* completion_inhibitor_; | 534 static CompletionInhibitor* completion_inhibitor_; |
518 | 535 |
519 #if defined(ENABLE_PLUGINS) | 536 #if defined(ENABLE_PLUGINS) |
520 // Used to delete plugin data. | 537 // Used to delete plugin data. |
521 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_; | 538 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_; |
522 base::WaitableEventWatcher watcher_; | 539 base::WaitableEventWatcher watcher_; |
523 | 540 |
| 541 // Used for per-site plugin data deletion. |
| 542 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; |
| 543 |
524 // Used to deauthorize content licenses for Pepper Flash. | 544 // Used to deauthorize content licenses for Pepper Flash. |
525 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; | 545 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; |
526 #endif | 546 #endif |
527 | 547 |
528 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; | 548 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; |
529 // True if we're waiting for various data to be deleted. | 549 // 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! | 550 // These may only be accessed from UI thread in order to avoid races! |
531 bool waiting_for_synchronous_clear_operations_ = false; | 551 bool waiting_for_synchronous_clear_operations_ = false; |
532 bool waiting_for_clear_autofill_origin_urls_ = false; | 552 bool waiting_for_clear_autofill_origin_urls_ = false; |
533 bool waiting_for_clear_cache_ = false; | 553 bool waiting_for_clear_cache_ = false; |
534 bool waiting_for_clear_channel_ids_ = false; | 554 bool waiting_for_clear_channel_ids_ = false; |
535 bool waiting_for_clear_flash_content_licenses_ = false; | 555 bool waiting_for_clear_flash_content_licenses_ = false; |
536 // Non-zero if waiting for cookies to be cleared. | 556 // Non-zero if waiting for cookies to be cleared. |
537 int waiting_for_clear_cookies_count_ = 0; | 557 int waiting_for_clear_cookies_count_ = 0; |
| 558 // Counts the number of plugin data tasks. Should be the number of LSO cookies |
| 559 // to be deleted, or 1 while we're fetching LSO cookies or deleting in bulk. |
| 560 int waiting_for_clear_plugin_data_count_ = 0; |
538 bool waiting_for_clear_domain_reliability_monitor_ = false; | 561 bool waiting_for_clear_domain_reliability_monitor_ = false; |
539 bool waiting_for_clear_form_ = false; | 562 bool waiting_for_clear_form_ = false; |
540 bool waiting_for_clear_history_ = false; | 563 bool waiting_for_clear_history_ = false; |
541 bool waiting_for_clear_hostname_resolution_cache_ = false; | 564 bool waiting_for_clear_hostname_resolution_cache_ = false; |
542 bool waiting_for_clear_keyword_data_ = false; | 565 bool waiting_for_clear_keyword_data_ = false; |
543 bool waiting_for_clear_nacl_cache_ = false; | 566 bool waiting_for_clear_nacl_cache_ = false; |
544 bool waiting_for_clear_network_predictor_ = false; | 567 bool waiting_for_clear_network_predictor_ = false; |
545 bool waiting_for_clear_networking_history_ = false; | 568 bool waiting_for_clear_networking_history_ = false; |
546 bool waiting_for_clear_passwords_ = false; | 569 bool waiting_for_clear_passwords_ = false; |
547 bool waiting_for_clear_passwords_stats_ = false; | 570 bool waiting_for_clear_passwords_stats_ = false; |
548 bool waiting_for_clear_platform_keys_ = false; | 571 bool waiting_for_clear_platform_keys_ = false; |
549 bool waiting_for_clear_plugin_data_ = false; | |
550 bool waiting_for_clear_pnacl_cache_ = false; | 572 bool waiting_for_clear_pnacl_cache_ = false; |
551 #if BUILDFLAG(ANDROID_JAVA_UI) | 573 #if BUILDFLAG(ANDROID_JAVA_UI) |
552 bool waiting_for_clear_precache_history_ = false; | 574 bool waiting_for_clear_precache_history_ = false; |
553 bool waiting_for_clear_webapp_data_ = false; | 575 bool waiting_for_clear_webapp_data_ = false; |
554 bool waiting_for_clear_webapp_history_ = false; | 576 bool waiting_for_clear_webapp_history_ = false; |
555 bool waiting_for_clear_offline_page_data_ = false; | 577 bool waiting_for_clear_offline_page_data_ = false; |
556 #endif | 578 #endif |
557 bool waiting_for_clear_storage_partition_data_ = false; | 579 bool waiting_for_clear_storage_partition_data_ = false; |
558 #if defined(ENABLE_WEBRTC) | 580 #if defined(ENABLE_WEBRTC) |
559 bool waiting_for_clear_webrtc_logs_ = false; | 581 bool waiting_for_clear_webrtc_logs_ = false; |
560 #endif | 582 #endif |
561 bool waiting_for_clear_auto_sign_in_ = false; | 583 bool waiting_for_clear_auto_sign_in_ = false; |
562 | 584 |
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. | 585 // Observers of the global state and individual tasks. |
570 base::ObserverList<Observer, true> observer_list_; | 586 base::ObserverList<Observer, true> observer_list_; |
571 | 587 |
572 // Used if we need to clear history. | 588 // Used if we need to clear history. |
573 base::CancelableTaskTracker history_task_tracker_; | 589 base::CancelableTaskTracker history_task_tracker_; |
574 | 590 |
575 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; | 591 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; |
576 | 592 |
577 // We do not own this. | 593 // We do not own this. |
578 content::StoragePartition* storage_partition_for_testing_ = nullptr; | 594 content::StoragePartition* storage_partition_for_testing_ = nullptr; |
579 | 595 |
580 #if BUILDFLAG(ANDROID_JAVA_UI) | 596 #if BUILDFLAG(ANDROID_JAVA_UI) |
581 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is | 597 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is |
582 // not initialised, so the registry must be mocked out. | 598 // not initialised, so the registry must be mocked out. |
583 std::unique_ptr<WebappRegistry> webapp_registry_; | 599 std::unique_ptr<WebappRegistry> webapp_registry_; |
584 #endif | 600 #endif |
585 | 601 |
586 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; | 602 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; |
587 | 603 |
588 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 604 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
589 }; | 605 }; |
590 | 606 |
591 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 607 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |