| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The intent of this file is to provide a type-neutral abstraction between | 5 // The intent of this file is to provide a type-neutral abstraction between |
| 6 // Chrome and WebKit for resource loading. This pure-virtual interface is | 6 // Chrome and WebKit for resource loading. This pure-virtual interface is |
| 7 // implemented by the embedder, which also provides a factory method Create | 7 // implemented by the embedder, which also provides a factory method Create |
| 8 // to instantiate this object. | 8 // to instantiate this object. |
| 9 // | 9 // |
| 10 // One of these objects will be created by WebKit for each request. WebKit | 10 // One of these objects will be created by WebKit for each request. WebKit |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // An opaque string carrying security information pertaining to this | 64 // An opaque string carrying security information pertaining to this |
| 65 // response. This may include information about the SSL connection used. | 65 // response. This may include information about the SSL connection used. |
| 66 std::string security_info; | 66 std::string security_info; |
| 67 | 67 |
| 68 // Content length if available. -1 if not available | 68 // Content length if available. -1 if not available |
| 69 int64 content_length; | 69 int64 content_length; |
| 70 | 70 |
| 71 // The appcache this response was loaded from, or kNoAppCacheId. | 71 // The appcache this response was loaded from, or kNoAppCacheId. |
| 72 int64 app_cache_id; | 72 int64 app_cache_id; |
| 73 | |
| 74 // A platform specific handle for a file that carries response data. This | |
| 75 // entry is used if the resource request is of type ResourceType::MEDIA and | |
| 76 // the underlying cache layer keeps the response data in a standalone file. | |
| 77 #if defined(OS_POSIX) | |
| 78 // If the response data file is available, the file handle is stored in | |
| 79 // response_data_file.fd, its value is base::kInvalidPlatformFileValue | |
| 80 // otherwise. | |
| 81 base::FileDescriptor response_data_file; | |
| 82 #elif defined(OS_WIN) | |
| 83 // An asynchronous file handle to the response data file, its value is | |
| 84 // base::kInvalidPlatformFileValue if the file is not available. | |
| 85 base::PlatformFile response_data_file; | |
| 86 #endif | |
| 87 }; | 73 }; |
| 88 | 74 |
| 89 // See the SyncLoad method declared below. (The name of this struct is not | 75 // See the SyncLoad method declared below. (The name of this struct is not |
| 90 // suffixed with "Info" because it also contains the response data.) | 76 // suffixed with "Info" because it also contains the response data.) |
| 91 struct SyncLoadResponse : ResponseInfo { | 77 struct SyncLoadResponse : ResponseInfo { |
| 92 SyncLoadResponse(); | 78 SyncLoadResponse(); |
| 93 ~SyncLoadResponse(); | 79 ~SyncLoadResponse(); |
| 94 | 80 |
| 95 // The response status. | 81 // The response status. |
| 96 URLRequestStatus status; | 82 URLRequestStatus status; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 // within webkit. The Peer and it's bridge should have identical lifetimes | 93 // within webkit. The Peer and it's bridge should have identical lifetimes |
| 108 // as they represent each end of a communication channel. | 94 // as they represent each end of a communication channel. |
| 109 // | 95 // |
| 110 // These callbacks mirror URLRequest::Delegate and the order and conditions | 96 // These callbacks mirror URLRequest::Delegate and the order and conditions |
| 111 // in which they will be called are identical. See url_request.h for more | 97 // in which they will be called are identical. See url_request.h for more |
| 112 // information. | 98 // information. |
| 113 class Peer { | 99 class Peer { |
| 114 public: | 100 public: |
| 115 virtual ~Peer() {} | 101 virtual ~Peer() {} |
| 116 | 102 |
| 117 // Called as download progress is made. | |
| 118 // note: only for requests with LOAD_ENABLE_DOWNLOAD_FILE set and the | |
| 119 // resource is downloaded to a standalone file and the file handle to it is | |
| 120 // passed in ResponseInfo during OnReceivedResponse. Note that size may be | |
| 121 // unknown and |size| will be kuint64max in that case. | |
| 122 virtual void OnDownloadProgress(uint64 position, uint64 size) {} | |
| 123 | |
| 124 // Called as upload progress is made. | 103 // Called as upload progress is made. |
| 125 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set | 104 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set |
| 126 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; | 105 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; |
| 127 | 106 |
| 128 // Called when a redirect occurs. | 107 // Called when a redirect occurs. |
| 129 virtual void OnReceivedRedirect(const GURL& new_url) = 0; | 108 virtual void OnReceivedRedirect(const GURL& new_url) = 0; |
| 130 | 109 |
| 131 // Called when response headers are available (after all redirects have | 110 // Called when response headers are available (after all redirects have |
| 132 // been followed). |content_filtered| is set to true if the contents is | 111 // been followed). |content_filtered| is set to true if the contents is |
| 133 // altered or replaced (usually for security reasons when the resource is | 112 // altered or replaced (usually for security reasons when the resource is |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // construction must go through Create() | 219 // construction must go through Create() |
| 241 ResourceLoaderBridge(); | 220 ResourceLoaderBridge(); |
| 242 | 221 |
| 243 private: | 222 private: |
| 244 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); | 223 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); |
| 245 }; | 224 }; |
| 246 | 225 |
| 247 } // namespace webkit_glue | 226 } // namespace webkit_glue |
| 248 | 227 |
| 249 #endif // RESOURCE_LOADER_BRIDGE_ | 228 #endif // RESOURCE_LOADER_BRIDGE_ |
| OLD | NEW |