OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
7 | 7 |
8 #include "net/url_request/url_request.h" | 8 #include "net/url_request/url_request.h" |
9 #include "webkit/appcache/appcache_entry.h" | 9 #include "webkit/appcache/appcache_entry.h" |
10 #include "webkit/appcache/appcache_host.h" | 10 #include "webkit/appcache/appcache_host.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 // Callers should use AppCacheHost::CreateRequestHandler. | 47 // Callers should use AppCacheHost::CreateRequestHandler. |
48 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); | 48 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); |
49 | 49 |
50 // AppCacheHost::Observer override | 50 // AppCacheHost::Observer override |
51 virtual void OnDestructionImminent(AppCacheHost* host); | 51 virtual void OnDestructionImminent(AppCacheHost* host); |
52 | 52 |
53 // Helpers to instruct a waiting job with what response to | 53 // Helpers to instruct a waiting job with what response to |
54 // deliver for the request we're handling. | 54 // deliver for the request we're handling. |
55 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, | 55 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, |
56 const GURL& manifest_url, bool is_fallback); | 56 const GURL& manifest_url, bool is_fallback, |
57 const GURL& fallback_url); | |
kinuko
2010/11/02 07:47:23
nit: per recent addition to the coding style guide
michaeln
2010/11/02 20:25:36
I'll see if this fits...
void DeliverAppCachedRes
| |
57 void DeliverNetworkResponse(); | 58 void DeliverNetworkResponse(); |
58 void DeliverErrorResponse(); | 59 void DeliverErrorResponse(); |
59 | 60 |
60 // Helper to retrieve a pointer to the storage object. | 61 // Helper to retrieve a pointer to the storage object. |
61 AppCacheStorage* storage() const; | 62 AppCacheStorage* storage() const; |
62 | 63 |
63 bool is_main_resource() const { | 64 bool is_main_resource() const { |
64 return IsMainResourceType(resource_type_); | 65 return IsMainResourceType(resource_type_); |
65 } | 66 } |
66 | 67 |
67 // Main-resource loading ------------------------------------- | 68 // Main-resource loading ------------------------------------- |
68 // Frame and SharedWorker main resources are handled here. | 69 // Frame and SharedWorker main resources are handled here. |
69 | 70 |
70 void MaybeLoadMainResource(URLRequest* request); | 71 void MaybeLoadMainResource(URLRequest* request); |
71 | 72 |
72 // AppCacheStorage::Delegate methods | 73 // AppCacheStorage::Delegate methods |
73 virtual void OnMainResponseFound( | 74 virtual void OnMainResponseFound( |
74 const GURL& url, const AppCacheEntry& entry, | 75 const GURL& url, const AppCacheEntry& entry, |
75 const AppCacheEntry& fallback_entry, | 76 const GURL& fallback_url, const AppCacheEntry& fallback_entry, |
76 int64 cache_id, const GURL& mainfest_url, | 77 int64 cache_id, const GURL& mainfest_url, |
77 bool was_blocked_by_policy); | 78 bool was_blocked_by_policy); |
78 | 79 |
79 // Sub-resource loading ------------------------------------- | 80 // Sub-resource loading ------------------------------------- |
80 // Dedicated worker and all manner of sub-resources are handled here. | 81 // Dedicated worker and all manner of sub-resources are handled here. |
81 | 82 |
82 void MaybeLoadSubResource(URLRequest* request); | 83 void MaybeLoadSubResource(URLRequest* request); |
83 void ContinueMaybeLoadSubResource(); | 84 void ContinueMaybeLoadSubResource(); |
84 | 85 |
85 // AppCacheHost::Observer override | 86 // AppCacheHost::Observer override |
86 virtual void OnCacheSelectionComplete(AppCacheHost* host); | 87 virtual void OnCacheSelectionComplete(AppCacheHost* host); |
87 | 88 |
88 // Data members ----------------------------------------------- | 89 // Data members ----------------------------------------------- |
89 | 90 |
90 // What host we're servicing a request for. | 91 // What host we're servicing a request for. |
91 AppCacheHost* host_; | 92 AppCacheHost* host_; |
92 | 93 |
93 // Frame vs subresource vs sharedworker loads are somewhat different. | 94 // Frame vs subresource vs sharedworker loads are somewhat different. |
94 ResourceType::Type resource_type_; | 95 ResourceType::Type resource_type_; |
95 | 96 |
96 // Subresource requests wait until after cache selection completes. | 97 // Subresource requests wait until after cache selection completes. |
97 bool is_waiting_for_cache_selection_; | 98 bool is_waiting_for_cache_selection_; |
98 | 99 |
99 // Info about the type of response we found for delivery. | 100 // Info about the type of response we found for delivery. |
100 // These are relevant for both main and subresource requests. | 101 // These are relevant for both main and subresource requests. |
102 int64 found_cache_id_; | |
101 AppCacheEntry found_entry_; | 103 AppCacheEntry found_entry_; |
102 AppCacheEntry found_fallback_entry_; | 104 AppCacheEntry found_fallback_entry_; |
103 int64 found_cache_id_; | 105 GURL found_fallback_url_; |
104 GURL found_manifest_url_; | 106 GURL found_manifest_url_; |
105 bool found_network_namespace_; | 107 bool found_network_namespace_; |
106 | 108 |
107 // True if a cache entry this handler attempted to return was | 109 // True if a cache entry this handler attempted to return was |
108 // not found in the disk cache. Once set, the handler will take | 110 // not found in the disk cache. Once set, the handler will take |
109 // no action on all subsequent intercept opportunities, so the | 111 // no action on all subsequent intercept opportunities, so the |
110 // request and any redirects will be handled by the network library. | 112 // request and any redirects will be handled by the network library. |
111 bool cache_entry_not_found_; | 113 bool cache_entry_not_found_; |
112 | 114 |
113 // The job we use to deliver a response. | 115 // The job we use to deliver a response. |
114 scoped_refptr<AppCacheURLRequestJob> job_; | 116 scoped_refptr<AppCacheURLRequestJob> job_; |
115 | 117 |
116 friend class AppCacheRequestHandlerTest; | 118 friend class AppCacheRequestHandlerTest; |
117 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); | 119 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); |
118 }; | 120 }; |
119 | 121 |
120 } // namespace appcache | 122 } // namespace appcache |
121 | 123 |
122 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ | 124 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ |
123 | 125 |
OLD | NEW |