diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 20:04:00 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-28 20:04:00 +0000 |
commit | cba28128961e7ced20665dbf1758bb826610c623 (patch) | |
tree | 845b41a78bf3a6e26c5876dd1ddc107ef0c93bff /chrome/browser/transport_security_persister.cc | |
parent | a5345be658a27aed8bdd0a4b79672d4f93313922 (diff) | |
download | chromium_src-cba28128961e7ced20665dbf1758bb826610c623.zip chromium_src-cba28128961e7ced20665dbf1758bb826610c623.tar.gz chromium_src-cba28128961e7ced20665dbf1758bb826610c623.tar.bz2 |
Honor pre-existing HSTS metadata in Incognito mode, but obviously continue to
never persist any metadata to disk.
See the bug for a detailed discussion of the tradeoffs.
BUG=77436
TEST=see bug
Review URL: http://codereview.chromium.org/6746003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/transport_security_persister.cc')
-rw-r--r-- | chrome/browser/transport_security_persister.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/browser/transport_security_persister.cc b/chrome/browser/transport_security_persister.cc index c236aed..7b503b3 100644 --- a/chrome/browser/transport_security_persister.cc +++ b/chrome/browser/transport_security_persister.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -12,8 +12,9 @@ #include "content/browser/browser_thread.h" #include "net/base/transport_security_state.h" -TransportSecurityPersister::TransportSecurityPersister() - : ALLOW_THIS_IN_INITIALIZER_LIST(save_coalescer_(this)) { +TransportSecurityPersister::TransportSecurityPersister(bool readonly) + : ALLOW_THIS_IN_INITIALIZER_LIST(save_coalescer_(this)), + readonly_(readonly) { } TransportSecurityPersister::~TransportSecurityPersister() { @@ -63,6 +64,9 @@ void TransportSecurityPersister::StateIsDirty( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(state == transport_security_state_); + if (readonly_) + return; + if (!save_coalescer_.empty()) return; @@ -86,6 +90,7 @@ void TransportSecurityPersister::Save() { void TransportSecurityPersister::CompleteSave(const std::string& state) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); + DCHECK(!readonly_); file_util::WriteFile(state_file_, state.data(), state.size()); } |