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

Unified Diff: chrome/browser/net/clear_on_exit_policy.cc

Issue 10407124: Don't force non-session only cookies to be session only cookies, instead delete on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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
« no previous file with comments | « chrome/browser/net/clear_on_exit_policy.h ('k') | chrome/browser/net/clear_on_exit_policy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/clear_on_exit_policy.cc
diff --git a/chrome/browser/net/clear_on_exit_policy.cc b/chrome/browser/net/clear_on_exit_policy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d3955144c25916fb6517985034f8cb43a85a0a5
--- /dev/null
+++ b/chrome/browser/net/clear_on_exit_policy.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 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 "chrome/browser/net/clear_on_exit_policy.h"
+
+#include "content/public/common/url_constants.h"
+#include "googleurl/src/gurl.h"
+#include "webkit/quota/special_storage_policy.h"
+
+ClearOnExitPolicy::ClearOnExitPolicy(
+ quota::SpecialStoragePolicy* special_storage_policy)
+ : special_storage_policy_(special_storage_policy) {
+}
+
+ClearOnExitPolicy::~ClearOnExitPolicy() {
+}
+
+bool ClearOnExitPolicy::HasClearOnExitOrigins() {
+ return special_storage_policy_.get() &&
+ special_storage_policy_->HasSessionOnlyOrigins();
+}
+
+bool ClearOnExitPolicy::ShouldClearOriginOnExit(const std::string& domain,
+ bool scheme_is_secure) {
+ if (domain.length() == 0)
+ return false;
+
+ std::string scheme =
+ scheme_is_secure ? chrome::kHttpsScheme : chrome::kHttpScheme;
+ std::string host = domain[0] == '.' ? domain.substr(1) : domain;
+ GURL url(scheme + content::kStandardSchemeSeparator + host);
+
+ return special_storage_policy_->IsStorageSessionOnly(url) &&
+ !special_storage_policy_->IsStorageProtected(url);
+}
« no previous file with comments | « chrome/browser/net/clear_on_exit_policy.h ('k') | chrome/browser/net/clear_on_exit_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698