OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Replace the CreateTemporaryFileStream implementation with a mocked one for | 51 // Replace the CreateTemporaryFileStream implementation with a mocked one for |
52 // testing purposes. The function should create a net::FileStream and a | 52 // testing purposes. The function should create a net::FileStream and a |
53 // ShareableFileReference and then asynchronously pass them to the | 53 // ShareableFileReference and then asynchronously pass them to the |
54 // CreateTemporaryFileStreamCallback. | 54 // CreateTemporaryFileStreamCallback. |
55 void SetCreateTemporaryFileStreamFunctionForTesting( | 55 void SetCreateTemporaryFileStreamFunctionForTesting( |
56 const CreateTemporaryFileStreamFunction& create_temporary_file_stream); | 56 const CreateTemporaryFileStreamFunction& create_temporary_file_stream); |
57 | 57 |
58 // LayeredResourceHandler implementation: | 58 // LayeredResourceHandler implementation: |
59 virtual bool OnResponseStarted(ResourceResponse* response, | 59 virtual bool OnResponseStarted(ResourceResponse* response, |
60 bool* defer) OVERRIDE; | 60 bool* defer) override; |
61 virtual bool OnWillStart(const GURL& url, bool* defer) OVERRIDE; | 61 virtual bool OnWillStart(const GURL& url, bool* defer) override; |
62 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 62 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
63 int* buf_size, | 63 int* buf_size, |
64 int min_size) OVERRIDE; | 64 int min_size) override; |
65 virtual bool OnReadCompleted(int bytes_read, bool* defer) OVERRIDE; | 65 virtual bool OnReadCompleted(int bytes_read, bool* defer) override; |
66 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 66 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
67 const std::string& security_info, | 67 const std::string& security_info, |
68 bool* defer) OVERRIDE; | 68 bool* defer) override; |
69 | 69 |
70 private: | 70 private: |
71 void DidCreateTemporaryFile(base::File::Error error_code, | 71 void DidCreateTemporaryFile(base::File::Error error_code, |
72 scoped_ptr<net::FileStream> file_stream, | 72 scoped_ptr<net::FileStream> file_stream, |
73 storage::ShareableFileReference* deletable_file); | 73 storage::ShareableFileReference* deletable_file); |
74 | 74 |
75 // Called by RedirectToFileResourceHandler::Writer. | 75 // Called by RedirectToFileResourceHandler::Writer. |
76 void DidWriteToFile(int result); | 76 void DidWriteToFile(int result); |
77 | 77 |
78 bool WriteMore(); | 78 bool WriteMore(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 std::string completed_security_info_; | 113 std::string completed_security_info_; |
114 | 114 |
115 base::WeakPtrFactory<RedirectToFileResourceHandler> weak_factory_; | 115 base::WeakPtrFactory<RedirectToFileResourceHandler> weak_factory_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); | 117 DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace content | 120 } // namespace content |
121 | 121 |
122 #endif // CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ | 122 #endif // CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ |
OLD | NEW |