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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/net/clear_on_exit_policy.h"
6
7 #include "content/public/common/url_constants.h"
8 #include "googleurl/src/gurl.h"
9 #include "webkit/quota/special_storage_policy.h"
10
11 ClearOnExitPolicy::ClearOnExitPolicy(
12 quota::SpecialStoragePolicy* special_storage_policy)
13 : special_storage_policy_(special_storage_policy) {
14 }
15
16 ClearOnExitPolicy::~ClearOnExitPolicy() {
17 }
18
19 bool ClearOnExitPolicy::HasClearOnExitOrigins() {
20 return special_storage_policy_.get() &&
21 special_storage_policy_->HasSessionOnlyOrigins();
22 }
23
24 bool ClearOnExitPolicy::ShouldClearOriginOnExit(const std::string& domain,
25 bool scheme_is_secure) {
26 if (domain.length() == 0)
27 return false;
28
29 std::string scheme =
30 scheme_is_secure ? chrome::kHttpsScheme : chrome::kHttpScheme;
31 std::string host = domain[0] == '.' ? domain.substr(1) : domain;
32 GURL url(scheme + content::kStandardSchemeSeparator + host);
33
34 return special_storage_policy_->IsStorageSessionOnly(url) &&
35 !special_storage_policy_->IsStorageProtected(url);
36 }
OLDNEW
« 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