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

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

Issue 1329083002: Clear webapp storage when site data is cleared (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment issue Created 5 years, 3 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 #include "chrome/browser/browsing_data/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data/browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "net/cookies/cookie_store.h" 64 #include "net/cookies/cookie_store.h"
65 #include "net/http/transport_security_state.h" 65 #include "net/http/transport_security_state.h"
66 #include "net/ssl/channel_id_service.h" 66 #include "net/ssl/channel_id_service.h"
67 #include "net/ssl/channel_id_store.h" 67 #include "net/ssl/channel_id_store.h"
68 #include "net/url_request/url_request_context.h" 68 #include "net/url_request/url_request_context.h"
69 #include "net/url_request/url_request_context_getter.h" 69 #include "net/url_request/url_request_context_getter.h"
70 #include "storage/browser/quota/special_storage_policy.h" 70 #include "storage/browser/quota/special_storage_policy.h"
71 #include "url/origin.h" 71 #include "url/origin.h"
72 72
73 #if defined(OS_ANDROID) 73 #if defined(OS_ANDROID)
74 #include "chrome/browser/android/webapps/webapp_registry.h"
74 #include "chrome/browser/precache/precache_manager_factory.h" 75 #include "chrome/browser/precache/precache_manager_factory.h"
75 #include "components/precache/content/precache_manager.h" 76 #include "components/precache/content/precache_manager.h"
76 #endif 77 #endif
77 78
78 #if defined(OS_CHROMEOS) 79 #if defined(OS_CHROMEOS)
79 #include "chrome/browser/chromeos/profiles/profile_helper.h" 80 #include "chrome/browser/chromeos/profiles/profile_helper.h"
80 #include "chromeos/attestation/attestation_constants.h" 81 #include "chromeos/attestation/attestation_constants.h"
81 #include "chromeos/dbus/cryptohome_client.h" 82 #include "chromeos/dbus/cryptohome_client.h"
82 #include "chromeos/dbus/dbus_thread_manager.h" 83 #include "chromeos/dbus/dbus_thread_manager.h"
83 #include "components/user_manager/user.h" 84 #include "components/user_manager/user.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 mode = domain_reliability::CLEAR_BEACONS; 754 mode = domain_reliability::CLEAR_BEACONS;
754 755
755 waiting_for_clear_domain_reliability_monitor_ = true; 756 waiting_for_clear_domain_reliability_monitor_ = true;
756 service->ClearBrowsingData( 757 service->ClearBrowsingData(
757 mode, 758 mode,
758 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, 759 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor,
759 base::Unretained(this))); 760 base::Unretained(this)));
760 } 761 }
761 } 762 }
762 763
764 #if defined(OS_ANDROID)
765 if (remove_mask & REMOVE_WEBAPP_DATA) {
766 waiting_for_clear_webapp_data_ = true;
767 BrowserThread::PostTask(
768 BrowserThread::IO,
769 FROM_HERE,
770 base::Bind(&WebappRegistry::CleanupWebappsOnIOThread,
mlamouri (slow - plz ping) 2015/09/08 10:03:00 nit: I would call the method ClearWebapps... or De
Lalit Maganti 2015/09/08 10:44:28 Gone with Unregister to match Java.
771 base::Bind(&BrowsingDataRemover::OnClearedWebappData,
772 base::Unretained(this))));
773 }
774 #endif
775
763 // Record the combined deletion of cookies and cache. 776 // Record the combined deletion of cookies and cache.
764 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE; 777 CookieOrCacheDeletionChoice choice = NEITHER_COOKIES_NOR_CACHE;
765 if (remove_mask & REMOVE_COOKIES && 778 if (remove_mask & REMOVE_COOKIES &&
766 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) { 779 origin_type_mask_ & BrowsingDataHelper::UNPROTECTED_WEB) {
767 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE 780 choice = remove_mask & REMOVE_CACHE ? BOTH_COOKIES_AND_CACHE
768 : ONLY_COOKIES; 781 : ONLY_COOKIES;
769 } else if (remove_mask & REMOVE_CACHE) { 782 } else if (remove_mask & REMOVE_CACHE) {
770 choice = ONLY_CACHE; 783 choice = ONLY_CACHE;
771 } 784 }
772 785
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 !waiting_for_clear_keyword_data_ && 846 !waiting_for_clear_keyword_data_ &&
834 !waiting_for_clear_nacl_cache_ && 847 !waiting_for_clear_nacl_cache_ &&
835 !waiting_for_clear_network_predictor_ && 848 !waiting_for_clear_network_predictor_ &&
836 !waiting_for_clear_networking_history_ && 849 !waiting_for_clear_networking_history_ &&
837 !waiting_for_clear_passwords_ && 850 !waiting_for_clear_passwords_ &&
838 !waiting_for_clear_platform_keys_ && 851 !waiting_for_clear_platform_keys_ &&
839 !waiting_for_clear_plugin_data_ && 852 !waiting_for_clear_plugin_data_ &&
840 !waiting_for_clear_pnacl_cache_ && 853 !waiting_for_clear_pnacl_cache_ &&
841 #if defined(OS_ANDROID) 854 #if defined(OS_ANDROID)
842 !waiting_for_clear_precache_history_ && 855 !waiting_for_clear_precache_history_ &&
856 !waiting_for_clear_webapp_data_ &&
843 #endif 857 #endif
844 #if defined(ENABLE_WEBRTC) 858 #if defined(ENABLE_WEBRTC)
845 !waiting_for_clear_webrtc_logs_ && 859 !waiting_for_clear_webrtc_logs_ &&
846 #endif 860 #endif
847 !waiting_for_clear_storage_partition_data_; 861 !waiting_for_clear_storage_partition_data_;
848 } 862 }
849 863
850 void BrowsingDataRemover::OnKeywordsLoaded() { 864 void BrowsingDataRemover::OnKeywordsLoaded() {
851 // Deletes the entries from the model, and if we're not waiting on anything 865 // Deletes the entries from the model, and if we're not waiting on anything
852 // else notifies observers and deletes this BrowsingDataRemover. 866 // else notifies observers and deletes this BrowsingDataRemover.
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 NotifyAndDeleteIfDone(); 1139 NotifyAndDeleteIfDone();
1126 } 1140 }
1127 #endif 1141 #endif
1128 1142
1129 #if defined(OS_ANDROID) 1143 #if defined(OS_ANDROID)
1130 void BrowsingDataRemover::OnClearedPrecacheHistory() { 1144 void BrowsingDataRemover::OnClearedPrecacheHistory() {
1131 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1145 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1132 waiting_for_clear_precache_history_ = false; 1146 waiting_for_clear_precache_history_ = false;
1133 NotifyAndDeleteIfDone(); 1147 NotifyAndDeleteIfDone();
1134 } 1148 }
1149
1150 void BrowsingDataRemover::OnClearedWebappData() {
1151 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1152 waiting_for_clear_webapp_data_ = false;
1153 NotifyAndDeleteIfDone();
1154 }
1135 #endif 1155 #endif
1136 1156
1137 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1157 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1138 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1158 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1139 waiting_for_clear_domain_reliability_monitor_ = false; 1159 waiting_for_clear_domain_reliability_monitor_ = false;
1140 NotifyAndDeleteIfDone(); 1160 NotifyAndDeleteIfDone();
1141 } 1161 }
1142 1162
1143 // static 1163 // static
1144 BrowsingDataRemover::CallbackSubscription 1164 BrowsingDataRemover::CallbackSubscription
1145 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( 1165 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback(
1146 const BrowsingDataRemover::Callback& callback) { 1166 const BrowsingDataRemover::Callback& callback) {
1147 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); 1167 return GetOnBrowsingDataRemovedCallbacks()->Add(callback);
1148 } 1168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698