summaryrefslogtreecommitdiffstats
path: root/content/browser/loader/resource_request_info_impl.h
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 08:02:44 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-05 08:02:44 +0000
commit678c036ef6be9f5e845f2e75a8b1bbd76985768d (patch)
tree2f012f324cc9a61c682fc730113e2834534ddb4e /content/browser/loader/resource_request_info_impl.h
parent4eaa59bf61b134d79cedd565c0ab015dc18b75cd (diff)
downloadchromium_src-678c036ef6be9f5e845f2e75a8b1bbd76985768d.zip
chromium_src-678c036ef6be9f5e845f2e75a8b1bbd76985768d.tar.gz
chromium_src-678c036ef6be9f5e845f2e75a8b1bbd76985768d.tar.bz2
Add content/browser/loader/ for resource loading related classes.
This infrastructure is shared by both renderer and worker processes, so having it live in renderer_host/ was not quite right. This change also nicely reduces the number of files in renderer_host/. R=jam@chromium.org Review URL: https://codereview.chromium.org/11414299 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/resource_request_info_impl.h')
-rw-r--r--content/browser/loader/resource_request_info_impl.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/content/browser/loader/resource_request_info_impl.h b/content/browser/loader/resource_request_info_impl.h
new file mode 100644
index 0000000..e35005a
--- /dev/null
+++ b/content/browser/loader/resource_request_info_impl.h
@@ -0,0 +1,162 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_
+#define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/supports_user_data.h"
+#include "content/public/browser/resource_request_info.h"
+#include "content/public/common/page_transition_types.h"
+#include "content/public/common/process_type.h"
+#include "content/public/common/referrer.h"
+#include "net/base/load_states.h"
+#include "webkit/glue/resource_type.h"
+
+namespace webkit_blob {
+class BlobData;
+}
+
+namespace content {
+class AsyncResourceHandler;
+class CrossSiteResourceHandler;
+class ResourceContext;
+struct GlobalRequestID;
+
+// Holds the data ResourceDispatcherHost associates with each request.
+// Retrieve this data by calling ResourceDispatcherHost::InfoForRequest.
+class ResourceRequestInfoImpl : public ResourceRequestInfo,
+ public base::SupportsUserData::Data {
+ public:
+ // Returns the ResourceRequestInfoImpl associated with the given URLRequest.
+ CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest(
+ net::URLRequest* request);
+
+ // And, a const version for cases where you only need read access.
+ static const ResourceRequestInfoImpl* ForRequest(
+ const net::URLRequest* request);
+
+ CONTENT_EXPORT ResourceRequestInfoImpl(
+ ProcessType process_type,
+ 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,
+ PageTransition transition_type,
+ bool is_download,
+ bool allow_download,
+ bool has_user_gesture,
+ WebKit::WebReferrerPolicy referrer_policy,
+ ResourceContext* context);
+ virtual ~ResourceRequestInfoImpl();
+
+ // ResourceRequestInfo implementation:
+ virtual ResourceContext* GetContext() const OVERRIDE;
+ virtual int GetChildID() const OVERRIDE;
+ virtual int GetRouteID() const OVERRIDE;
+ virtual int GetOriginPID() const OVERRIDE;
+ virtual int GetRequestID() const OVERRIDE;
+ virtual bool IsMainFrame() const OVERRIDE;
+ virtual int64 GetFrameID() const OVERRIDE;
+ virtual bool ParentIsMainFrame() const OVERRIDE;
+ virtual int64 GetParentFrameID() const OVERRIDE;
+ virtual ResourceType::Type GetResourceType() const OVERRIDE;
+ virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE;
+ virtual bool HasUserGesture() const OVERRIDE;
+ virtual bool WasIgnoredByHandler() const OVERRIDE;
+ virtual bool GetAssociatedRenderView(int* render_process_id,
+ int* render_view_id) const OVERRIDE;
+ virtual bool IsAsync() const OVERRIDE;
+
+
+ void AssociateWithRequest(net::URLRequest* request);
+
+ GlobalRequestID GetGlobalRequestID() const;
+
+ // CrossSiteResourceHandler for this request. May be null.
+ CrossSiteResourceHandler* cross_site_handler() {
+ return cross_site_handler_;
+ }
+ void set_cross_site_handler(CrossSiteResourceHandler* h) {
+ cross_site_handler_ = h;
+ }
+
+ // AsyncResourceHandler for this request. May be null.
+ AsyncResourceHandler* async_handler() {
+ return async_handler_;
+ }
+ void set_async_handler(AsyncResourceHandler* h) {
+ async_handler_ = h;
+ }
+
+ // Identifies the type of process (renderer, plugin, etc.) making the request.
+ ProcessType process_type() const {
+ return process_type_;
+ }
+
+ // Downloads are allowed only as a top level request.
+ bool allow_download() const { return allow_download_; }
+
+ // Whether this is a download.
+ bool is_download() const { return is_download_; }
+ void set_is_download(bool download) { is_download_ = download; }
+
+ PageTransition transition_type() const { return transition_type_; }
+
+ void set_was_ignored_by_handler(bool value) {
+ was_ignored_by_handler_ = value;
+ }
+
+ // The approximate in-memory size (bytes) that we credited this request
+ // as consuming in |outstanding_requests_memory_cost_map_|.
+ int memory_cost() const { return memory_cost_; }
+ void set_memory_cost(int cost) { memory_cost_ = cost; }
+
+ // We hold a reference to the requested blob data to ensure it doesn't
+ // get finally released prior to the net::URLRequestJob being started.
+ webkit_blob::BlobData* requested_blob_data() const {
+ return requested_blob_data_.get();
+ }
+ void set_requested_blob_data(webkit_blob::BlobData* data);
+
+ private:
+ // Non-owning, may be NULL.
+ CrossSiteResourceHandler* cross_site_handler_;
+ AsyncResourceHandler* async_handler_;
+
+ ProcessType process_type_;
+ 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_;
+ bool is_download_;
+ bool allow_download_;
+ bool has_user_gesture_;
+ bool was_ignored_by_handler_;
+ ResourceType::Type resource_type_;
+ PageTransition transition_type_;
+ int memory_cost_;
+ scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
+ WebKit::WebReferrerPolicy referrer_policy_;
+ ResourceContext* context_;
+
+ DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_