| 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 "components/update_client/update_checker.h" | 5 #include "components/update_client/update_checker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // Builds an update check request for |components|. |additional_attributes| is | 58 // Builds an update check request for |components|. |additional_attributes| is |
| 59 // serialized as part of the <request> element of the request to customize it | 59 // serialized as part of the <request> element of the request to customize it |
| 60 // with data that is not platform or component specific. For each |item|, a | 60 // with data that is not platform or component specific. For each |item|, a |
| 61 // corresponding <app> element is created and inserted as a child node of | 61 // corresponding <app> element is created and inserted as a child node of |
| 62 // the <request>. | 62 // the <request>. |
| 63 // | 63 // |
| 64 // An app element looks like this: | 64 // An app element looks like this: |
| 65 // <app appid="hnimpnehoodheedghdeeijklkeaacbdc" | 65 // <app appid="hnimpnehoodheedghdeeijklkeaacbdc" |
| 66 // version="0.1.2.3" installsource="ondemand"> | 66 // version="0.1.2.3" installsource="ondemand"> |
| 67 // <updatecheck /> | 67 // <updatecheck/> |
| 68 // <packages> | 68 // <packages> |
| 69 // <package fp="abcd" /> | 69 // <package fp="abcd"/> |
| 70 // </packages> | 70 // </packages> |
| 71 // </app> | 71 // </app> |
| 72 std::string BuildUpdateCheckRequest(const Configurator& config, | 72 std::string BuildUpdateCheckRequest(const Configurator& config, |
| 73 const std::vector<CrxUpdateItem*>& items, | 73 const std::vector<CrxUpdateItem*>& items, |
| 74 PersistedData* metadata, | 74 PersistedData* metadata, |
| 75 const std::string& additional_attributes, | 75 const std::string& additional_attributes, |
| 76 bool enabled_component_updates) { | 76 bool enabled_component_updates) { |
| 77 const std::string brand(SanitizeBrand(config.GetBrand())); | 77 const std::string brand(SanitizeBrand(config.GetBrand())); |
| 78 std::string app_elements; | 78 std::string app_elements; |
| 79 for (size_t i = 0; i != items.size(); ++i) { | 79 for (size_t i = 0; i != items.size(); ++i) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 102 base::StringAppendF(&app, " cohorthint=\"%s\"", cohort_hint.c_str()); | 102 base::StringAppendF(&app, " cohorthint=\"%s\"", cohort_hint.c_str()); |
| 103 base::StringAppendF(&app, ">"); | 103 base::StringAppendF(&app, ">"); |
| 104 | 104 |
| 105 base::StringAppendF(&app, "<updatecheck"); | 105 base::StringAppendF(&app, "<updatecheck"); |
| 106 if (item->component.supports_group_policy_enable_component_updates && | 106 if (item->component.supports_group_policy_enable_component_updates && |
| 107 !enabled_component_updates) { | 107 !enabled_component_updates) { |
| 108 base::StringAppendF(&app, " updatedisabled=\"true\""); | 108 base::StringAppendF(&app, " updatedisabled=\"true\""); |
| 109 } | 109 } |
| 110 base::StringAppendF(&app, "/>"); | 110 base::StringAppendF(&app, "/>"); |
| 111 | 111 |
| 112 base::StringAppendF(&app, "<ping rd=\"%d\" ping_freshness=\"%s\" />", | 112 base::StringAppendF(&app, "<ping rd=\"%d\" ping_freshness=\"%s\"/>", |
| 113 metadata->GetDateLastRollCall(item->id), | 113 metadata->GetDateLastRollCall(item->id), |
| 114 metadata->GetPingFreshness(item->id).c_str()); | 114 metadata->GetPingFreshness(item->id).c_str()); |
| 115 if (!item->component.fingerprint.empty()) { | 115 if (!item->component.fingerprint.empty()) { |
| 116 base::StringAppendF(&app, | 116 base::StringAppendF(&app, |
| 117 "<packages>" | 117 "<packages>" |
| 118 "<package fp=\"%s\"/>" | 118 "<package fp=\"%s\"/>" |
| 119 "</packages>", | 119 "</packages>", |
| 120 item->component.fingerprint.c_str()); | 120 item->component.fingerprint.c_str()); |
| 121 } | 121 } |
| 122 base::StringAppendF(&app, "</app>"); | 122 base::StringAppendF(&app, "</app>"); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } // namespace | 241 } // namespace |
| 242 | 242 |
| 243 std::unique_ptr<UpdateChecker> UpdateChecker::Create( | 243 std::unique_ptr<UpdateChecker> UpdateChecker::Create( |
| 244 const scoped_refptr<Configurator>& config, | 244 const scoped_refptr<Configurator>& config, |
| 245 PersistedData* persistent) { | 245 PersistedData* persistent) { |
| 246 return std::unique_ptr<UpdateChecker>( | 246 return std::unique_ptr<UpdateChecker>( |
| 247 new UpdateCheckerImpl(config, persistent)); | 247 new UpdateCheckerImpl(config, persistent)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace update_client | 250 } // namespace update_client |
| OLD | NEW |