Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: headless/public/util/generic_url_request_job.h

Issue 2830753004: Pipe the devTools FrameId from blink into the browser for headless (Closed)
Patch Set: Rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ 5 #ifndef HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_
6 #define HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ 6 #define HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <functional> 9 #include <functional>
10 #include <memory> 10 #include <memory>
(...skipping 13 matching lines...) Expand all
24 class HttpResponseHeaders; 24 class HttpResponseHeaders;
25 class IOBuffer; 25 class IOBuffer;
26 } // namespace net 26 } // namespace net
27 27
28 namespace content { 28 namespace content {
29 class ResourceRequestInfo; 29 class ResourceRequestInfo;
30 } // namespace content 30 } // namespace content
31 31
32 namespace headless { 32 namespace headless {
33 33
34 class HeadlessBrowserContext;
34 class URLRequestDispatcher; 35 class URLRequestDispatcher;
35 36
36 // Wrapper around net::URLRequest with helpers to access select metadata. 37 // Wrapper around net::URLRequest with helpers to access select metadata.
37 class Request { 38 class Request {
38 public: 39 public:
39 virtual uint64_t GetRequestId() const = 0; 40 virtual uint64_t GetRequestId() const = 0;
40 41
41 virtual const net::URLRequest* GetURLRequest() const = 0; 42 virtual const net::URLRequest* GetURLRequest() const = 0;
42 43
43 // The frame from which the request came from. 44 // The frame from which the request came from.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 scoped_refptr<net::HttpResponseHeaders> response_headers, 148 scoped_refptr<net::HttpResponseHeaders> response_headers,
148 const char* body, 149 const char* body,
149 size_t body_size) = 0; 150 size_t body_size) = 0;
150 151
151 protected: 152 protected:
152 virtual ~Delegate() {} 153 virtual ~Delegate() {}
153 }; 154 };
154 155
155 // NOTE |url_request_dispatcher| and |delegate| must outlive the 156 // NOTE |url_request_dispatcher| and |delegate| must outlive the
156 // GenericURLRequestJob. 157 // GenericURLRequestJob.
157 GenericURLRequestJob(net::URLRequest* request, 158 // TODO(alexclarke): Remove the default parameter.
158 net::NetworkDelegate* network_delegate, 159 GenericURLRequestJob(
159 URLRequestDispatcher* url_request_dispatcher, 160 net::URLRequest* request,
160 std::unique_ptr<URLFetcher> url_fetcher, 161 net::NetworkDelegate* network_delegate,
161 Delegate* delegate); 162 URLRequestDispatcher* url_request_dispatcher,
163 std::unique_ptr<URLFetcher> url_fetcher,
164 Delegate* delegate,
165 HeadlessBrowserContext* headless_browser_context = nullptr);
162 ~GenericURLRequestJob() override; 166 ~GenericURLRequestJob() override;
163 167
164 // net::URLRequestJob implementation: 168 // net::URLRequestJob implementation:
165 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override; 169 void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers) override;
166 void Start() override; 170 void Start() override;
167 int ReadRawData(net::IOBuffer* buf, int buf_size) override; 171 int ReadRawData(net::IOBuffer* buf, int buf_size) override;
168 void GetResponseInfo(net::HttpResponseInfo* info) override; 172 void GetResponseInfo(net::HttpResponseInfo* info) override;
169 bool GetMimeType(std::string* mime_type) const override; 173 bool GetMimeType(std::string* mime_type) const override;
170 bool GetCharset(std::string* charset) override; 174 bool GetCharset(std::string* charset) override;
171 void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override; 175 void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 const std::string& method, 209 const std::string& method,
206 const base::Closure& done_callback, 210 const base::Closure& done_callback,
207 const net::CookieList& cookie_list); 211 const net::CookieList& cookie_list);
208 212
209 std::unique_ptr<URLFetcher> url_fetcher_; 213 std::unique_ptr<URLFetcher> url_fetcher_;
210 net::HttpRequestHeaders extra_request_headers_; 214 net::HttpRequestHeaders extra_request_headers_;
211 scoped_refptr<net::HttpResponseHeaders> response_headers_; 215 scoped_refptr<net::HttpResponseHeaders> response_headers_;
212 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_; 216 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
213 std::unique_ptr<MockResponseData> mock_response_; 217 std::unique_ptr<MockResponseData> mock_response_;
214 Delegate* delegate_; // Not owned. 218 Delegate* delegate_; // Not owned.
219 HeadlessBrowserContext* headless_browser_context_; // Not owned.
215 const content::ResourceRequestInfo* request_resource_info_; // Not owned. 220 const content::ResourceRequestInfo* request_resource_info_; // Not owned.
216 const char* body_ = nullptr; // Not owned. 221 const char* body_ = nullptr; // Not owned.
217 size_t body_size_ = 0; 222 size_t body_size_ = 0;
218 size_t read_offset_ = 0; 223 size_t read_offset_ = 0;
219 base::TimeTicks response_time_; 224 base::TimeTicks response_time_;
220 const uint64_t request_id_; 225 const uint64_t request_id_;
221 static uint64_t next_request_id_; 226 static uint64_t next_request_id_;
222 227
223 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_; 228 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_;
224 229
225 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob); 230 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob);
226 }; 231 };
227 232
228 } // namespace headless 233 } // namespace headless
229 234
230 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ 235 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « headless/public/headless_web_contents.h ('k') | headless/public/util/generic_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698