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"
11 const char* const kKeyName
= "chrome_url_request_user_data";
15 ChromeURLRequestUserData::ChromeURLRequestUserData()
16 : is_prerender_(false) {
20 ChromeURLRequestUserData
* ChromeURLRequestUserData::Get(
21 const net::URLRequest
* request
) {
23 return static_cast<ChromeURLRequestUserData
*>(request
->GetUserData(kKeyName
));
27 ChromeURLRequestUserData
* ChromeURLRequestUserData::Create(
28 net::URLRequest
* request
) {
30 DCHECK(!Get(request
));
31 ChromeURLRequestUserData
* user_data
= new ChromeURLRequestUserData();
32 request
->SetUserData(kKeyName
, user_data
);
37 void ChromeURLRequestUserData::Delete(net::URLRequest
* request
) {
39 request
->SetUserData(kKeyName
, NULL
);