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

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

Issue 2835603002: Revert of Add --headless flag to Windows (Closed)
Patch Set: Created 3 years, 8 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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "headless/public/headless_export.h"
18 #include "headless/public/util/managed_dispatch_url_request_job.h" 17 #include "headless/public/util/managed_dispatch_url_request_job.h"
19 #include "headless/public/util/url_fetcher.h" 18 #include "headless/public/util/url_fetcher.h"
20 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
21 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
22 #include "url/gurl.h" 21 #include "url/gurl.h"
23 22
24 namespace net { 23 namespace net {
25 class HttpResponseHeaders; 24 class HttpResponseHeaders;
26 class IOBuffer; 25 class IOBuffer;
27 } // namespace net 26 } // namespace net
28 27
29 namespace content { 28 namespace content {
30 class ResourceRequestInfo; 29 class ResourceRequestInfo;
31 } // namespace content 30 } // namespace content
32 31
33 namespace headless { 32 namespace headless {
34 33
35 class URLRequestDispatcher; 34 class URLRequestDispatcher;
36 35
37 // Wrapper around net::URLRequest with helpers to access select metadata. 36 // Wrapper around net::URLRequest with helpers to access select metadata.
38 class HEADLESS_EXPORT Request { 37 class Request {
39 public: 38 public:
40 virtual uint64_t GetRequestId() const = 0; 39 virtual uint64_t GetRequestId() const = 0;
41 40
42 virtual const net::URLRequest* GetURLRequest() const = 0; 41 virtual const net::URLRequest* GetURLRequest() const = 0;
43 42
44 // The frame from which the request came from. 43 // The frame from which the request came from.
45 virtual int GetFrameTreeNodeId() const = 0; 44 virtual int GetFrameTreeNodeId() const = 0;
46 45
47 // The devtools agent host id for the page where the request came from. 46 // The devtools agent host id for the page where the request came from.
48 virtual std::string GetDevToolsAgentHostId() const = 0; 47 virtual std::string GetDevToolsAgentHostId() const = 0;
(...skipping 28 matching lines...) Expand all
77 protected: 76 protected:
78 Request() {} 77 Request() {}
79 virtual ~Request() {} 78 virtual ~Request() {}
80 79
81 private: 80 private:
82 DISALLOW_COPY_AND_ASSIGN(Request); 81 DISALLOW_COPY_AND_ASSIGN(Request);
83 }; 82 };
84 83
85 // Details of a pending request received by GenericURLRequestJob which must be 84 // Details of a pending request received by GenericURLRequestJob which must be
86 // either Allowed, Blocked, Modified or have it's response Mocked. 85 // either Allowed, Blocked, Modified or have it's response Mocked.
87 class HEADLESS_EXPORT PendingRequest { 86 class PendingRequest {
88 public: 87 public:
89 virtual const Request* GetRequest() const = 0; 88 virtual const Request* GetRequest() const = 0;
90 89
91 // Allows the request to proceed as normal. 90 // Allows the request to proceed as normal.
92 virtual void AllowRequest() = 0; 91 virtual void AllowRequest() = 0;
93 92
94 // Causes the request to fail with the specified |error|. 93 // Causes the request to fail with the specified |error|.
95 virtual void BlockRequest(net::Error error) = 0; 94 virtual void BlockRequest(net::Error error) = 0;
96 95
97 // Allows the request to be completely re-written. 96 // Allows the request to be completely re-written.
(...skipping 24 matching lines...) Expand all
122 // 121 //
123 // 1. The delegate can extension observe / cancel and redirect requests 122 // 1. The delegate can extension observe / cancel and redirect requests
124 // 2. The delegate can optionally provide the results, otherwise the specifed 123 // 2. The delegate can optionally provide the results, otherwise the specifed
125 // fetcher is invoked. 124 // fetcher is invoked.
126 class HEADLESS_EXPORT GenericURLRequestJob 125 class HEADLESS_EXPORT GenericURLRequestJob
127 : public ManagedDispatchURLRequestJob, 126 : public ManagedDispatchURLRequestJob,
128 public URLFetcher::ResultListener, 127 public URLFetcher::ResultListener,
129 public PendingRequest, 128 public PendingRequest,
130 public Request { 129 public Request {
131 public: 130 public:
132 class HEADLESS_EXPORT Delegate { 131 class Delegate {
133 public: 132 public:
134 // Notifies the delegate of an PendingRequest which must either be 133 // Notifies the delegate of an PendingRequest which must either be
135 // allowed, blocked, modifed or it's response mocked. Called on an arbitrary 134 // allowed, blocked, modifed or it's response mocked. Called on an arbitrary
136 // thread. 135 // thread.
137 virtual void OnPendingRequest(PendingRequest* pending_request) = 0; 136 virtual void OnPendingRequest(PendingRequest* pending_request) = 0;
138 137
139 // Notifies the delegate of any fetch failure. Called on an arbitrary 138 // Notifies the delegate of any fetch failure. Called on an arbitrary
140 // thread. 139 // thread.
141 virtual void OnResourceLoadFailed(const Request* request, 140 virtual void OnResourceLoadFailed(const Request* request,
142 net::Error error) = 0; 141 net::Error error) = 0;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 static uint64_t next_request_id_; 221 static uint64_t next_request_id_;
223 222
224 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_; 223 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_;
225 224
226 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob); 225 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob);
227 }; 226 };
228 227
229 } // namespace headless 228 } // namespace headless
230 229
231 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ 230 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « headless/public/util/deterministic_http_protocol_handler.cc ('k') | headless/public/util/testing/generic_url_request_mocks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698