| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 struct HttpResponse { | 46 struct HttpResponse { |
| 47 GURL final_url; | 47 GURL final_url; |
| 48 int http_response_code; | 48 int http_response_code; |
| 49 | 49 |
| 50 // 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| |
| 51 // is expected to outlive the GenericURLRequestJob. | 51 // is expected to outlive the GenericURLRequestJob. |
| 52 const char* response_data; // NOT OWNED | 52 const char* response_data; // NOT OWNED |
| 53 size_t response_data_size; | 53 size_t response_data_size; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class Delegate { | 56 class HEADLESS_EXPORT Delegate { |
| 57 public: | 57 public: |
| 58 // 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 |
| 59 // 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 |
| 60 // 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. |
| 61 // Called on an arbitrary thread. |callback| can be called on any thread. | 61 // Called on an arbitrary thread. |callback| can be called on any thread. |
| 62 virtual bool BlockOrRewriteRequest(const GURL& url, | 62 virtual bool BlockOrRewriteRequest(const GURL& url, |
| 63 const std::string& devtools_id, | 63 const std::string& devtools_id, |
| 64 const std::string& method, | 64 const std::string& method, |
| 65 const std::string& referrer, | 65 const std::string& referrer, |
| 66 RewriteCallback callback) = 0; | 66 RewriteCallback callback) = 0; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::TimeTicks response_time_; | 140 base::TimeTicks response_time_; |
| 141 | 141 |
| 142 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_; | 142 base::WeakPtrFactory<GenericURLRequestJob> weak_factory_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob); | 144 DISALLOW_COPY_AND_ASSIGN(GenericURLRequestJob); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace headless | 147 } // namespace headless |
| 148 | 148 |
| 149 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ | 149 #endif // HEADLESS_PUBLIC_UTIL_GENERIC_URL_REQUEST_JOB_H_ |
| OLD | NEW |