Chromium Code Reviews| 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 "base/callback_forward.h" | |
| 9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/web_contents.h" | |
|
davidben
2015/11/20 22:19:53
I think you can just forward-declare this.
clamy
2015/11/23 16:44:09
Done.
| |
| 10 #include "content/public/common/resource_type.h" | 12 #include "content/public/common/resource_type.h" |
| 11 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 13 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
| 12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 14 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 13 #include "ui/base/page_transition_types.h" | 15 #include "ui/base/page_transition_types.h" |
| 14 | 16 |
| 15 namespace net { | 17 namespace net { |
| 16 class URLRequest; | 18 class URLRequest; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 44 | 46 |
| 45 // Returns the associated RenderFrame for a given process. Returns false, if | 47 // Returns the associated RenderFrame for a given process. Returns false, if |
| 46 // there is no associated RenderFrame. This method does not rely on the | 48 // there is no associated RenderFrame. This method does not rely on the |
| 47 // request being allocated by the ResourceDispatcherHost, but works for all | 49 // request being allocated by the ResourceDispatcherHost, but works for all |
| 48 // URLRequests that are associated with a RenderFrame. | 50 // URLRequests that are associated with a RenderFrame. |
| 49 CONTENT_EXPORT static bool GetRenderFrameForRequest( | 51 CONTENT_EXPORT static bool GetRenderFrameForRequest( |
| 50 const net::URLRequest* request, | 52 const net::URLRequest* request, |
| 51 int* render_process_id, | 53 int* render_process_id, |
| 52 int* render_frame_id); | 54 int* render_frame_id); |
| 53 | 55 |
| 56 // Returns a callback that returns a pointer to the WebContents this request | |
| 57 // is associated with, or nullptr if it does not exist. The callback should | |
| 58 // only run on the UI thread. | |
| 59 // Note: not all resource requests will be owned by a WebContents. For | |
| 60 // example, requests made by a ServiceWorker. | |
| 61 virtual base::Callback<WebContents*(void)> GetWebContentsForRequest() = 0; | |
| 62 | |
| 54 // Returns the associated ResourceContext. | 63 // Returns the associated ResourceContext. |
| 55 virtual ResourceContext* GetContext() const = 0; | 64 virtual ResourceContext* GetContext() const = 0; |
| 56 | 65 |
| 57 // The child process unique ID of the requestor. | 66 // The child process unique ID of the requestor. |
| 67 // Use GetWebContentsForRequest() instead. | |
| 58 virtual int GetChildID() const = 0; | 68 virtual int GetChildID() const = 0; |
| 59 | 69 |
| 60 // The IPC route identifier for this request (this identifies the RenderView | 70 // The IPC route identifier for this request (this identifies the RenderView |
| 61 // or like-thing in the renderer that the request gets routed to). | 71 // or like-thing in the renderer that the request gets routed to). |
| 72 // Use GetWebContentsForRequest() instead. | |
| 62 virtual int GetRouteID() const = 0; | 73 virtual int GetRouteID() const = 0; |
| 63 | 74 |
| 64 // The pid of the originating process, if the request is sent on behalf of a | 75 // The pid of the originating process, if the request is sent on behalf of a |
| 65 // another process. Otherwise it is 0. | 76 // another process. Otherwise it is 0. |
| 66 virtual int GetOriginPID() const = 0; | 77 virtual int GetOriginPID() const = 0; |
| 67 | 78 |
| 68 // Unique identifier (within the scope of the child process) for this request. | 79 // Unique identifier (within the scope of the child process) for this request. |
| 69 virtual int GetRequestID() const = 0; | 80 virtual int GetRequestID() const = 0; |
| 70 | 81 |
| 71 // The IPC route identifier of the RenderFrame. | 82 // The IPC route identifier of the RenderFrame. |
| 83 // Use GetWebContentsForRequest() instead. | |
| 72 // TODO(jam): once all navigation and resource requests are sent between | 84 // TODO(jam): once all navigation and resource requests are sent between |
| 73 // frames and RenderView/RenderViewHost aren't involved we can remove this and | 85 // frames and RenderView/RenderViewHost aren't involved we can remove this and |
| 74 // just use GetRouteID above. | 86 // just use GetRouteID above. |
| 75 virtual int GetRenderFrameID() const = 0; | 87 virtual int GetRenderFrameID() const = 0; |
| 76 | 88 |
| 77 // True if GetRenderFrameID() represents a main frame in the RenderView. | 89 // True if GetRenderFrameID() represents a main frame in the RenderView. |
| 78 virtual bool IsMainFrame() const = 0; | 90 virtual bool IsMainFrame() const = 0; |
| 79 | 91 |
| 80 // True if GetParentRenderFrameID() represents a main frame in the RenderView. | 92 // True if GetParentRenderFrameID() represents a main frame in the RenderView. |
| 81 virtual bool ParentIsMainFrame() const = 0; | 93 virtual bool ParentIsMainFrame() const = 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 // Whether this request if using Lo-Fi mode. | 140 // Whether this request if using Lo-Fi mode. |
| 129 virtual bool IsUsingLoFi() const = 0; | 141 virtual bool IsUsingLoFi() const = 0; |
| 130 | 142 |
| 131 protected: | 143 protected: |
| 132 virtual ~ResourceRequestInfo() {} | 144 virtual ~ResourceRequestInfo() {} |
| 133 }; | 145 }; |
| 134 | 146 |
| 135 } // namespace content | 147 } // namespace content |
| 136 | 148 |
| 137 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | 149 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| OLD | NEW |