summaryrefslogtreecommitdiffstats
path: root/net/base/force_tls_state.cc
blob: 4be33f550c34801142ea0c2e949bcda5cc402be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2009 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 "net/base/force_tls_state.h"

#include "base/logging.h"
#include "googleurl/src/gurl.h"
#include "net/base/registry_controlled_domain.h"

namespace net {

ForceTLSState::ForceTLSState() {
}

void ForceTLSState::DidReceiveHeader(const GURL& url,
                                     const std::string& value) {
  // TODO(abarth): Actually parse |value| once the spec settles down.
  EnableHost(url.host());
}

void ForceTLSState::EnableHost(const std::string& host) {
  // TODO(abarth): Canonicalize host.
  AutoLock lock(lock_);
  enabled_hosts_.insert(host);
}

bool ForceTLSState::IsEnabledForHost(const std::string& host) {
  // TODO(abarth): Canonicalize host.
  AutoLock lock(lock_);
  return enabled_hosts_.find(host) != enabled_hosts_.end();
}

}  // namespace