Chromium Code Reviews| Index: content/public/browser/resource_request_info.h |
| =================================================================== |
| --- content/public/browser/resource_request_info.h (revision 0) |
| +++ content/public/browser/resource_request_info.h (revision 0) |
| @@ -0,0 +1,101 @@ |
| +// 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_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| +#define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/supports_user_data.h" |
| +#include "content/common/content_export.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" |
| +#include "webkit/glue/resource_type.h" |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +namespace content { |
| +class ResourceContext; |
| + |
| +class ResourceRequestInfo : public base::SupportsUserData::Data { |
|
jam
2012/03/05 07:16:17
nit: please add a little comment about what this c
|
| + public: |
| + CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( |
| + const net::URLRequest* request); |
| + |
| + CONTENT_EXPORT static ResourceRequestInfo* CreateForTesting( |
| + ResourceContext* context); |
| + |
| + ResourceContext* context() const { return context_; } |
|
jam
2012/03/05 07:16:17
for the Content API, we have tried to be strict th
|
| + |
| + // The child process unique ID of the requestor. |
| + int child_id() const { return child_id_; } |
| + |
| + // The IPC route identifier for this request (this identifies the RenderView |
| + // or like-thing in the renderer that the request gets routed to). |
| + int route_id() const { return route_id_; } |
| + |
| + // The pid of the originating process, if the request is sent on behalf of a |
| + // another process. Otherwise it is 0. |
| + int origin_pid() const { return origin_pid_; } |
| + |
| + // Unique identifier (within the scope of the child process) for this request. |
| + int request_id() const { return request_id_; } |
| + |
| + // True if |frame_id_| represents a main frame in the RenderView. |
| + bool is_main_frame() const { return is_main_frame_; } |
| + |
| + // Frame ID that sent this resource request. -1 if unknown / invalid. |
| + int64 frame_id() const { return frame_id_; } |
| + |
| + // True if |parent_frame_id_| represents a main frame in the RenderView. |
| + bool parent_is_main_frame() const { return parent_is_main_frame_; } |
| + |
| + // Frame ID of parent frame of frame that sent this resource request. |
| + // -1 if unknown / invalid. |
| + int64 parent_frame_id() const { return parent_frame_id_; } |
| + |
| + ResourceType::Type resource_type() const { return resource_type_; } |
| + |
| + WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; } |
| + |
| + // When there is upload data, this is the byte count of that data. When there |
| + // is no upload, this will be 0. |
| + uint64 upload_size() const { return upload_size_; } |
| + |
| + // Returns false if there is not an associated render view. |
| + virtual bool GetAssociatedRenderView(int* render_process_id, |
| + int* render_view_id) const = 0; |
| + |
| + protected: |
| + 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); |
| + virtual ~ResourceRequestInfo(); |
| + |
| + ResourceContext* context_; |
| + int child_id_; |
| + int route_id_; |
| + int origin_pid_; |
| + int request_id_; |
| + int64 frame_id_; |
| + int64 parent_frame_id_; |
| + bool is_main_frame_; |
| + bool parent_is_main_frame_; |
| + ResourceType::Type resource_type_; |
| + WebKit::WebReferrerPolicy referrer_policy_; |
| + uint64 upload_size_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |