| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/common/page_transition_types.h" | 10 #include "content/public/common/page_transition_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // ResourceRequestInfo instance associated with it. | 23 // ResourceRequestInfo instance associated with it. |
| 24 class ResourceRequestInfo { | 24 class ResourceRequestInfo { |
| 25 public: | 25 public: |
| 26 // Returns the ResourceRequestInfo associated with the given URLRequest. | 26 // Returns the ResourceRequestInfo associated with the given URLRequest. |
| 27 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( | 27 CONTENT_EXPORT static const ResourceRequestInfo* ForRequest( |
| 28 const net::URLRequest* request); | 28 const net::URLRequest* request); |
| 29 | 29 |
| 30 // Allocates a new, dummy ResourceRequestInfo and associates it with the | 30 // Allocates a new, dummy ResourceRequestInfo and associates it with the |
| 31 // given URLRequest. | 31 // given URLRequest. |
| 32 // NOTE: Add more parameters if you need to initialize other fields. | 32 // NOTE: Add more parameters if you need to initialize other fields. |
| 33 CONTENT_EXPORT static void AllocateForTesting( | 33 CONTENT_EXPORT static void AllocateForTesting(net::URLRequest* request, |
| 34 net::URLRequest* request, | 34 ResourceType resource_type, |
| 35 ResourceType::Type resource_type, | 35 ResourceContext* context, |
| 36 ResourceContext* context, | 36 int render_process_id, |
| 37 int render_process_id, | 37 int render_view_id, |
| 38 int render_view_id, | 38 int render_frame_id, |
| 39 int render_frame_id, | 39 bool is_async); |
| 40 bool is_async); | |
| 41 | 40 |
| 42 // Returns the associated RenderFrame for a given process. Returns false, if | 41 // Returns the associated RenderFrame for a given process. Returns false, if |
| 43 // there is no associated RenderFrame. This method does not rely on the | 42 // there is no associated RenderFrame. This method does not rely on the |
| 44 // request being allocated by the ResourceDispatcherHost, but works for all | 43 // request being allocated by the ResourceDispatcherHost, but works for all |
| 45 // URLRequests that are associated with a RenderFrame. | 44 // URLRequests that are associated with a RenderFrame. |
| 46 CONTENT_EXPORT static bool GetRenderFrameForRequest( | 45 CONTENT_EXPORT static bool GetRenderFrameForRequest( |
| 47 const net::URLRequest* request, | 46 const net::URLRequest* request, |
| 48 int* render_process_id, | 47 int* render_process_id, |
| 49 int* render_frame_id); | 48 int* render_frame_id); |
| 50 | 49 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 virtual bool IsMainFrame() const = 0; | 74 virtual bool IsMainFrame() const = 0; |
| 76 | 75 |
| 77 // True if GetParentRenderFrameID() represents a main frame in the RenderView. | 76 // True if GetParentRenderFrameID() represents a main frame in the RenderView. |
| 78 virtual bool ParentIsMainFrame() const = 0; | 77 virtual bool ParentIsMainFrame() const = 0; |
| 79 | 78 |
| 80 // Routing ID of parent frame of frame that sent this resource request. | 79 // Routing ID of parent frame of frame that sent this resource request. |
| 81 // -1 if unknown / invalid. | 80 // -1 if unknown / invalid. |
| 82 virtual int GetParentRenderFrameID() const = 0; | 81 virtual int GetParentRenderFrameID() const = 0; |
| 83 | 82 |
| 84 // Returns the associated resource type. | 83 // Returns the associated resource type. |
| 85 virtual ResourceType::Type GetResourceType() const = 0; | 84 virtual ResourceType GetResourceType() const = 0; |
| 86 | 85 |
| 87 // Returns the process type that initiated this request. | 86 // Returns the process type that initiated this request. |
| 88 virtual int GetProcessType() const = 0; | 87 virtual int GetProcessType() const = 0; |
| 89 | 88 |
| 90 // Returns the associated referrer policy. | 89 // Returns the associated referrer policy. |
| 91 virtual blink::WebReferrerPolicy GetReferrerPolicy() const = 0; | 90 virtual blink::WebReferrerPolicy GetReferrerPolicy() const = 0; |
| 92 | 91 |
| 93 // Returns the associated visibility state at the time the request was started | 92 // Returns the associated visibility state at the time the request was started |
| 94 // in the renderer. | 93 // in the renderer. |
| 95 virtual blink::WebPageVisibilityState GetVisibilityState() const = 0; | 94 virtual blink::WebPageVisibilityState GetVisibilityState() const = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 // Whether this is a download. | 114 // Whether this is a download. |
| 116 virtual bool IsDownload() const = 0; | 115 virtual bool IsDownload() const = 0; |
| 117 | 116 |
| 118 protected: | 117 protected: |
| 119 virtual ~ResourceRequestInfo() {} | 118 virtual ~ResourceRequestInfo() {} |
| 120 }; | 119 }; |
| 121 | 120 |
| 122 } // namespace content | 121 } // namespace content |
| 123 | 122 |
| 124 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | 123 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| OLD | NEW |