OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 7 |
| 8 #include "net/url_request/url_request.h" |
| 9 #include "webkit/appcache/appcache_host.h" |
| 10 |
| 11 class URLRequest; |
| 12 class URLRequestJob; |
| 13 |
| 14 namespace appcache { |
| 15 |
| 16 // An instance is created for each URLRequest. The instance survives all |
| 17 // http transactions involved in the processing of its URLRequest, and is |
| 18 // given the opportunity to hijack the request along the way. Callers |
| 19 // should use AppCacheHost::CreateRequestHandler to manufacture instances |
| 20 // that can retrieve resources for a particular host. |
| 21 class AppCacheRequestHandler : public URLRequest::UserData { |
| 22 public: |
| 23 // Should be called on each request intercept opportunity. |
| 24 URLRequestJob* MaybeLoadResource(URLRequest* request); |
| 25 URLRequestJob* MaybeLoadFallbackForRedirect(URLRequest* request, |
| 26 const GURL& location); |
| 27 URLRequestJob* MaybeLoadFallbackForResponse(URLRequest* request); |
| 28 |
| 29 void GetExtraResponseInfo(int64* cache_id, GURL* manifest_url); |
| 30 |
| 31 private: |
| 32 friend class AppCacheHost; |
| 33 |
| 34 // Ctor for main resource loads. |
| 35 explicit AppCacheRequestHandler(AppCacheHost* host); |
| 36 |
| 37 // Ctor for subresource loads when the cache is loaded. |
| 38 explicit AppCacheRequestHandler(AppCache* cache); |
| 39 |
| 40 // Main vs subresource loads are very different. |
| 41 // TODO(michaeln): maybe have two derived classes? |
| 42 bool is_main_request_; |
| 43 int64 cache_id_; |
| 44 scoped_refptr<AppCache> cache_; |
| 45 base::WeakPtr<AppCacheHost> host_; |
| 46 scoped_refptr<URLRequestJob> job_; |
| 47 AppCacheService* service_; |
| 48 }; |
| 49 |
| 50 } // namespace appcache |
| 51 |
| 52 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
| 53 |
OLD | NEW |