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

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

Issue 2775693003: Fix missing HEADLESS_EXPORT defines (Closed)
Patch Set: Added extra headless_export Created 3 years, 9 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 "headless/public/headless_export.h"
16 #include "headless/public/util/managed_dispatch_url_request_job.h" 17 #include "headless/public/util/managed_dispatch_url_request_job.h"
17 #include "headless/public/util/url_fetcher.h" 18 #include "headless/public/util/url_fetcher.h"
18 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
19 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace net { 23 namespace net {
23 class HttpResponseHeaders; 24 class HttpResponseHeaders;
24 class IOBuffer; 25 class IOBuffer;
25 } // namespace net 26 } // namespace net
26 27
27 namespace headless { 28 namespace headless {
28 29
29 class URLRequestDispatcher; 30 class URLRequestDispatcher;
30 31
31 // Intended for use in a protocol handler, this ManagedDispatchURLRequestJob has 32 // Intended for use in a protocol handler, this ManagedDispatchURLRequestJob has
32 // the following features: 33 // the following features:
33 // 34 //
34 // 1. The delegate can extension observe / cancel and redirect requests 35 // 1. The delegate can extension observe / cancel and redirect requests
35 // 2. The delegate can optionally provide the results, otherwise the specifed 36 // 2. The delegate can optionally provide the results, otherwise the specifed
36 // fetcher is invoked. 37 // fetcher is invoked.
37 class GenericURLRequestJob : public ManagedDispatchURLRequestJob, 38 class HEADLESS_EXPORT GenericURLRequestJob
38 public URLFetcher::ResultListener { 39 : public ManagedDispatchURLRequestJob,
40 public URLFetcher::ResultListener {
39 public: 41 public:
40 enum class RewriteResult { kAllow, kDeny, kFailure }; 42 enum class RewriteResult { kAllow, kDeny, kFailure };
41 using RewriteCallback = std::function< 43 using RewriteCallback = std::function<
42 void(RewriteResult result, const GURL& url, const std::string& method)>; 44 void(RewriteResult result, const GURL& url, const std::string& method)>;
43 45
44 struct HttpResponse { 46 struct HttpResponse {
45 GURL final_url; 47 GURL final_url;
46 int http_response_code; 48 int http_response_code;
47 49
48 // The HTTP headers and response body. Note the lifetime of |response_data| 50 // The HTTP headers and response body. Note the lifetime of |response_data|
49 // is expected to outlive the GenericURLRequestJob. 51 // is expected to outlive the GenericURLRequestJob.
50 const char* response_data; // NOT OWNED 52 const char* response_data; // NOT OWNED
51 size_t response_data_size; 53 size_t response_data_size;
52 }; 54 };
53 55
54 class Delegate { 56 class HEADLESS_EXPORT Delegate {
55 public: 57 public:
56 // Allows the delegate to rewrite the URL for a given request. Return true 58 // Allows the delegate to rewrite the URL for a given request. Return true
57 // to signal that the rewrite is in progress and |callback| will be called 59 // to signal that the rewrite is in progress and |callback| will be called
58 // with the result, or false to indicate that no rewriting is necessary. 60 // with the result, or false to indicate that no rewriting is necessary.
59 // Called on an arbitrary thread. 61 // Called on an arbitrary thread.
60 virtual bool BlockOrRewriteRequest(const GURL& url, 62 virtual bool BlockOrRewriteRequest(const GURL& url,
61 const std::string& devtools_id, 63 const std::string& devtools_id,
62 const std::string& method, 64 const std::string& method,
63 const std::string& referrer, 65 const std::string& referrer,
64 RewriteCallback callback) = 0; 66 RewriteCallback callback) = 0;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 base::TimeTicks response_time_; 131 base::TimeTicks response_time_;
130 132
131 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_; 133 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_;
132 134
133 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob); 135 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob);
134 }; 136 };
135 137
136 } // namespace headless 138 } // namespace headless
137 139
138 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ 140 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « headless/public/util/flat_dom_tree_extractor.h ('k') | headless/public/util/managed_dispatch_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698