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 | |
8 #include "base/basictypes.h" | |
9 #include "base/supports_user_data.h" | |
10 #include "content/common/content_export.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" | |
12 #include "webkit/glue/resource_type.h" | |
13 | |
14 namespace net { | |
15 class URLRequest; | |
16 } | |
17 | |
18 namespace content { | |
19 class ResourceContext; | |
20 | |
21 class ResourceRequestInfo : public base::SupportsUserData::Data { | |
jam
2012/03/05 07:16:17
nit: please add a little comment about what this c
| |
22 public: | |
23 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( | |
24 const net::URLRequest* request); | |
25 | |
26 CONTENT_EXPORT static ResourceRequestInfo* CreateForTesting( | |
27 ResourceContext* context); | |
28 | |
29 ResourceContext* context() const { return context_; } | |
jam
2012/03/05 07:16:17
for the Content API, we have tried to be strict th
| |
30 | |
31 // The child process unique ID of the requestor. | |
32 int child_id() const { return child_id_; } | |
33 | |
34 // The IPC route identifier for this request (this identifies the RenderView | |
35 // or like-thing in the renderer that the request gets routed to). | |
36 int route_id() const { return route_id_; } | |
37 | |
38 // The pid of the originating process, if the request is sent on behalf of a | |
39 // another process. Otherwise it is 0. | |
40 int origin_pid() const { return origin_pid_; } | |
41 | |
42 // Unique identifier (within the scope of the child process) for this request. | |
43 int request_id() const { return request_id_; } | |
44 | |
45 // True if |frame_id_| represents a main frame in the RenderView. | |
46 bool is_main_frame() const { return is_main_frame_; } | |
47 | |
48 // Frame ID that sent this resource request. -1 if unknown / invalid. | |
49 int64 frame_id() const { return frame_id_; } | |
50 | |
51 // True if |parent_frame_id_| represents a main frame in the RenderView. | |
52 bool parent_is_main_frame() const { return parent_is_main_frame_; } | |
53 | |
54 // Frame ID of parent frame of frame that sent this resource request. | |
55 // -1 if unknown / invalid. | |
56 int64 parent_frame_id() const { return parent_frame_id_; } | |
57 | |
58 ResourceType::Type resource_type() const { return resource_type_; } | |
59 | |
60 WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } | |
61 | |
62 // When there is upload data, this is the byte count of that data. When there | |
63 // is no upload, this will be 0. | |
64 uint64 upload_size() const { return upload_size_; } | |
65 | |
66 // Returns false if there is not an associated render view. | |
67 virtual bool GetAssociatedRenderView(int* render_process_id, | |
68 int* render_view_id) const = 0; | |
69 | |
70 protected: | |
71 ResourceRequestInfo(ResourceContext* context, | |
72 int child_id, | |
73 int route_id, | |
74 int origin_pid, | |
75 int request_id, | |
76 bool is_main_frame, | |
77 int64 frame_id, | |
78 bool parent_is_main_frame, | |
79 int64 parent_frame_id, | |
80 ResourceType::Type resource_type, | |
81 WebKit::WebReferrerPolicy referrer_policy, | |
82 uint64 upload_size); | |
83 virtual ~ResourceRequestInfo(); | |
84 | |
85 ResourceContext* context_; | |
86 int child_id_; | |
87 int route_id_; | |
88 int origin_pid_; | |
89 int request_id_; | |
90 int64 frame_id_; | |
91 int64 parent_frame_id_; | |
92 bool is_main_frame_; | |
93 bool parent_is_main_frame_; | |
94 ResourceType::Type resource_type_; | |
95 WebKit::WebReferrerPolicy referrer_policy_; | |
96 uint64 upload_size_; | |
97 }; | |
98 | |
99 } // namespace content | |
100 | |
101 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | |
OLD | NEW |