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 #pragma once |
| 8 |
| 9 #include "base/basictypes.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 // Each URLRequest allocated by the ResourceDispatcherHost has a |
| 22 // ResourceRequestInfo instance associated with it. |
| 23 class ResourceRequestInfo { |
| 24 public: |
| 25 // Returns the ResourceRequestInfo associated with the given URLRequest. |
| 26 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( |
| 27 const net::URLRequest* request); |
| 28 |
| 29 // Allocates a new, dummy ResourceRequestInfo and associates it with the |
| 30 // given URLRequest. |
| 31 // NOTE: Add more parameters if you need to initialize other fields. |
| 32 CONTENT_EXPORT static void AllocateForTesting( |
| 33 net::URLRequest* request, |
| 34 ResourceContext* context); |
| 35 |
| 36 // Returns the associated ResourceContext. |
| 37 virtual ResourceContext* GetContext() const = 0; |
| 38 |
| 39 // The child process unique ID of the requestor. |
| 40 virtual int GetChildID() const = 0; |
| 41 |
| 42 // The IPC route identifier for this request (this identifies the RenderView |
| 43 // or like-thing in the renderer that the request gets routed to). |
| 44 virtual int GetRouteID() const = 0; |
| 45 |
| 46 // The pid of the originating process, if the request is sent on behalf of a |
| 47 // another process. Otherwise it is 0. |
| 48 virtual int GetOriginPID() const = 0; |
| 49 |
| 50 // Unique identifier (within the scope of the child process) for this request. |
| 51 virtual int GetRequestID() const = 0; |
| 52 |
| 53 // True if GetFrameID() represents a main frame in the RenderView. |
| 54 virtual bool IsMainFrame() const = 0; |
| 55 |
| 56 // Frame ID that sent this resource request. -1 if unknown / invalid. |
| 57 virtual int64 GetFrameID() const = 0; |
| 58 |
| 59 // True if GetParentFrameID() represents a main frame in the RenderView. |
| 60 virtual bool ParentIsMainFrame() const = 0; |
| 61 |
| 62 // Frame ID of parent frame of frame that sent this resource request. |
| 63 // -1 if unknown / invalid. |
| 64 virtual int64 GetParentFrameID() const = 0; |
| 65 |
| 66 // Returns the associated resource type. |
| 67 virtual ResourceType::Type GetResourceType() const = 0; |
| 68 |
| 69 // Returns the associated referrer policy. |
| 70 virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const = 0; |
| 71 |
| 72 // When there is upload data, this is the byte count of that data. When there |
| 73 // is no upload, this will be 0. |
| 74 virtual uint64 GetUploadSize() const = 0; |
| 75 |
| 76 // Returns false if there is NOT an associated render view. |
| 77 virtual bool GetAssociatedRenderView(int* render_process_id, |
| 78 int* render_view_id) const = 0; |
| 79 |
| 80 protected: |
| 81 virtual ~ResourceRequestInfo() {} |
| 82 }; |
| 83 |
| 84 } // namespace content |
| 85 |
| 86 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
OLD | NEW |