OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "webkit/browser/appcache/appcache_group.h" | 5 #include "webkit/browser/appcache/appcache_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 response_ids->begin(), response_ids->end()); | 151 response_ids->begin(), response_ids->end()); |
152 response_ids->clear(); | 152 response_ids->clear(); |
153 } | 153 } |
154 | 154 |
155 void AppCacheGroup::StartUpdateWithNewMasterEntry( | 155 void AppCacheGroup::StartUpdateWithNewMasterEntry( |
156 AppCacheHost* host, const GURL& new_master_resource) { | 156 AppCacheHost* host, const GURL& new_master_resource) { |
157 DCHECK(!is_obsolete() && !is_being_deleted()); | 157 DCHECK(!is_obsolete() && !is_being_deleted()); |
158 if (is_in_dtor_) | 158 if (is_in_dtor_) |
159 return; | 159 return; |
160 | 160 |
| 161 // Hackery for 'registerController' |
| 162 if (IsFakeNavControllerGroup()) |
| 163 return; |
| 164 |
161 if (!update_job_) | 165 if (!update_job_) |
162 update_job_ = new AppCacheUpdateJob(storage_->service(), this); | 166 update_job_ = new AppCacheUpdateJob(storage_->service(), this); |
163 | 167 |
164 update_job_->StartUpdate(host, new_master_resource); | 168 update_job_->StartUpdate(host, new_master_resource); |
165 | 169 |
166 // Run queued update immediately as an update has been started manually. | 170 // Run queued update immediately as an update has been started manually. |
167 if (!restart_update_task_.IsCancelled()) { | 171 if (!restart_update_task_.IsCancelled()) { |
168 restart_update_task_.Cancel(); | 172 restart_update_task_.Cancel(); |
169 RunQueuedUpdates(); | 173 RunQueuedUpdates(); |
170 } | 174 } |
171 } | 175 } |
172 | 176 |
| 177 // Hackery for registerController |
| 178 void AppCacheGroup::StartUpdateWithFakeManifest(Manifest* manifest) { |
| 179 DCHECK(!is_obsolete() && !is_being_deleted()); |
| 180 if (is_in_dtor_) |
| 181 return; |
| 182 |
| 183 if (!update_job_) { |
| 184 update_job_ = new AppCacheUpdateJob(storage_->service(), this); |
| 185 update_job_->StartUpdateWithFakeManifest(manifest); |
| 186 } |
| 187 } |
| 188 |
173 void AppCacheGroup::CancelUpdate() { | 189 void AppCacheGroup::CancelUpdate() { |
174 if (update_job_) { | 190 if (update_job_) { |
175 delete update_job_; | 191 delete update_job_; |
176 DCHECK(!update_job_); | 192 DCHECK(!update_job_); |
177 DCHECK_EQ(IDLE, update_status_); | 193 DCHECK_EQ(IDLE, update_status_); |
178 } | 194 } |
179 } | 195 } |
180 | 196 |
181 void AppCacheGroup::QueueUpdate(AppCacheHost* host, | 197 void AppCacheGroup::QueueUpdate(AppCacheHost* host, |
182 const GURL& new_master_resource) { | 198 const GURL& new_master_resource) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // deletion by adding an extra ref in this scope (but only if we're not | 271 // deletion by adding an extra ref in this scope (but only if we're not |
256 // in our destructor). | 272 // in our destructor). |
257 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); | 273 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); |
258 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); | 274 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); |
259 if (!queued_updates_.empty()) | 275 if (!queued_updates_.empty()) |
260 ScheduleUpdateRestart(kUpdateRestartDelayMs); | 276 ScheduleUpdateRestart(kUpdateRestartDelayMs); |
261 } | 277 } |
262 } | 278 } |
263 | 279 |
264 } // namespace appcache | 280 } // namespace appcache |
OLD | NEW |