Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: content/browser/appcache/appcache_update_job.cc

Issue 1875913002: Cleanup: Convert const char* kFoo to const char kFoo[]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/appcache/appcache_update_job.h" 5 #include "content/browser/appcache/appcache_update_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 if (update_type_ == UPGRADE_ATTEMPT) 605 if (update_type_ == UPGRADE_ATTEMPT)
606 CheckIfManifestChanged(); // continues asynchronously 606 CheckIfManifestChanged(); // continues asynchronously
607 else 607 else
608 ContinueHandleManifestFetchCompleted(true); 608 ContinueHandleManifestFetchCompleted(true);
609 } else if (response_code == 304 && update_type_ == UPGRADE_ATTEMPT) { 609 } else if (response_code == 304 && update_type_ == UPGRADE_ATTEMPT) {
610 ContinueHandleManifestFetchCompleted(false); 610 ContinueHandleManifestFetchCompleted(false);
611 } else if ((response_code == 404 || response_code == 410) && 611 } else if ((response_code == 404 || response_code == 410) &&
612 update_type_ == UPGRADE_ATTEMPT) { 612 update_type_ == UPGRADE_ATTEMPT) {
613 storage_->MakeGroupObsolete(group_, this, response_code); // async 613 storage_->MakeGroupObsolete(group_, this, response_code); // async
614 } else { 614 } else {
615 const char* kFormatString = "Manifest fetch failed (%d) %s"; 615 const char kFormatString[] = "Manifest fetch failed (%d) %s";
616 std::string message = FormatUrlErrorMessage( 616 std::string message = FormatUrlErrorMessage(
617 kFormatString, manifest_url_, fetcher->result(), response_code); 617 kFormatString, manifest_url_, fetcher->result(), response_code);
618 HandleCacheFailure(AppCacheErrorDetails(message, 618 HandleCacheFailure(AppCacheErrorDetails(message,
619 APPCACHE_MANIFEST_ERROR, 619 APPCACHE_MANIFEST_ERROR,
620 manifest_url_, 620 manifest_url_,
621 response_code, 621 response_code,
622 false /*is_cross_origin*/), 622 false /*is_cross_origin*/),
623 fetcher->result(), 623 fetcher->result(),
624 GURL()); 624 GURL());
625 } 625 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return; 665 return;
666 } 666 }
667 667
668 AppCacheManifest manifest; 668 AppCacheManifest manifest;
669 if (!ParseManifest(manifest_url_, manifest_data_.data(), 669 if (!ParseManifest(manifest_url_, manifest_data_.data(),
670 manifest_data_.length(), 670 manifest_data_.length(),
671 manifest_has_valid_mime_type_ ? 671 manifest_has_valid_mime_type_ ?
672 PARSE_MANIFEST_ALLOWING_INTERCEPTS : 672 PARSE_MANIFEST_ALLOWING_INTERCEPTS :
673 PARSE_MANIFEST_PER_STANDARD, 673 PARSE_MANIFEST_PER_STANDARD,
674 manifest)) { 674 manifest)) {
675 const char* kFormatString = "Failed to parse manifest %s"; 675 const char kFormatString[] = "Failed to parse manifest %s";
676 const std::string message = base::StringPrintf(kFormatString, 676 const std::string message = base::StringPrintf(kFormatString,
677 manifest_url_.spec().c_str()); 677 manifest_url_.spec().c_str());
678 HandleCacheFailure( 678 HandleCacheFailure(
679 AppCacheErrorDetails( 679 AppCacheErrorDetails(
680 message, APPCACHE_SIGNATURE_ERROR, GURL(), 0, 680 message, APPCACHE_SIGNATURE_ERROR, GURL(), 0,
681 false /*is_cross_origin*/), 681 false /*is_cross_origin*/),
682 MANIFEST_ERROR, 682 MANIFEST_ERROR,
683 GURL()); 683 GURL());
684 VLOG(1) << message; 684 VLOG(1) << message;
685 return; 685 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 VLOG(1) << "Request status: " << request->status().status() 754 VLOG(1) << "Request status: " << request->status().status()
755 << " error: " << request->status().error() 755 << " error: " << request->status().error()
756 << " response code: " << response_code; 756 << " response code: " << response_code;
757 if (entry.IsExplicit() || entry.IsFallback() || entry.IsIntercept()) { 757 if (entry.IsExplicit() || entry.IsFallback() || entry.IsIntercept()) {
758 if (response_code == 304 && fetcher->existing_entry().has_response_id()) { 758 if (response_code == 304 && fetcher->existing_entry().has_response_id()) {
759 // Keep the existing response. 759 // Keep the existing response.
760 entry.set_response_id(fetcher->existing_entry().response_id()); 760 entry.set_response_id(fetcher->existing_entry().response_id());
761 entry.set_response_size(fetcher->existing_entry().response_size()); 761 entry.set_response_size(fetcher->existing_entry().response_size());
762 inprogress_cache_->AddOrModifyEntry(url, entry); 762 inprogress_cache_->AddOrModifyEntry(url, entry);
763 } else { 763 } else {
764 const char* kFormatString = "Resource fetch failed (%d) %s"; 764 const char kFormatString[] = "Resource fetch failed (%d) %s";
765 std::string message = FormatUrlErrorMessage( 765 std::string message = FormatUrlErrorMessage(
766 kFormatString, url, fetcher->result(), response_code); 766 kFormatString, url, fetcher->result(), response_code);
767 ResultType result = fetcher->result(); 767 ResultType result = fetcher->result();
768 bool is_cross_origin = url.GetOrigin() != manifest_url_.GetOrigin(); 768 bool is_cross_origin = url.GetOrigin() != manifest_url_.GetOrigin();
769 switch (result) { 769 switch (result) {
770 case DISKCACHE_ERROR: 770 case DISKCACHE_ERROR:
771 HandleCacheFailure( 771 HandleCacheFailure(
772 AppCacheErrorDetails( 772 AppCacheErrorDetails(
773 message, APPCACHE_UNKNOWN_ERROR, GURL(), 0, 773 message, APPCACHE_UNKNOWN_ERROR, GURL(), 0,
774 is_cross_origin), 774 is_cross_origin),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 // In downloading case, disassociate host from inprogress cache. 868 // In downloading case, disassociate host from inprogress cache.
869 if (inprogress_cache_.get()) 869 if (inprogress_cache_.get())
870 host->AssociateNoCache(GURL()); 870 host->AssociateNoCache(GURL());
871 871
872 host->RemoveObserver(this); 872 host->RemoveObserver(this);
873 } 873 }
874 hosts.clear(); 874 hosts.clear();
875 875
876 failed_master_entries_.insert(url); 876 failed_master_entries_.insert(url);
877 877
878 const char* kFormatString = "Manifest fetch failed (%d) %s"; 878 const char kFormatString[] = "Manifest fetch failed (%d) %s";
879 std::string message = FormatUrlErrorMessage( 879 std::string message = FormatUrlErrorMessage(
880 kFormatString, request->url(), fetcher->result(), response_code); 880 kFormatString, request->url(), fetcher->result(), response_code);
881 host_notifier.SendErrorNotifications( 881 host_notifier.SendErrorNotifications(
882 AppCacheErrorDetails(message, 882 AppCacheErrorDetails(message,
883 APPCACHE_MANIFEST_ERROR, 883 APPCACHE_MANIFEST_ERROR,
884 request->url(), 884 request->url(),
885 response_code, 885 response_code,
886 false /*is_cross_origin*/)); 886 false /*is_cross_origin*/));
887 887
888 // In downloading case, update result is different if all master entries 888 // In downloading case, update result is different if all master entries
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 ScheduleUpdateRetry(kRerunDelayMs); 943 ScheduleUpdateRetry(kRerunDelayMs);
944 if (response_code == 200) { 944 if (response_code == 200) {
945 HandleCacheFailure(AppCacheErrorDetails("Manifest changed during update", 945 HandleCacheFailure(AppCacheErrorDetails("Manifest changed during update",
946 APPCACHE_CHANGED_ERROR, 946 APPCACHE_CHANGED_ERROR,
947 GURL(), 947 GURL(),
948 0, 948 0,
949 false /*is_cross_origin*/), 949 false /*is_cross_origin*/),
950 MANIFEST_ERROR, 950 MANIFEST_ERROR,
951 GURL()); 951 GURL());
952 } else { 952 } else {
953 const char* kFormatString = "Manifest re-fetch failed (%d) %s"; 953 const char kFormatString[] = "Manifest re-fetch failed (%d) %s";
954 std::string message = FormatUrlErrorMessage( 954 std::string message = FormatUrlErrorMessage(
955 kFormatString, manifest_url_, fetcher->result(), response_code); 955 kFormatString, manifest_url_, fetcher->result(), response_code);
956 HandleCacheFailure(AppCacheErrorDetails(message, 956 HandleCacheFailure(AppCacheErrorDetails(message,
957 APPCACHE_MANIFEST_ERROR, 957 APPCACHE_MANIFEST_ERROR,
958 GURL(), 958 GURL(),
959 response_code, 959 response_code,
960 false /*is_cross_origin*/), 960 false /*is_cross_origin*/),
961 fetcher->result(), 961 fetcher->result(),
962 GURL()); 962 GURL());
963 } 963 }
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 // on this object after we've posted a task to delete ourselves. 1711 // on this object after we've posted a task to delete ourselves.
1712 if (group_) { 1712 if (group_) {
1713 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); 1713 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE);
1714 group_ = NULL; 1714 group_ = NULL;
1715 } 1715 }
1716 1716
1717 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1717 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1718 } 1718 }
1719 1719
1720 } // namespace content 1720 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_database.cc ('k') | content/browser/browser_child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698