OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_RESOURCE_FETCHER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // the request, and the callback will never be run. | 48 // the request, and the callback will never be run. |
49 static ResourceFetcher* Create(const GURL& url); | 49 static ResourceFetcher* Create(const GURL& url); |
50 | 50 |
51 // Set the corresponding parameters of the request. Must be called before | 51 // Set the corresponding parameters of the request. Must be called before |
52 // Start. By default, requests are GETs with no body and respect the default | 52 // Start. By default, requests are GETs with no body and respect the default |
53 // cache policy. | 53 // cache policy. |
54 virtual void SetMethod(const std::string& method) = 0; | 54 virtual void SetMethod(const std::string& method) = 0; |
55 virtual void SetBody(const std::string& body) = 0; | 55 virtual void SetBody(const std::string& body) = 0; |
56 virtual void SetHeader(const std::string& header, | 56 virtual void SetHeader(const std::string& header, |
57 const std::string& value) = 0; | 57 const std::string& value) = 0; |
58 virtual void SetSkipServiceWorker(bool skip_service_worker) = 0; | 58 virtual void SetSkipServiceWorker( |
| 59 blink::WebURLRequest::SkipServiceWorker skip_service_worker) = 0; |
59 virtual void SetCachePolicy(blink::WebCachePolicy policy) = 0; | 60 virtual void SetCachePolicy(blink::WebCachePolicy policy) = 0; |
60 | 61 |
61 // Associate the corresponding WebURLLoaderOptions to the loader. Must be | 62 // Associate the corresponding WebURLLoaderOptions to the loader. Must be |
62 // called before Start. Used if the LoaderType is FRAME_ASSOCIATED_LOADER. | 63 // called before Start. Used if the LoaderType is FRAME_ASSOCIATED_LOADER. |
63 virtual void SetLoaderOptions(const blink::WebURLLoaderOptions& options) = 0; | 64 virtual void SetLoaderOptions(const blink::WebURLLoaderOptions& options) = 0; |
64 | 65 |
65 // Starts the request using the specified frame. Calls |callback| when | 66 // Starts the request using the specified frame. Calls |callback| when |
66 // done. | 67 // done. |
67 virtual void Start(blink::WebFrame* frame, | 68 virtual void Start(blink::WebFrame* frame, |
68 blink::WebURLRequest::RequestContext request_context, | 69 blink::WebURLRequest::RequestContext request_context, |
69 blink::WebURLRequest::FrameType frame_type, | 70 blink::WebURLRequest::FrameType frame_type, |
70 LoaderType loader_type, | 71 LoaderType loader_type, |
71 const Callback& callback) = 0; | 72 const Callback& callback) = 0; |
72 | 73 |
73 // Sets how long to wait for the server to reply. By default, there is no | 74 // Sets how long to wait for the server to reply. By default, there is no |
74 // timeout. Must be called after a request is started. | 75 // timeout. Must be called after a request is started. |
75 virtual void SetTimeout(const base::TimeDelta& timeout) = 0; | 76 virtual void SetTimeout(const base::TimeDelta& timeout) = 0; |
76 | 77 |
77 // Manually cancel the request. | 78 // Manually cancel the request. |
78 virtual void Cancel() = 0; | 79 virtual void Cancel() = 0; |
79 }; | 80 }; |
80 | 81 |
81 } // namespace content | 82 } // namespace content |
82 | 83 |
83 #endif // CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_ | 84 #endif // CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_ |
OLD | NEW |