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. 4 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ 7 8 #include "base/supports_user_data.h" 9 10 namespace net { 11 class URLRequest; 12 } 13 14 class ChromeURLRequestUserData : public base::SupportsUserData::Data { 15 public: 16 bool is_prerender() const { return is_prerender_; } 17 void set_is_prerender(bool is_prerender) { is_prerender_ = is_prerender; } 18 19 // Creates a new ChromeURLRequestUserData instance and attaches it 20 // to |request|. |request| must not have an existing ChromeURLRequestUserData 21 // instance attached to it, and must be non-NULL. The returned instance 22 // is owned by |request|. 23 static ChromeURLRequestUserData* Create(net::URLRequest* request); 24 25 // Delete the ChromeURLRequestUserData from a |request|. |request| must be 26 // non-NULL. 27 static void Delete(net::URLRequest* request); 28 29 // Gets the ChromeURLRequestUserData instance attached to |request|, or 30 // returns NULL if one is not attached. |request| must be non-NULL. 31 static ChromeURLRequestUserData* Get(const net::URLRequest* request); 32 33 private: 34 ChromeURLRequestUserData(); 35 36 bool is_prerender_; 37 38 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestUserData); 39 }; 40 41 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ 42