OLD | NEW |
---|---|
1 // Copyright (c) 2009 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_HOST_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // or by the update algorithm (see AppCacheUpdateJob). | 76 // or by the update algorithm (see AppCacheUpdateJob). |
77 void AssociateCache(AppCache* cache); | 77 void AssociateCache(AppCache* cache); |
78 | 78 |
79 // Adds a reference to the newest complete cache in a group, unless it's the | 79 // Adds a reference to the newest complete cache in a group, unless it's the |
80 // same as the cache that is currently associated with the host. | 80 // same as the cache that is currently associated with the host. |
81 void SetSwappableCache(AppCacheGroup* group); | 81 void SetSwappableCache(AppCacheGroup* group); |
82 | 82 |
83 // Used to ensure that a loaded appcache survives a frame navigation. | 83 // Used to ensure that a loaded appcache survives a frame navigation. |
84 void LoadMainResourceCache(int64 cache_id); | 84 void LoadMainResourceCache(int64 cache_id); |
85 | 85 |
86 // Used to notify the host that a request was blocked by a policy. | |
michaeln
2010/04/08 18:17:42
Maybe update the comment to say that the main reso
jochen (gone - plz use gerrit)
2010/04/09 15:44:47
Done.
| |
87 void NotifyContentBlocked(); | |
88 | |
86 // Used by the update job to keep track of which hosts are associated | 89 // Used by the update job to keep track of which hosts are associated |
87 // with which pending master entries. | 90 // with which pending master entries. |
88 const GURL& pending_master_entry_url() const { | 91 const GURL& pending_master_entry_url() const { |
89 return new_master_entry_url_; | 92 return new_master_entry_url_; |
90 } | 93 } |
91 | 94 |
92 int host_id() const { return host_id_; } | 95 int host_id() const { return host_id_; } |
93 AppCacheService* service() const { return service_; } | 96 AppCacheService* service() const { return service_; } |
94 AppCacheFrontend* frontend() const { return frontend_; } | 97 AppCacheFrontend* frontend() const { return frontend_; } |
95 AppCache* associated_cache() const { return associated_cache_.get(); } | 98 AppCache* associated_cache() const { return associated_cache_.get(); } |
(...skipping 13 matching lines...) Expand all Loading... | |
109 virtual void OnGroupLoaded(AppCacheGroup* group, | 112 virtual void OnGroupLoaded(AppCacheGroup* group, |
110 const GURL& manifest_url); | 113 const GURL& manifest_url); |
111 | 114 |
112 void FinishCacheSelection(AppCache* cache, AppCacheGroup* group); | 115 void FinishCacheSelection(AppCache* cache, AppCacheGroup* group); |
113 void DoPendingGetStatus(); | 116 void DoPendingGetStatus(); |
114 void DoPendingStartUpdate(); | 117 void DoPendingStartUpdate(); |
115 void DoPendingSwapCache(); | 118 void DoPendingSwapCache(); |
116 | 119 |
117 void ObserveGroupBeingUpdated(AppCacheGroup* group); | 120 void ObserveGroupBeingUpdated(AppCacheGroup* group); |
118 | 121 |
119 // AppCacheGroup::UpdateObserver method | 122 // AppCacheGroup::UpdateObserver methods. |
123 virtual void OnContentBlocked(AppCacheGroup* group); | |
120 virtual void OnUpdateComplete(AppCacheGroup* group); | 124 virtual void OnUpdateComplete(AppCacheGroup* group); |
121 | 125 |
122 // Identifies the corresponding appcache host in the child process. | 126 // Identifies the corresponding appcache host in the child process. |
123 int host_id_; | 127 int host_id_; |
124 | 128 |
125 // The cache associated with this host, if any. | 129 // The cache associated with this host, if any. |
126 scoped_refptr<AppCache> associated_cache_; | 130 scoped_refptr<AppCache> associated_cache_; |
127 | 131 |
128 // Hold a reference to the newest complete cache (if associated cache is | 132 // Hold a reference to the newest complete cache (if associated cache is |
129 // not the newest) to keep the newest cache in existence while the app cache | 133 // not the newest) to keep the newest cache in existence while the app cache |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 // Since these are synchronous scriptable api calls in the client, | 166 // Since these are synchronous scriptable api calls in the client, |
163 // there can only be one type of callback pending. | 167 // there can only be one type of callback pending. |
164 // Also, we have to wait until we have a cache selection prior | 168 // Also, we have to wait until we have a cache selection prior |
165 // to responding to these calls, as cache selection involves | 169 // to responding to these calls, as cache selection involves |
166 // async loading of a cache or a group from storage. | 170 // async loading of a cache or a group from storage. |
167 GetStatusCallback* pending_get_status_callback_; | 171 GetStatusCallback* pending_get_status_callback_; |
168 StartUpdateCallback* pending_start_update_callback_; | 172 StartUpdateCallback* pending_start_update_callback_; |
169 SwapCacheCallback* pending_swap_cache_callback_; | 173 SwapCacheCallback* pending_swap_cache_callback_; |
170 void* pending_callback_param_; | 174 void* pending_callback_param_; |
171 | 175 |
176 // True if requests for this host were blocked by a policy. | |
177 bool content_blocked_; | |
178 | |
172 // List of objects observing us. | 179 // List of objects observing us. |
173 ObserverList<Observer> observers_; | 180 ObserverList<Observer> observers_; |
174 | 181 |
175 friend class AppCacheRequestHandlerTest; | 182 friend class AppCacheRequestHandlerTest; |
176 friend class AppCacheUpdateJobTest; | 183 friend class AppCacheUpdateJobTest; |
177 FRIEND_TEST(AppCacheTest, CleanupUnusedCache); | 184 FRIEND_TEST(AppCacheTest, CleanupUnusedCache); |
178 FRIEND_TEST(AppCacheGroupTest, CleanupUnusedGroup); | 185 FRIEND_TEST(AppCacheGroupTest, CleanupUnusedGroup); |
179 FRIEND_TEST(AppCacheHostTest, Basic); | 186 FRIEND_TEST(AppCacheHostTest, Basic); |
180 FRIEND_TEST(AppCacheHostTest, SelectNoCache); | 187 FRIEND_TEST(AppCacheHostTest, SelectNoCache); |
181 FRIEND_TEST(AppCacheHostTest, ForeignEntry); | 188 FRIEND_TEST(AppCacheHostTest, ForeignEntry); |
182 FRIEND_TEST(AppCacheHostTest, FailedCacheLoad); | 189 FRIEND_TEST(AppCacheHostTest, FailedCacheLoad); |
183 FRIEND_TEST(AppCacheHostTest, FailedGroupLoad); | 190 FRIEND_TEST(AppCacheHostTest, FailedGroupLoad); |
184 FRIEND_TEST(AppCacheHostTest, SetSwappableCache); | 191 FRIEND_TEST(AppCacheHostTest, SetSwappableCache); |
185 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); | 192 FRIEND_TEST(AppCacheGroupTest, QueueUpdate); |
186 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); | 193 DISALLOW_COPY_AND_ASSIGN(AppCacheHost); |
187 }; | 194 }; |
188 | 195 |
189 } // namespace appcache | 196 } // namespace appcache |
190 | 197 |
191 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ | 198 #endif // WEBKIT_APPCACHE_APPCACHE_HOST_H_ |
OLD | NEW |