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

Unified Diff: net/http/http_auth_cache.cc

Issue 2097043002: Clear HTTP auth data on clearing browsing data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete within time period + delete with cookies and passwords Created 4 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 side-by-side diff with in-line comments
Download patch
« net/http/http_auth_cache.h ('K') | « net/http/http_auth_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_cache.cc
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc
index 7a3a4e0f6714cb9b927af8d6c17fad4d0e8c12ae..71d5082c1d85b629ffe877db5174cfa0c8e5be5e 100644
--- a/net/http/http_auth_cache.cc
+++ b/net/http/http_auth_cache.cc
@@ -252,8 +252,24 @@ bool HttpAuthCache::Remove(const GURL& origin,
return false;
}
-void HttpAuthCache::Clear() {
- entries_.clear();
+void HttpAuthCache::Clear(base::Time delete_begin, base::Time delete_end) {
+ int64_t begin_millis =
+ delete_begin.is_null()
+ ? 0
+ : (delete_begin - base::Time::UnixEpoch()).InMilliseconds();
msramek 2016/06/30 11:36:20 Can you use base::Time::ToTimeT() to do these conv
Tomasz Moniuszko 2016/07/01 12:44:02 There's a TODO saying base::Time::ToTimeT() should
msramek 2016/07/01 13:19:40 I would say yes. The TODO says that the function s
Tomasz Moniuszko 2016/07/01 14:54:39 Done.
+ int64_t end_millis =
+ delete_end.is_null()
+ ? std::numeric_limits<int64_t>::max()
+ : (delete_end - base::Time::UnixEpoch()).InMilliseconds();
+
+ base::TimeTicks unix_epoch = base::TimeTicks::UnixEpoch();
+
+ entries_.remove_if(
+ [begin_millis, end_millis, unix_epoch](const Entry& entry) {
+ int64_t creation_millis =
+ (entry.creation_time_ - unix_epoch).InMilliseconds();
+ return creation_millis >= begin_millis && creation_millis <= end_millis;
msramek 2016/06/30 11:36:20 BrowsingDataRemover always uses half-closed interv
Tomasz Moniuszko 2016/07/01 12:44:02 Done.
+ });
}
bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin,
« net/http/http_auth_cache.h ('K') | « net/http/http_auth_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698