Index: content/public/browser/resource_request_info.cc |
=================================================================== |
--- content/public/browser/resource_request_info.cc (revision 0) |
+++ content/public/browser/resource_request_info.cc (revision 0) |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/public/browser/resource_request_info.h" |
+ |
+#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
+#include "content/public/common/process_type.h" |
+#include "ipc/ipc_message.h" |
+#include "net/url_request/url_request.h" |
+ |
+namespace content { |
+ |
+// static |
+const ResourceRequestInfo* ResourceRequestInfo::ForRequest( |
+ const net::URLRequest* request) { |
+ return static_cast<const ResourceRequestInfo*>(request->GetUserData(NULL)); |
+} |
+ |
+// static |
+ResourceRequestInfo* ResourceRequestInfo::CreateForTesting( |
+ ResourceContext* context) { |
+ return new ResourceDispatcherHostRequestInfo( |
+ NULL, // handler |
+ PROCESS_TYPE_RENDERER, // process_type |
+ -1, // child_id |
+ MSG_ROUTING_NONE, // route_id |
+ 0, // origin_pid |
+ 0, // request_id |
+ true, // is_main_frame |
+ 0, // frame_id |
+ false, // parent_is_main_frame |
+ 0, // parent_frame_id |
+ ResourceType::MAIN_FRAME, // resource_type |
+ PAGE_TRANSITION_LINK, // transition_type |
+ 0, // upload_size |
+ false, // is_download |
+ true, // allow_download |
+ false, // has_user_gesture |
+ WebKit::WebReferrerPolicyDefault, // referrer_policy |
+ context); // context |
+} |
+ |
+ResourceRequestInfo::ResourceRequestInfo( |
+ ResourceContext* context, |
+ int child_id, |
+ int route_id, |
+ int origin_pid, |
+ int request_id, |
+ bool is_main_frame, |
+ int64 frame_id, |
+ bool parent_is_main_frame, |
+ int64 parent_frame_id, |
+ ResourceType::Type resource_type, |
+ WebKit::WebReferrerPolicy referrer_policy, |
+ uint64 upload_size) |
+ : context_(context), |
+ child_id_(child_id), |
+ route_id_(route_id), |
+ origin_pid_(origin_pid), |
+ request_id_(request_id), |
+ frame_id_(frame_id), |
+ parent_frame_id_(parent_frame_id), |
+ is_main_frame_(is_main_frame), |
+ parent_is_main_frame_(parent_is_main_frame), |
+ resource_type_(resource_type), |
+ referrer_policy_(referrer_policy), |
+ upload_size_(upload_size) { |
+} |
+ |
+ResourceRequestInfo::~ResourceRequestInfo() { |
+} |
+ |
+} // namespace content |