| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/update_client/action_update_check.h" | 5 #include "components/update_client/action_update_check.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ignore_result(item.release()); | 89 ignore_result(item.release()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 update_checker_->CheckForUpdates( | 92 update_checker_->CheckForUpdates( |
| 93 update_context_->update_items, extra_request_parameters_, | 93 update_context_->update_items, extra_request_parameters_, |
| 94 base::Bind(&ActionUpdateCheck::UpdateCheckComplete, | 94 base::Bind(&ActionUpdateCheck::UpdateCheckComplete, |
| 95 base::Unretained(this))); | 95 base::Unretained(this))); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void ActionUpdateCheck::UpdateCheckComplete( | 98 void ActionUpdateCheck::UpdateCheckComplete( |
| 99 const GURL& original_url, | |
| 100 int error, | 99 int error, |
| 101 const std::string& error_message, | |
| 102 const UpdateResponse::Results& results) { | 100 const UpdateResponse::Results& results) { |
| 103 DCHECK(thread_checker_.CalledOnValidThread()); | 101 DCHECK(thread_checker_.CalledOnValidThread()); |
| 104 | 102 |
| 105 VLOG(1) << "Update check completed from: " << original_url.spec(); | |
| 106 | |
| 107 if (!error) | 103 if (!error) |
| 108 OnUpdateCheckSucceeded(results); | 104 OnUpdateCheckSucceeded(results); |
| 109 else | 105 else |
| 110 OnUpdateCheckFailed(error, error_message); | 106 OnUpdateCheckFailed(error); |
| 111 } | 107 } |
| 112 | 108 |
| 113 void ActionUpdateCheck::OnUpdateCheckSucceeded( | 109 void ActionUpdateCheck::OnUpdateCheckSucceeded( |
| 114 const UpdateResponse::Results& results) { | 110 const UpdateResponse::Results& results) { |
| 115 DCHECK(thread_checker_.CalledOnValidThread()); | 111 DCHECK(thread_checker_.CalledOnValidThread()); |
| 116 VLOG(1) << "Update check succeeded."; | 112 VLOG(1) << "Update check succeeded."; |
| 117 std::vector<UpdateResponse::Result>::const_iterator it; | 113 std::vector<UpdateResponse::Result>::const_iterator it; |
| 118 for (it = results.list.begin(); it != results.list.end(); ++it) { | 114 for (it = results.list.begin(); it != results.list.end(); ++it) { |
| 119 CrxUpdateItem* crx = FindUpdateItemById(it->extension_id); | 115 CrxUpdateItem* crx = FindUpdateItemById(it->extension_id); |
| 120 if (!crx) | 116 if (!crx) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (update_context_->queue.empty()) { | 187 if (update_context_->queue.empty()) { |
| 192 VLOG(1) << "Update check completed but no update is needed."; | 188 VLOG(1) << "Update check completed but no update is needed."; |
| 193 UpdateComplete(0); | 189 UpdateComplete(0); |
| 194 return; | 190 return; |
| 195 } | 191 } |
| 196 | 192 |
| 197 // Starts the execution flow of updating the CRXs in this context. | 193 // Starts the execution flow of updating the CRXs in this context. |
| 198 UpdateCrx(); | 194 UpdateCrx(); |
| 199 } | 195 } |
| 200 | 196 |
| 201 void ActionUpdateCheck::OnUpdateCheckFailed(int error, | 197 void ActionUpdateCheck::OnUpdateCheckFailed(int error) { |
| 202 const std::string& error_message) { | |
| 203 DCHECK(thread_checker_.CalledOnValidThread()); | 198 DCHECK(thread_checker_.CalledOnValidThread()); |
| 204 DCHECK(error); | 199 DCHECK(error); |
| 205 | 200 |
| 206 VLOG(1) << "Update check failed." << error; | 201 VLOG(1) << "Update check failed." << error; |
| 207 | 202 |
| 208 ChangeAllItemsState(CrxUpdateItem::State::kChecking, | 203 ChangeAllItemsState(CrxUpdateItem::State::kChecking, |
| 209 CrxUpdateItem::State::kNoUpdate); | 204 CrxUpdateItem::State::kNoUpdate); |
| 210 | 205 |
| 211 UpdateComplete(error); | 206 UpdateComplete(error); |
| 212 } | 207 } |
| 213 | 208 |
| 214 } // namespace update_client | 209 } // namespace update_client |
| OLD | NEW |