| 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 #include "webkit/appcache/appcache_host.h" | 5 #include "webkit/appcache/appcache_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "webkit/appcache/appcache.h" | 9 #include "webkit/appcache/appcache.h" |
| 10 #include "webkit/appcache/appcache_backend_impl.h" | 10 #include "webkit/appcache/appcache_backend_impl.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // 6.9.6 The application cache selection algorithm | 310 // 6.9.6 The application cache selection algorithm |
| 311 if (cache) { | 311 if (cache) { |
| 312 // If document was loaded from an application cache, Associate document | 312 // If document was loaded from an application cache, Associate document |
| 313 // with the application cache from which it was loaded. Invoke the | 313 // with the application cache from which it was loaded. Invoke the |
| 314 // application cache update process for that cache and with the browsing | 314 // application cache update process for that cache and with the browsing |
| 315 // context being navigated. | 315 // context being navigated. |
| 316 DCHECK(cache->owning_group()); | 316 DCHECK(cache->owning_group()); |
| 317 DCHECK(new_master_entry_url_.is_empty()); | 317 DCHECK(new_master_entry_url_.is_empty()); |
| 318 AppCacheGroup* owing_group = cache->owning_group(); | 318 AppCacheGroup* owing_group = cache->owning_group(); |
| 319 const char* kFormatString = | 319 const char* kFormatString = |
| 320 "Document was loaded from appcache with manifest %s"; | 320 "Document was loaded from Application Cache with manifest %s"; |
| 321 frontend_->OnLogMessage( | 321 frontend_->OnLogMessage( |
| 322 host_id_, LOG_INFO, | 322 host_id_, LOG_INFO, |
| 323 StringPrintf( | 323 StringPrintf( |
| 324 kFormatString, owing_group->manifest_url().spec().c_str())); | 324 kFormatString, owing_group->manifest_url().spec().c_str())); |
| 325 AssociateCache(cache); | 325 AssociateCache(cache); |
| 326 if (!owing_group->is_obsolete() && !owing_group->is_being_deleted()) { | 326 if (!owing_group->is_obsolete() && !owing_group->is_being_deleted()) { |
| 327 owing_group->StartUpdateWithHost(this); | 327 owing_group->StartUpdateWithHost(this); |
| 328 ObserveGroupBeingUpdated(owing_group); | 328 ObserveGroupBeingUpdated(owing_group); |
| 329 } | 329 } |
| 330 } else if (group && !group->is_being_deleted()) { | 330 } else if (group && !group->is_being_deleted()) { |
| 331 // If document was loaded using HTTP GET or equivalent, and, there is a | 331 // If document was loaded using HTTP GET or equivalent, and, there is a |
| 332 // manifest URL, and manifest URL has the same origin as document. | 332 // manifest URL, and manifest URL has the same origin as document. |
| 333 // Invoke the application cache update process for manifest URL, with | 333 // Invoke the application cache update process for manifest URL, with |
| 334 // the browsing context being navigated, and with document and the | 334 // the browsing context being navigated, and with document and the |
| 335 // resource from which document was loaded as the new master resourse. | 335 // resource from which document was loaded as the new master resourse. |
| 336 DCHECK(!group->is_obsolete()); | 336 DCHECK(!group->is_obsolete()); |
| 337 DCHECK(new_master_entry_url_.is_valid()); | 337 DCHECK(new_master_entry_url_.is_valid()); |
| 338 const char* kFormatString = group->HasCache() ? | 338 const char* kFormatString = group->HasCache() ? |
| 339 "Adding master entry to appcache with manifest %s" : | 339 "Adding master entry to Application Cache with manifest %s" : |
| 340 "Creating appcache with manifest %s"; | 340 "Creating Application Cache with manifest %s"; |
| 341 frontend_->OnLogMessage( | 341 frontend_->OnLogMessage( |
| 342 host_id_, LOG_INFO, | 342 host_id_, LOG_INFO, |
| 343 StringPrintf(kFormatString, group->manifest_url().spec().c_str())); | 343 StringPrintf(kFormatString, group->manifest_url().spec().c_str())); |
| 344 AssociateCache(NULL); // The UpdateJob may produce one for us later. | 344 AssociateCache(NULL); // The UpdateJob may produce one for us later. |
| 345 group->StartUpdateWithNewMasterEntry(this, new_master_entry_url_); | 345 group->StartUpdateWithNewMasterEntry(this, new_master_entry_url_); |
| 346 ObserveGroupBeingUpdated(group); | 346 ObserveGroupBeingUpdated(group); |
| 347 } else { | 347 } else { |
| 348 // Otherwise, the Document is not associated with any application cache. | 348 // Otherwise, the Document is not associated with any application cache. |
| 349 new_master_entry_url_ = GURL(); | 349 new_master_entry_url_ = GURL(); |
| 350 AssociateCache(NULL); | 350 AssociateCache(NULL); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 if (cache) { | 421 if (cache) { |
| 422 cache->AssociateHost(this); | 422 cache->AssociateHost(this); |
| 423 frontend_->OnCacheSelected(host_id_, cache->cache_id(), GetStatus()); | 423 frontend_->OnCacheSelected(host_id_, cache->cache_id(), GetStatus()); |
| 424 } else { | 424 } else { |
| 425 frontend_->OnCacheSelected(host_id_, kNoCacheId, UNCACHED); | 425 frontend_->OnCacheSelected(host_id_, kNoCacheId, UNCACHED); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace appcache | 429 } // namespace appcache |
| OLD | NEW |