Fix build break
[chromium-blink-merge.git] / chrome / browser / renderer_host / chrome_url_request_user_data.cc
bloba1609e04bd2ac1f30e88b5a2761292080d528c64
1 // Copyright (c) 2011 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.
5 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h"
7 #include "net/url_request/url_request.h"
9 namespace {
11 const char* const kKeyName = "chrome_url_request_user_data";
13 } // namespace
15 ChromeURLRequestUserData::ChromeURLRequestUserData()
16 : is_prerender_(false) {
19 // static
20 ChromeURLRequestUserData* ChromeURLRequestUserData::Get(
21 const net::URLRequest* request) {
22 DCHECK(request);
23 return static_cast<ChromeURLRequestUserData*>(request->GetUserData(kKeyName));
26 // static
27 ChromeURLRequestUserData* ChromeURLRequestUserData::Create(
28 net::URLRequest* request) {
29 DCHECK(request);
30 DCHECK(!Get(request));
31 ChromeURLRequestUserData* user_data = new ChromeURLRequestUserData();
32 request->SetUserData(kKeyName, user_data);
33 return user_data;
36 // static
37 void ChromeURLRequestUserData::Delete(net::URLRequest* request) {
38 DCHECK(request);
39 request->SetUserData(kKeyName, NULL);