| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ |
| 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ | 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "net/url_request/url_request_job_factory.h" | 11 #include "net/url_request/url_request_job_factory.h" |
| 11 #include "webkit/storage/webkit_storage_export.h" | 12 #include "webkit/storage/webkit_storage_export.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class MessageLoopProxy; | 15 class MessageLoopProxy; |
| 15 } // namespace base | 16 } // namespace base |
| 16 | 17 |
| 17 namespace fileapi { | 18 namespace fileapi { |
| 18 class FileSystemContext; | 19 class FileSystemContext; |
| 19 } // namespace fileapi | 20 } // namespace fileapi |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 class URLRequest; | 23 class URLRequest; |
| 23 } // namespace net | 24 } // namespace net |
| 24 | 25 |
| 25 namespace webkit_blob { | 26 namespace webkit_blob { |
| 26 | 27 |
| 27 class BlobData; | 28 class BlobData; |
| 28 class BlobStorageController; | 29 class BlobDataHandle; |
| 30 class BlobStorageContext; |
| 29 | 31 |
| 30 class WEBKIT_STORAGE_EXPORT BlobProtocolHandler | 32 class WEBKIT_STORAGE_EXPORT BlobProtocolHandler |
| 31 : public net::URLRequestJobFactory::ProtocolHandler { | 33 : public net::URLRequestJobFactory::ProtocolHandler { |
| 32 public: | 34 public: |
| 33 // |controller|'s lifetime should exceed the lifetime of the ProtocolHandler. | 35 static void SetRequestedBlobDataHandle( |
| 34 BlobProtocolHandler(BlobStorageController* blob_storage_controller, | 36 net::URLRequest* request, |
| 37 scoped_ptr<BlobDataHandle> blob_data_handle); |
| 38 |
| 39 // The |contexts|'s lifetime should exceed the lifetime of the ProtocolHandler
. |
| 40 BlobProtocolHandler(BlobStorageContext* blob_storage_context, |
| 35 fileapi::FileSystemContext* file_system_context, | 41 fileapi::FileSystemContext* file_system_context, |
| 36 base::MessageLoopProxy* file_loop_proxy); | 42 base::MessageLoopProxy* file_loop_proxy); |
| 37 virtual ~BlobProtocolHandler(); | 43 virtual ~BlobProtocolHandler(); |
| 38 | 44 |
| 39 virtual net::URLRequestJob* MaybeCreateJob( | 45 virtual net::URLRequestJob* MaybeCreateJob( |
| 40 net::URLRequest* request, | 46 net::URLRequest* request, |
| 41 net::NetworkDelegate* network_delegate) const OVERRIDE; | 47 net::NetworkDelegate* network_delegate) const OVERRIDE; |
| 42 | 48 |
| 43 private: | 49 private: |
| 44 virtual scoped_refptr<BlobData> LookupBlobData( | 50 scoped_refptr<BlobData> LookupBlobData( |
| 45 net::URLRequest* request) const; | 51 net::URLRequest* request) const; |
| 46 | 52 |
| 47 // No scoped_refptr because |blob_storage_controller_| is owned by the | |
| 48 // ProfileIOData, which also owns this ProtocolHandler. | |
| 49 BlobStorageController* const blob_storage_controller_; | |
| 50 const scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 53 const scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 51 const scoped_refptr<base::MessageLoopProxy> file_loop_proxy_; | 54 const scoped_refptr<base::MessageLoopProxy> file_loop_proxy_; |
| 52 | 55 |
| 53 DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler); | 56 DISALLOW_COPY_AND_ASSIGN(BlobProtocolHandler); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace webkit_blob | 59 } // namespace webkit_blob |
| 57 | 60 |
| 58 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ | 61 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_FACTORY_H_ |
| OLD | NEW |