| 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/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/global_request_id.h" | 10 #include "content/public/browser/global_request_id.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const net::URLRequest* request); | 66 const net::URLRequest* request); |
| 67 | 67 |
| 68 // A callback that returns a pointer to a WebContents. The callback can | 68 // A callback that returns a pointer to a WebContents. The callback can |
| 69 // always be used, but it may return nullptr: if the info used to | 69 // always be used, but it may return nullptr: if the info used to |
| 70 // instantiate the callback can no longer be used to return a WebContents, | 70 // instantiate the callback can no longer be used to return a WebContents, |
| 71 // nullptr will be returned instead. | 71 // nullptr will be returned instead. |
| 72 // The callback should only run on the UI thread and it should always be | 72 // The callback should only run on the UI thread and it should always be |
| 73 // non-null. | 73 // non-null. |
| 74 using WebContentsGetter = base::Callback<WebContents*(void)>; | 74 using WebContentsGetter = base::Callback<WebContents*(void)>; |
| 75 | 75 |
| 76 // A callback that returns a frame tree node id . The callback can always | |
| 77 // be used, but it may return -1 if no id is found. The callback should only | |
| 78 // run on the UI thread. | |
| 79 using FrameTreeNodeIdGetter = base::Callback<int(void)>; | |
| 80 | |
| 81 // Returns a callback that returns a pointer to the WebContents this request | 76 // Returns a callback that returns a pointer to the WebContents this request |
| 82 // is associated with, or nullptr if it no longer exists or the request is | 77 // is associated with, or nullptr if it no longer exists or the request is |
| 83 // not associated with a WebContents. The callback should only run on the UI | 78 // not associated with a WebContents. The callback should only run on the UI |
| 84 // thread. | 79 // thread. |
| 85 // Note: Not all resource requests will be owned by a WebContents. For | 80 // Note: Not all resource requests will be owned by a WebContents. For |
| 86 // example, requests made by a ServiceWorker. | 81 // example, requests made by a ServiceWorker. |
| 87 virtual WebContentsGetter GetWebContentsGetterForRequest() const = 0; | 82 virtual WebContentsGetter GetWebContentsGetterForRequest() const = 0; |
| 88 | 83 |
| 89 // Returns a callback that returns an int with the frame tree node id | |
| 90 // associated with this request, or -1 if it no longer exists. This | |
| 91 // callback should only be run on the UI thread. | |
| 92 // Note: Not all resource requests will be associated with a frame. For | |
| 93 // example, requests made by a ServiceWorker. | |
| 94 virtual FrameTreeNodeIdGetter GetFrameTreeNodeIdGetterForRequest() const = 0; | |
| 95 | |
| 96 // Returns the associated ResourceContext. | 84 // Returns the associated ResourceContext. |
| 97 virtual ResourceContext* GetContext() const = 0; | 85 virtual ResourceContext* GetContext() const = 0; |
| 98 | 86 |
| 99 // The child process unique ID of the requestor. | 87 // The child process unique ID of the requestor. |
| 100 // To get a WebContents, use GetWebContentsGetterForRequest instead. | 88 // To get a WebContents, use GetWebContentsGetterForRequest instead. |
| 101 virtual int GetChildID() const = 0; | 89 virtual int GetChildID() const = 0; |
| 102 | 90 |
| 103 // The IPC route identifier for this request (this identifies the RenderView | 91 // The IPC route identifier for this request (this identifies the RenderView |
| 104 // or like-thing in the renderer that the request gets routed to). | 92 // or like-thing in the renderer that the request gets routed to). |
| 105 // To get a WebContents, use GetWebContentsGetterForRequest instead. | 93 // To get a WebContents, use GetWebContentsGetterForRequest instead. |
| 106 // Don't use this method for new code, as RenderViews are going away. | 94 // Don't use this method for new code, as RenderViews are going away. |
| 107 virtual int GetRouteID() const = 0; | 95 virtual int GetRouteID() const = 0; |
| 108 | 96 |
| 109 // The globally unique identifier for this request. | 97 // The globally unique identifier for this request. |
| 110 virtual GlobalRequestID GetGlobalRequestID() const = 0; | 98 virtual GlobalRequestID GetGlobalRequestID() const = 0; |
| 111 | 99 |
| 112 // The pid of the originating process, if the request is sent on behalf of a | 100 // The pid of the originating process, if the request is sent on behalf of a |
| 113 // another process. Otherwise it is 0. | 101 // another process. Otherwise it is 0. |
| 114 virtual int GetOriginPID() const = 0; | 102 virtual int GetOriginPID() const = 0; |
| 115 | 103 |
| 116 // Returns the FrameTreeNode ID for this frame. This ID is browser-global and | 104 // Returns the FrameTreeNode ID for this frame. This ID is browser-global and |
| 117 // uniquely identifies a frame that hosts content. | 105 // uniquely identifies a frame that hosts content. |
| 118 // Note: Returns -1 for all requests except PlzNavigate requests. | |
| 119 virtual int GetFrameTreeNodeId() const = 0; | 106 virtual int GetFrameTreeNodeId() const = 0; |
| 120 | 107 |
| 121 // The IPC route identifier of the RenderFrame. | 108 // The IPC route identifier of the RenderFrame. |
| 122 // To get a WebContents, use GetWebContentsGetterForRequest instead. | 109 // To get a WebContents, use GetWebContentsGetterForRequest instead. |
| 123 // TODO(jam): once all navigation and resource requests are sent between | 110 // TODO(jam): once all navigation and resource requests are sent between |
| 124 // frames and RenderView/RenderViewHost aren't involved we can remove this and | 111 // frames and RenderView/RenderViewHost aren't involved we can remove this and |
| 125 // just use GetRouteID above. | 112 // just use GetRouteID above. |
| 126 virtual int GetRenderFrameID() const = 0; | 113 virtual int GetRenderFrameID() const = 0; |
| 127 | 114 |
| 128 // True if GetRenderFrameID() represents a main frame in the RenderView. | 115 // True if GetRenderFrameID() represents a main frame in the RenderView. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // UI thread at the beginning of navigation. | 167 // UI thread at the beginning of navigation. |
| 181 virtual NavigationUIData* GetNavigationUIData() const = 0; | 168 virtual NavigationUIData* GetNavigationUIData() const = 0; |
| 182 | 169 |
| 183 protected: | 170 protected: |
| 184 virtual ~ResourceRequestInfo() {} | 171 virtual ~ResourceRequestInfo() {} |
| 185 }; | 172 }; |
| 186 | 173 |
| 187 } // namespace content | 174 } // namespace content |
| 188 | 175 |
| 189 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ | 176 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_ |
| OLD | NEW |