| 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);
|
| +}
|
|
|