| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/component_updater_ping_manager.h" | 5 #include "chrome/browser/component_updater/component_updater_ping_manager.h" |
| 6 #include "base/guid.h" | 6 #include "base/guid.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 "<app appid=\"%s\" version=\"%s\" nextversion=\"%s\">" | 76 "<app appid=\"%s\" version=\"%s\" nextversion=\"%s\">" |
| 77 "%s" | 77 "%s" |
| 78 "</app>"; | 78 "</app>"; |
| 79 const std::string app_element(base::StringPrintf( | 79 const std::string app_element(base::StringPrintf( |
| 80 app_element_format, | 80 app_element_format, |
| 81 item->id.c_str(), // "appid" | 81 item->id.c_str(), // "appid" |
| 82 item->previous_version.GetString().c_str(), // "version" | 82 item->previous_version.GetString().c_str(), // "version" |
| 83 item->next_version.GetString().c_str(), // "nextversion" | 83 item->next_version.GetString().c_str(), // "nextversion" |
| 84 BuildPingEventElement(item).c_str())); | 84 BuildPingEventElement(item).c_str())); |
| 85 | 85 |
| 86 return BuildProtocolRequest(app_element); | 86 return BuildProtocolRequest(app_element, ""); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Returns a string representing one ping event xml element for an update item. | 89 // Returns a string representing one ping event xml element for an update item. |
| 90 std::string PingSender::BuildPingEventElement(const CrxUpdateItem* item) { | 90 std::string PingSender::BuildPingEventElement(const CrxUpdateItem* item) { |
| 91 DCHECK(item->status == CrxUpdateItem::kNoUpdate || | 91 DCHECK(item->status == CrxUpdateItem::kNoUpdate || |
| 92 item->status == CrxUpdateItem::kUpdated); | 92 item->status == CrxUpdateItem::kUpdated); |
| 93 | 93 |
| 94 using base::StringAppendF; | 94 using base::StringAppendF; |
| 95 | 95 |
| 96 std::string ping_event("<event eventtype=\"3\""); | 96 std::string ping_event("<event eventtype=\"3\""); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Sends a fire and forget ping when the updates are complete. The ping | 136 // Sends a fire and forget ping when the updates are complete. The ping |
| 137 // sender object self-deletes after sending the ping. | 137 // sender object self-deletes after sending the ping. |
| 138 void PingManager::OnUpdateComplete(const CrxUpdateItem* item) { | 138 void PingManager::OnUpdateComplete(const CrxUpdateItem* item) { |
| 139 component_updater::PingSender* ping_sender(new PingSender); | 139 component_updater::PingSender* ping_sender(new PingSender); |
| 140 ping_sender->SendPing(ping_url_, url_request_context_getter_, item); | 140 ping_sender->SendPing(ping_url_, url_request_context_getter_, item); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace component_updater | 143 } // namespace component_updater |
| 144 | 144 |
| OLD | NEW |