| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/url_request/url_request.h" | 9 #include "base/supports_user_data.h" |
| 10 | 10 |
| 11 class ChromeURLRequestUserData : public net::URLRequest::UserData { | 11 namespace net { |
| 12 class URLRequest; |
| 13 } |
| 14 |
| 15 class ChromeURLRequestUserData : public base::SupportsUserData::Data { |
| 12 public: | 16 public: |
| 13 bool is_prerender() const { return is_prerender_; } | 17 bool is_prerender() const { return is_prerender_; } |
| 14 void set_is_prerender(bool is_prerender) { is_prerender_ = is_prerender; } | 18 void set_is_prerender(bool is_prerender) { is_prerender_ = is_prerender; } |
| 15 | 19 |
| 16 // Creates a new ChromeURLRequestUserData instance and attaches it | 20 // Creates a new ChromeURLRequestUserData instance and attaches it |
| 17 // to |request|. |request| must not have an existing ChromeURLRequestUserData | 21 // to |request|. |request| must not have an existing ChromeURLRequestUserData |
| 18 // instance attached to it, and must be non-NULL. The returned instance | 22 // instance attached to it, and must be non-NULL. The returned instance |
| 19 // is owned by |request|. | 23 // is owned by |request|. |
| 20 static ChromeURLRequestUserData* Create(net::URLRequest* request); | 24 static ChromeURLRequestUserData* Create(net::URLRequest* request); |
| 21 | 25 |
| 22 // Delete the ChromeURLRequestUserData from a |request|. |request| must be | 26 // Delete the ChromeURLRequestUserData from a |request|. |request| must be |
| 23 // non-NULL. | 27 // non-NULL. |
| 24 static void Delete(net::URLRequest* request); | 28 static void Delete(net::URLRequest* request); |
| 25 | 29 |
| 26 // Gets the ChromeURLRequestUserData instance attached to |request|, or | 30 // Gets the ChromeURLRequestUserData instance attached to |request|, or |
| 27 // returns NULL if one is not attached. |request| must be non-NULL. | 31 // returns NULL if one is not attached. |request| must be non-NULL. |
| 28 static ChromeURLRequestUserData* Get(const net::URLRequest* request); | 32 static ChromeURLRequestUserData* Get(const net::URLRequest* request); |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 ChromeURLRequestUserData(); | 35 ChromeURLRequestUserData(); |
| 32 | 36 |
| 33 bool is_prerender_; | 37 bool is_prerender_; |
| 34 | 38 |
| 35 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestUserData); | 39 DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestUserData); |
| 36 }; | 40 }; |
| 37 | 41 |
| 38 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ | 42 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_URL_REQUEST_USER_DATA_H_ |
| OLD | NEW |