summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host/chrome_url_request_user_data.cc
blob: aeabcd1285e7b4235d8acc7c3e6d01890a8bbd17 (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
// 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.

#include "chrome/browser/renderer_host/chrome_url_request_user_data.h"

namespace {

const char* const kKeyName = "chrome_url_request_user_data";

}  // namespace

ChromeURLRequestUserData::ChromeURLRequestUserData()
    : is_prerender_(false) {
}

// static
ChromeURLRequestUserData* ChromeURLRequestUserData::Get(
    const net::URLRequest* request) {
  DCHECK(request);
  return static_cast<ChromeURLRequestUserData*>(request->GetUserData(kKeyName));
}

// static
ChromeURLRequestUserData* ChromeURLRequestUserData::Create(
    net::URLRequest* request) {
  DCHECK(request);
  DCHECK(!Get(request));
  ChromeURLRequestUserData* user_data = new ChromeURLRequestUserData();
  request->SetUserData(kKeyName, user_data);
  return user_data;
}