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

Unified Diff: android_webview/browser/aw_ssl_host_state_delegate.cc

Issue 2292443003: Support host-based deletion for SSLHostStateDelegate (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_ssl_host_state_delegate.cc
diff --git a/android_webview/browser/aw_ssl_host_state_delegate.cc b/android_webview/browser/aw_ssl_host_state_delegate.cc
index a3a4119a3efb10b137942c13d8067de5a126e9d8..9fc8b812ad949b9b90730b1693a5996d8ee0103b 100644
--- a/android_webview/browser/aw_ssl_host_state_delegate.cc
+++ b/android_webview/browser/aw_ssl_host_state_delegate.cc
@@ -4,6 +4,7 @@
#include "android_webview/browser/aw_ssl_host_state_delegate.h"
+#include "base/callback.h"
#include "net/base/hash_value.h"
using content::SSLHostStateDelegate;
@@ -76,8 +77,21 @@ void AwSSLHostStateDelegate::AllowCert(const std::string& host,
cert_policy_for_host_[host].Allow(cert, error);
}
-void AwSSLHostStateDelegate::Clear() {
- cert_policy_for_host_.clear();
+void AwSSLHostStateDelegate::Clear(
+ const base::Callback<bool(const std::string&)>& host_filter) {
+ if (host_filter.IsNull()) {
+ cert_policy_for_host_.clear();
+ return;
+ }
+
+ for (auto it = cert_policy_for_host_.begin(); it != cert_policy_map_.end();) {
estark 2016/08/30 01:52:15 |cert_policy_map_| doesn't appear to be a thing; g
msramek 2016/08/30 14:39:41 Done. Of course I didn't get a compilation error s
+ auto next_it = std::next(it);
+
+ if (host_filter.Run(it->first))
+ cert_policy_for_host_.erase(it);
+
+ it = next_it;
+ }
}
SSLHostStateDelegate::CertJudgment AwSSLHostStateDelegate::QueryPolicy(

Powered by Google App Engine
This is Rietveld 408576698