OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/supports_user_data.h" | |
11 #include "content/common/content_export.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" | |
13 #include "webkit/glue/resource_type.h" | |
14 | |
15 namespace net { | |
16 class URLRequest; | |
17 } | |
18 | |
19 namespace content { | |
20 class ResourceContext; | |
21 | |
22 // Each URLRequest allocated by the ResourceDispatcherHost has a | |
23 // ResourceRequestInfo instance associated with it. | |
24 class ResourceRequestInfo : public base::SupportsUserData::Data { | |
25 public: | |
26 // Returns the ResourceRequestInfo associated with the given URLRequest. | |
27 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( | |
28 const net::URLRequest* request); | |
29 | |
30 // Adds a new, dummy ResourceRequestInfo to the given URLRequest. | |
31 // NOTE: Add parameters if you need to initialize other fields. | |
32 CONTENT_EXPORT static void DecorateForTesting( | |
darin (slow to review)
2012/03/06 18:08:23
Maybe "Decorate" is an abnormal term here. Previo
jam
2012/03/06 18:48:57
I preferred the CreateForTesting since it's easier
| |
33 net::URLRequest* request, | |
34 ResourceContext* context); | |
35 | |
36 // Returns the associated ResourceContext. | |
37 virtual ResourceContext* GetContext() const = 0; | |
38 | |
39 // The child process unique ID of the requestor. | |
40 virtual int GetChildID() const = 0; | |
41 | |
42 // The IPC route identifier for this request (this identifies the RenderView | |
43 // or like-thing in the renderer that the request gets routed to). | |
44 virtual int GetRouteID() const = 0; | |
45 | |
46 // The pid of the originating process, if the request is sent on behalf of a | |
47 // another process. Otherwise it is 0. | |
48 virtual int GetOriginPID() const = 0; | |
49 | |
50 // Unique identifier (within the scope of the child process) for this request. | |
51 virtual int GetRequestID() const = 0; | |
52 | |
53 // True if GetFrameID() represents a main frame in the RenderView. | |
54 virtual bool IsMainFrame() const = 0; | |
55 | |
56 // Frame ID that sent this resource request. -1 if unknown / invalid. | |
57 virtual int64 GetFrameID() const = 0; | |
58 | |
59 // True if GetParentFrameID() represents a main frame in the RenderView. | |
60 virtual bool ParentIsMainFrame() const = 0; | |
61 | |
62 // Frame ID of parent frame of frame that sent this resource request. | |
63 // -1 if unknown / invalid. | |
64 virtual int64 GetParentFrameID() const = 0; | |
65 | |
66 // Returns the associated resource type. | |
67 virtual ResourceType::Type GetResourceType() const = 0; | |
68 | |
69 // Returns the associated referrer policy. | |
70 virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const = 0; | |
71 | |
72 // When there is upload data, this is the byte count of that data. When there | |
73 // is no upload, this will be 0. | |
74 virtual uint64 GetUploadSize() const = 0; | |
75 | |
76 // Returns false if there is NOT an associated render view. | |
77 virtual bool GetAssociatedRenderView(int* render_process_id, | |
78 int* render_view_id) const = 0; | |
79 | |
80 protected: | |
81 virtual ~ResourceRequestInfo() {} | |
82 }; | |
83 | |
84 } // namespace content | |
85 | |
86 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | |
OLD | NEW |