| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/component_updater/update_checker.h" | 5 #include "chrome/browser/component_updater/update_checker.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/component_updater/component_updater_utils.h" | 9 #include "chrome/browser/component_updater/component_updater_utils.h" |
| 10 #include "chrome/browser/component_updater/crx_update_item.h" | 10 #include "chrome/browser/component_updater/crx_update_item.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void UpdateCheckerImpl::OnURLFetchComplete(const net::URLFetcher* source) { | 129 void UpdateCheckerImpl::OnURLFetchComplete(const net::URLFetcher* source) { |
| 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 131 DCHECK(url_fetcher_.get() == source); | 131 DCHECK(url_fetcher_.get() == source); |
| 132 | 132 |
| 133 int error = 0; | 133 int error = 0; |
| 134 std::string error_message; | 134 std::string error_message; |
| 135 component_updater::UpdateResponse update_response; | 135 UpdateResponse update_response; |
| 136 | 136 |
| 137 if (component_updater::FetchSuccess(*source)) { | 137 if (FetchSuccess(*source)) { |
| 138 std::string xml; | 138 std::string xml; |
| 139 source->GetResponseAsString(&xml); | 139 source->GetResponseAsString(&xml); |
| 140 if (!update_response.Parse(xml)) { | 140 if (!update_response.Parse(xml)) { |
| 141 error = -1; | 141 error = -1; |
| 142 error_message = update_response.errors(); | 142 error_message = update_response.errors(); |
| 143 } | 143 } |
| 144 } else { | 144 } else { |
| 145 error = component_updater::GetFetchError(*source); | 145 error = GetFetchError(*source); |
| 146 error_message.assign("network error"); | 146 error_message.assign("network error"); |
| 147 } | 147 } |
| 148 | 148 |
| 149 url_fetcher_.reset(); | 149 url_fetcher_.reset(); |
| 150 update_check_callback_.Run(error, error_message, update_response.results()); | 150 update_check_callback_.Run(error, error_message, update_response.results()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace component_updater | 153 } // namespace component_updater |
| 154 | 154 |
| OLD | NEW |