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

Unified Diff: content/browser/net/quota_policy_server_bound_cert_store.cc

Issue 381073002: Move sqlite_channel_id_store from chrome/browser/net to net/extras. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added content/browser/net/quota_policyserver_bound_cert_store... Created 6 years, 5 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/browser/net/quota_policy_server_bound_cert_store.cc
diff --git a/content/browser/net/quota_policy_server_bound_cert_store.cc b/content/browser/net/quota_policy_server_bound_cert_store.cc
new file mode 100644
index 0000000000000000000000000000000000000000..33ef89d6382e41f0e972aec5acdb21c881ef7e50
--- /dev/null
+++ b/content/browser/net/quota_policy_server_bound_cert_store.cc
@@ -0,0 +1,79 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/net/quota_policy_server_bound_cert_store.h"
+
+#include <list>
+#include <set>
+
+#include "base/basictypes.h"
+#include "base/bind.h"
+#include "base/file_util.h"
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/metrics/histogram.h"
+#include "base/strings/string_util.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
+#include "net/cookies/cookie_util.h"
+#include "net/util/sqlite/sqlite_server_bound_cert_store.h"
+#include "url/gurl.h"
+#include "webkit/browser/quota/special_storage_policy.h"
+
+namespace content {
+
+QuotaPolicyServerBoundCertStore::QuotaPolicyServerBoundCertStore(
+ const base::FilePath& path,
+ const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
+ quota::SpecialStoragePolicy* special_storage_policy)
+ : force_keep_session_state_(false),
+ special_storage_policy_(special_storage_policy),
+ persistent_(
+ new net::SQLiteServerBoundCertStore(path, background_task_runner)),
+ temporary_(
+ new net::SQLiteServerBoundCertStore(path, background_task_runner)) {
+}
+
+QuotaPolicyServerBoundCertStore::~QuotaPolicyServerBoundCertStore() {
+ // TODO(mef): delete temporary file.
+ // temporary_.release();
+}
+
+void QuotaPolicyServerBoundCertStore::Load(
+ const LoadedCallback& loaded_callback) {
+ persistent_->Load(loaded_callback);
+}
+
+void QuotaPolicyServerBoundCertStore::AddServerBoundCert(
+ const net::DefaultServerBoundCertStore::ServerBoundCert& cert) {
+ if (IsStorageSessionOnly(cert)) {
+ temporary_->AddServerBoundCert(cert);
+ } else {
+ persistent_->AddServerBoundCert(cert);
+ }
+}
+
+void QuotaPolicyServerBoundCertStore::DeleteServerBoundCert(
+ const net::DefaultServerBoundCertStore::ServerBoundCert& cert) {
+ if (IsStorageSessionOnly(cert)) {
+ temporary_->DeleteServerBoundCert(cert);
+ } else {
+ persistent_->DeleteServerBoundCert(cert);
+ }
+}
+
+void QuotaPolicyServerBoundCertStore::SetForceKeepSessionState() {
+ force_keep_session_state_ = true;
+}
+
+bool QuotaPolicyServerBoundCertStore::IsStorageSessionOnly(
+ const net::DefaultServerBoundCertStore::ServerBoundCert& cert) {
+ if (force_keep_session_state_ || !special_storage_policy_.get())
+ return false;
+ const GURL url(
+ net::cookie_util::CookieOriginToURL(cert.server_identifier(), true));
+ return !url.is_valid() || !special_storage_policy_->IsStorageSessionOnly(url);
Ryan Sleevi 2014/07/24 23:47:32 What about certs that the ssp decides later are Is
mef 2014/07/30 22:12:05 Good question, I actually don't know. I imagine t
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698