Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: content/browser/renderer_host/resource_request_info_impl.h

Issue 11414299: Add content/browser/loader/ for resource loading related classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/supports_user_data.h"
14 #include "content/public/browser/resource_request_info.h"
15 #include "content/public/common/page_transition_types.h"
16 #include "content/public/common/process_type.h"
17 #include "content/public/common/referrer.h"
18 #include "net/base/load_states.h"
19 #include "webkit/glue/resource_type.h"
20
21 namespace webkit_blob {
22 class BlobData;
23 }
24
25 namespace content {
26 class AsyncResourceHandler;
27 class CrossSiteResourceHandler;
28 class ResourceContext;
29 struct GlobalRequestID;
30
31 // Holds the data ResourceDispatcherHost associates with each request.
32 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest.
33 class ResourceRequestInfoImpl : public ResourceRequestInfo,
34 public base::SupportsUserData::Data {
35 public:
36 // Returns the ResourceRequestInfoImpl associated with the given URLRequest.
37 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest(
38 net::URLRequest* request);
39
40 // And, a const version for cases where you only need read access.
41 static const ResourceRequestInfoImpl* ForRequest(
42 const net::URLRequest* request);
43
44 CONTENT_EXPORT ResourceRequestInfoImpl(
45 ProcessType process_type,
46 int child_id,
47 int route_id,
48 int origin_pid,
49 int request_id,
50 bool is_main_frame,
51 int64 frame_id,
52 bool parent_is_main_frame,
53 int64 parent_frame_id,
54 ResourceType::Type resource_type,
55 PageTransition transition_type,
56 bool is_download,
57 bool allow_download,
58 bool has_user_gesture,
59 WebKit::WebReferrerPolicy referrer_policy,
60 ResourceContext* context);
61 virtual ~ResourceRequestInfoImpl();
62
63 // ResourceRequestInfo implementation:
64 virtual ResourceContext* GetContext() const OVERRIDE;
65 virtual int GetChildID() const OVERRIDE;
66 virtual int GetRouteID() const OVERRIDE;
67 virtual int GetOriginPID() const OVERRIDE;
68 virtual int GetRequestID() const OVERRIDE;
69 virtual bool IsMainFrame() const OVERRIDE;
70 virtual int64 GetFrameID() const OVERRIDE;
71 virtual bool ParentIsMainFrame() const OVERRIDE;
72 virtual int64 GetParentFrameID() const OVERRIDE;
73 virtual ResourceType::Type GetResourceType() const OVERRIDE;
74 virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE;
75 virtual bool HasUserGesture() const OVERRIDE;
76 virtual bool WasIgnoredByHandler() const OVERRIDE;
77 virtual bool GetAssociatedRenderView(int* render_process_id,
78 int* render_view_id) const OVERRIDE;
79 virtual bool IsAsync() const OVERRIDE;
80
81
82 void AssociateWithRequest(net::URLRequest* request);
83
84 GlobalRequestID GetGlobalRequestID() const;
85
86 // CrossSiteResourceHandler for this request. May be null.
87 CrossSiteResourceHandler* cross_site_handler() {
88 return cross_site_handler_;
89 }
90 void set_cross_site_handler(CrossSiteResourceHandler* h) {
91 cross_site_handler_ = h;
92 }
93
94 // AsyncResourceHandler for this request. May be null.
95 AsyncResourceHandler* async_handler() {
96 return async_handler_;
97 }
98 void set_async_handler(AsyncResourceHandler* h) {
99 async_handler_ = h;
100 }
101
102 // Identifies the type of process (renderer, plugin, etc.) making the request.
103 ProcessType process_type() const {
104 return process_type_;
105 }
106
107 // Downloads are allowed only as a top level request.
108 bool allow_download() const { return allow_download_; }
109
110 // Whether this is a download.
111 bool is_download() const { return is_download_; }
112 void set_is_download(bool download) { is_download_ = download; }
113
114 PageTransition transition_type() const { return transition_type_; }
115
116 void set_was_ignored_by_handler(bool value) {
117 was_ignored_by_handler_ = value;
118 }
119
120 // The approximate in-memory size (bytes) that we credited this request
121 // as consuming in |outstanding_requests_memory_cost_map_|.
122 int memory_cost() const { return memory_cost_; }
123 void set_memory_cost(int cost) { memory_cost_ = cost; }
124
125 // We hold a reference to the requested blob data to ensure it doesn't
126 // get finally released prior to the net::URLRequestJob being started.
127 webkit_blob::BlobData* requested_blob_data() const {
128 return requested_blob_data_.get();
129 }
130 void set_requested_blob_data(webkit_blob::BlobData* data);
131
132 private:
133 // Non-owning, may be NULL.
134 CrossSiteResourceHandler* cross_site_handler_;
135 AsyncResourceHandler* async_handler_;
136
137 ProcessType process_type_;
138 int child_id_;
139 int route_id_;
140 int origin_pid_;
141 int request_id_;
142 bool is_main_frame_;
143 int64 frame_id_;
144 bool parent_is_main_frame_;
145 int64 parent_frame_id_;
146 bool is_download_;
147 bool allow_download_;
148 bool has_user_gesture_;
149 bool was_ignored_by_handler_;
150 ResourceType::Type resource_type_;
151 PageTransition transition_type_;
152 int memory_cost_;
153 scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
154 WebKit::WebReferrerPolicy referrer_policy_;
155 ResourceContext* context_;
156
157 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
158 };
159
160 } // namespace content
161
162 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_message_filter.cc ('k') | content/browser/renderer_host/resource_request_info_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698