Make sure we end the update process if we get an errorfrom the servers. Previously, if we got a 400 (or other)error response, we'd leave the database and transactionopen.BUG=5060 (http://crbug.com/5060)
Review URL: http://codereview.chromium.org/12918

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6337 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 0f43a03..cd2c1be 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -218,6 +218,7 @@
                       << "failed parse.";
         must_back_off = true;
         chunk_request_urls_.clear();
+        sb_service_->UpdateFinished(false);
       }
 
       if (request_type_ == CHUNK_REQUEST && parsed_ok) {
@@ -234,6 +235,7 @@
       must_back_off = true;
       if (request_type_ == CHUNK_REQUEST)
         chunk_request_urls_.clear();
+      sb_service_->UpdateFinished(false);
       SB_DLOG(INFO) << "SafeBrowsing request for: " << source->url()
                     << ", failed with error: " << response_code;
     }
@@ -267,7 +269,6 @@
                               &next_update_sec, &re_key,
                               &reset, chunk_deletes, &chunk_urls)) {
         delete chunk_deletes;
-        sb_service_->UpdateFinished(false);
         return false;
       }
 
@@ -433,7 +434,7 @@
 //              isn't that much overhead. Measure!
 void SafeBrowsingProtocolManager::IssueUpdateRequest() {
   request_type_ = UPDATE_REQUEST;
-  sb_service_->GetAllChunks();
+  sb_service_->UpdateStarted();
 }
 
 void SafeBrowsingProtocolManager::IssueChunkRequest() {