OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_FETCHERS_ASSOCIATED_RESOURCE_FETCHER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_FETCHERS_ASSOCIATED_RESOURCE_FETCHER_IMPL_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/timer/timer.h" |
| 15 #include "content/public/renderer/associated_resource_fetcher.h" |
| 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 17 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderOptions.h" |
| 18 |
| 19 class GURL; |
| 20 |
| 21 namespace blink { |
| 22 class WebAssociatedURLLoader; |
| 23 class WebFrame; |
| 24 class WebURLLoader; |
| 25 enum class WebCachePolicy; |
| 26 } |
| 27 |
| 28 namespace content { |
| 29 |
| 30 class AssociatedResourceFetcherImpl : public AssociatedResourceFetcher { |
| 31 public: |
| 32 // AssociatedResourceFetcher implementation: |
| 33 void SetSkipServiceWorker( |
| 34 blink::WebURLRequest::SkipServiceWorker skip_service_worker) override; |
| 35 void SetCachePolicy(blink::WebCachePolicy policy) override; |
| 36 void SetLoaderOptions( |
| 37 const blink::WebAssociatedURLLoaderOptions& options) override; |
| 38 void Start(blink::WebFrame* frame, |
| 39 blink::WebURLRequest::RequestContext request_context, |
| 40 blink::WebURLRequest::FrameType frame_type, |
| 41 const Callback& callback) override; |
| 42 |
| 43 private: |
| 44 friend class AssociatedResourceFetcher; |
| 45 |
| 46 class ClientImpl; |
| 47 |
| 48 explicit AssociatedResourceFetcherImpl(const GURL& url); |
| 49 |
| 50 ~AssociatedResourceFetcherImpl() override; |
| 51 |
| 52 void Cancel() override; |
| 53 |
| 54 std::unique_ptr<blink::WebAssociatedURLLoader> loader_; |
| 55 std::unique_ptr<ClientImpl> client_; |
| 56 |
| 57 // Options to send to the loader. |
| 58 blink::WebAssociatedURLLoaderOptions options_; |
| 59 |
| 60 // Request to send. |
| 61 blink::WebURLRequest request_; |
| 62 |
| 63 // Limit how long to wait for the server. |
| 64 base::OneShotTimer timeout_timer_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(AssociatedResourceFetcherImpl); |
| 67 }; |
| 68 |
| 69 } // namespace content |
| 70 |
| 71 #endif // CONTENT_RENDERER_FETCHERS_ASSOCIATED_RESOURCE_FETCHER_IMPL_H_ |
OLD | NEW |