Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include "base/macros.h" |
| 9 | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/browser/loader/resource_handler.h" | 10 #include "content/browser/loader/resource_handler.h" |
| 11 #include "content/public/common/resource_response.h" | 11 #include "content/browser/streams/stream_write_observer.h" |
| 12 | |
| 13 namespace IPC { | |
| 14 class Message; | |
| 15 } | |
| 16 | |
| 17 namespace net { | |
| 18 class IOBuffer; | |
| 19 class URLRequest; | |
| 20 } | |
| 21 | 12 |
| 22 namespace content { | 13 namespace content { |
| 23 class ResourceContext; | |
| 24 class ResourceDispatcherHostImpl; | |
| 25 class ResourceMessageFilter; | |
| 26 | 14 |
| 27 // Used to complete a synchronous resource request in response to resource load | 15 class NavigationURLLoaderCore; |
| 28 // events from the resource dispatcher host. | 16 class Stream; |
| 29 class SyncResourceHandler : public ResourceHandler { | 17 |
| 18 // The leaf ResourceHandler used with NavigationURLLoaderCore. | |
| 19 class NavigationResourceHandler : public StreamWriteObserver, | |
| 20 public ResourceHandler { | |
| 30 public: | 21 public: |
| 31 SyncResourceHandler(net::URLRequest* request, | 22 NavigationResourceHandler(net::URLRequest* request, |
| 32 IPC::Message* result_message, | 23 NavigationURLLoaderCore* core); |
| 33 ResourceDispatcherHostImpl* resource_dispatcher_host); | 24 virtual ~NavigationResourceHandler(); |
| 34 virtual ~SyncResourceHandler(); | |
| 35 | 25 |
| 26 void Cancel(); | |
| 27 void Resume(); | |
| 28 | |
| 29 // ResourceHandler implementation. | |
| 36 virtual bool OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 30 virtual bool OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
| 31 | |
| 37 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 32 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 38 ResourceResponse* response, | 33 ResourceResponse* response, |
| 39 bool* defer) OVERRIDE; | 34 bool* defer) OVERRIDE; |
| 35 | |
| 40 virtual bool OnResponseStarted(ResourceResponse* response, | 36 virtual bool OnResponseStarted(ResourceResponse* response, |
| 41 bool* defer) OVERRIDE; | 37 bool* defer) OVERRIDE; |
| 38 | |
| 42 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; | 39 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; |
| 40 | |
| 43 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) OVERRIDE; | 41 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) OVERRIDE; |
| 42 | |
| 44 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 43 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 45 int* buf_size, | 44 int* buf_size, |
| 46 int min_size) OVERRIDE; | 45 int min_size) OVERRIDE; |
| 46 | |
| 47 virtual bool OnReadCompleted(int bytes_read, bool* defer) OVERRIDE; | 47 virtual bool OnReadCompleted(int bytes_read, bool* defer) OVERRIDE; |
| 48 | |
| 48 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 49 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
| 49 const std::string& security_info, | 50 const std::string& security_info, |
| 50 bool* defer) OVERRIDE; | 51 bool* defer) OVERRIDE; |
| 52 | |
| 51 virtual void OnDataDownloaded(int bytes_downloaded) OVERRIDE; | 53 virtual void OnDataDownloaded(int bytes_downloaded) OVERRIDE; |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 enum { kReadBufSize = 3840 }; | 56 // StreamWriteObserver implementation. |
| 57 virtual void OnSpaceAvailable(Stream* stream) OVERRIDE; | |
| 58 virtual void OnClose(Stream* stream) OVERRIDE; | |
| 55 | 59 |
| 60 scoped_refptr<NavigationURLLoaderCore> core_; | |
| 61 scoped_refptr<Stream> stream_; | |
| 56 scoped_refptr<net::IOBuffer> read_buffer_; | 62 scoped_refptr<net::IOBuffer> read_buffer_; |
| 57 | 63 DISALLOW_COPY_AND_ASSIGN(NavigationResourceHandler); |
| 58 SyncLoadResult result_; | |
| 59 IPC::Message* result_message_; | |
| 60 ResourceDispatcherHostImpl* rdh_; | |
| 61 int64 total_transfer_size_; | |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace content | 66 } // namespace content |
| 65 | 67 |
| 66 #endif // CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ | 68 #endif // CONTENT_BROWSER_LOADER_CERTIFICATE_RESOURCE_HANDLER_H_ |
|
clamy
2014/09/12 20:51:25
s/CERTIFICATE/NAVIGATION
davidben
2014/09/19 18:30:49
Done.
| |
| OLD | NEW |