| OLD | NEW |
| (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 } |
| OLD | NEW |