| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/appcache/appcache_host.h" | 5 #include "content/browser/appcache/appcache_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "content/browser/appcache/appcache.h" | 10 #include "content/browser/appcache/appcache.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 } | 435 } |
| 436 | 436 |
| 437 void AppCacheHost::ObserveGroupBeingUpdated(AppCacheGroup* group) { | 437 void AppCacheHost::ObserveGroupBeingUpdated(AppCacheGroup* group) { |
| 438 DCHECK(!group_being_updated_.get()); | 438 DCHECK(!group_being_updated_.get()); |
| 439 group_being_updated_ = group; | 439 group_being_updated_ = group; |
| 440 newest_cache_of_group_being_updated_ = group->newest_complete_cache(); | 440 newest_cache_of_group_being_updated_ = group->newest_complete_cache(); |
| 441 group->AddUpdateObserver(this); | 441 group->AddUpdateObserver(this); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void AppCacheHost::OnUpdateComplete(AppCacheGroup* group) { | 444 void AppCacheHost::OnUpdateComplete(AppCacheGroup* group) { |
| 445 DCHECK_EQ(group, group_being_updated_); | 445 DCHECK_EQ(group, group_being_updated_.get()); |
| 446 group->RemoveUpdateObserver(this); | 446 group->RemoveUpdateObserver(this); |
| 447 | 447 |
| 448 // Add a reference to the newest complete cache. | 448 // Add a reference to the newest complete cache. |
| 449 SetSwappableCache(group); | 449 SetSwappableCache(group); |
| 450 | 450 |
| 451 group_being_updated_ = NULL; | 451 group_being_updated_ = NULL; |
| 452 newest_cache_of_group_being_updated_ = NULL; | 452 newest_cache_of_group_being_updated_ = NULL; |
| 453 | 453 |
| 454 if (associated_cache_info_pending_ && associated_cache_.get() && | 454 if (associated_cache_info_pending_ && associated_cache_.get() && |
| 455 associated_cache_->is_complete()) { | 455 associated_cache_->is_complete()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 void AppCacheHost::NotifyMainResourceBlocked(const GURL& manifest_url) { | 493 void AppCacheHost::NotifyMainResourceBlocked(const GURL& manifest_url) { |
| 494 main_resource_blocked_ = true; | 494 main_resource_blocked_ = true; |
| 495 blocked_manifest_url_ = manifest_url; | 495 blocked_manifest_url_ = manifest_url; |
| 496 } | 496 } |
| 497 | 497 |
| 498 void AppCacheHost::PrepareForTransfer() { | 498 void AppCacheHost::PrepareForTransfer() { |
| 499 // This can only happen prior to the document having been loaded. | 499 // This can only happen prior to the document having been loaded. |
| 500 DCHECK(!associated_cache()); | 500 DCHECK(!associated_cache()); |
| 501 DCHECK(!is_selection_pending()); | 501 DCHECK(!is_selection_pending()); |
| 502 DCHECK(!group_being_updated_); | 502 DCHECK(!group_being_updated_.get()); |
| 503 host_id_ = kAppCacheNoHostId; | 503 host_id_ = kAppCacheNoHostId; |
| 504 frontend_ = NULL; | 504 frontend_ = NULL; |
| 505 } | 505 } |
| 506 | 506 |
| 507 void AppCacheHost::CompleteTransfer(int host_id, AppCacheFrontend* frontend) { | 507 void AppCacheHost::CompleteTransfer(int host_id, AppCacheFrontend* frontend) { |
| 508 host_id_ = host_id; | 508 host_id_ = host_id; |
| 509 frontend_ = frontend; | 509 frontend_ = frontend; |
| 510 } | 510 } |
| 511 | 511 |
| 512 void AppCacheHost::AssociateNoCache(const GURL& manifest_url) { | 512 void AppCacheHost::AssociateNoCache(const GURL& manifest_url) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 537 associated_cache_info_pending_ = cache && !cache->is_complete(); | 537 associated_cache_info_pending_ = cache && !cache->is_complete(); |
| 538 AppCacheInfo info; | 538 AppCacheInfo info; |
| 539 if (cache) | 539 if (cache) |
| 540 cache->AssociateHost(this); | 540 cache->AssociateHost(this); |
| 541 | 541 |
| 542 FillCacheInfo(cache, manifest_url, GetStatus(), &info); | 542 FillCacheInfo(cache, manifest_url, GetStatus(), &info); |
| 543 frontend_->OnCacheSelected(host_id_, info); | 543 frontend_->OnCacheSelected(host_id_, info); |
| 544 } | 544 } |
| 545 | 545 |
| 546 } // namespace content | 546 } // namespace content |
| OLD | NEW |