| 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 CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 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/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "content/browser/loader/resource_handler.h" | 17 #include "content/browser/loader/resource_handler.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/url_loader.mojom.h" | 19 #include "content/common/url_loader.mojom.h" |
| 20 #include "content/public/common/resource_type.h" |
| 20 #include "mojo/public/cpp/bindings/associated_binding.h" | 21 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 21 #include "mojo/public/cpp/system/data_pipe.h" | 22 #include "mojo/public/cpp/system/data_pipe.h" |
| 22 #include "mojo/public/cpp/system/watcher.h" | 23 #include "mojo/public/cpp/system/watcher.h" |
| 23 #include "net/base/io_buffer.h" | 24 #include "net/base/io_buffer.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| 27 class IOBufferWithSize; | 28 class IOBufferWithSize; |
| 28 class URLRequest; | 29 class URLRequest; |
| 29 } | 30 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 // | 42 // |
| 42 // This class can be inherited only for tests. | 43 // This class can be inherited only for tests. |
| 43 class CONTENT_EXPORT MojoAsyncResourceHandler | 44 class CONTENT_EXPORT MojoAsyncResourceHandler |
| 44 : public ResourceHandler, | 45 : public ResourceHandler, |
| 45 public NON_EXPORTED_BASE(mojom::URLLoader) { | 46 public NON_EXPORTED_BASE(mojom::URLLoader) { |
| 46 public: | 47 public: |
| 47 MojoAsyncResourceHandler( | 48 MojoAsyncResourceHandler( |
| 48 net::URLRequest* request, | 49 net::URLRequest* request, |
| 49 ResourceDispatcherHostImpl* rdh, | 50 ResourceDispatcherHostImpl* rdh, |
| 50 mojom::URLLoaderAssociatedRequest mojo_request, | 51 mojom::URLLoaderAssociatedRequest mojo_request, |
| 51 mojom::URLLoaderClientAssociatedPtr url_loader_client); | 52 mojom::URLLoaderClientAssociatedPtr url_loader_client, |
| 53 ResourceType resource_type); |
| 52 ~MojoAsyncResourceHandler() override; | 54 ~MojoAsyncResourceHandler() override; |
| 53 | 55 |
| 54 // ResourceHandler implementation: | 56 // ResourceHandler implementation: |
| 55 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 57 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 56 ResourceResponse* response, | 58 ResourceResponse* response, |
| 57 bool* defer) override; | 59 bool* defer) override; |
| 58 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 60 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
| 59 bool OnWillStart(const GURL& url, bool* defer) override; | 61 bool OnWillStart(const GURL& url, bool* defer) override; |
| 60 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 62 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 61 int* buf_size, | 63 int* buf_size, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 scoped_refptr<SharedWriter> shared_writer_; | 126 scoped_refptr<SharedWriter> shared_writer_; |
| 125 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_; | 127 mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_; |
| 126 | 128 |
| 127 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; | 129 base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_; |
| 128 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); | 130 DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler); |
| 129 }; | 131 }; |
| 130 | 132 |
| 131 } // namespace content | 133 } // namespace content |
| 132 | 134 |
| 133 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ | 135 #endif // CONTENT_BROWSER_LOADER_MOJO_ASYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |