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

Unified Diff: content/test/mock_ssl_host_state_delegate.cc

Issue 2292443003: Support host-based deletion for SSLHostStateDelegate (Closed)
Patch Set: Revert changes in ContentSettingPattern, convert pattern directly to URL 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: content/test/mock_ssl_host_state_delegate.cc
diff --git a/content/test/mock_ssl_host_state_delegate.cc b/content/test/mock_ssl_host_state_delegate.cc
index 68383d37596d24b5d6ae75cbb6820ef763af6a71..590eaf5172a675d23c5768bf1a6bfd6b3cddc35c 100644
--- a/content/test/mock_ssl_host_state_delegate.cc
+++ b/content/test/mock_ssl_host_state_delegate.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/callback.h"
#include "content/test/mock_ssl_host_state_delegate.h"
namespace content {
@@ -16,8 +17,20 @@ void MockSSLHostStateDelegate::AllowCert(const std::string& host,
exceptions_.insert(host);
}
-void MockSSLHostStateDelegate::Clear() {
- exceptions_.clear();
+void MockSSLHostStateDelegate::Clear(
+ const base::Callback<bool(const std::string&)>& host_filter) {
+ if (host_filter.is_null()) {
+ exceptions_.clear();
+ } else {
+ for (auto it = exceptions_.begin(); it != exceptions_.end();) {
+ auto next_it = std::next(it);
+
+ if (host_filter.Run(*it))
+ exceptions_.erase(it);
+
+ it = next_it;
+ }
+ }
}
SSLHostStateDelegate::CertJudgment MockSSLHostStateDelegate::QueryPolicy(

Powered by Google App Engine
This is Rietveld 408576698