| 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 #ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_ |
| 6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "components/update_client/update_client.h" | 14 #include "components/update_client/update_client.h" |
| 15 #include "components/update_client/updater_state.h" |
| 15 | 16 |
| 16 class GURL; | 17 class GURL; |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class DictionaryValue; | 20 class DictionaryValue; |
| 20 class FilePath; | 21 class FilePath; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 class URLFetcher; | 25 class URLFetcher; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 // <os platform="win" version="6.1" arch="x86"/> | 52 // <os platform="win" version="6.1" arch="x86"/> |
| 52 // ... REQUEST BODY ... | 53 // ... REQUEST BODY ... |
| 53 // </request> | 54 // </request> |
| 54 | 55 |
| 55 // Builds a protocol request string by creating the outer envelope for | 56 // Builds a protocol request string by creating the outer envelope for |
| 56 // the request and including the request body specified as a parameter. | 57 // the request and including the request body specified as a parameter. |
| 57 // If present, the |download_preference| specifies a group policy that | 58 // If present, the |download_preference| specifies a group policy that |
| 58 // affects the list of download URLs returned in the update response. | 59 // affects the list of download URLs returned in the update response. |
| 59 // If specified, |additional_attributes| are appended as attributes of the | 60 // If specified, |additional_attributes| are appended as attributes of the |
| 60 // request element. The additional attributes have to be well-formed for | 61 // request element. The additional attributes have to be well-formed for |
| 61 // insertion in the request element. | 62 // insertion in the request element. |updater_state_attributes| is an optional |
| 62 std::string BuildProtocolRequest(const std::string& prod_id, | 63 // parameter specifying that an <updater> element is serialized as part of |
| 63 const std::string& browser_version, | 64 // the request. |
| 64 const std::string& channel, | 65 std::string BuildProtocolRequest( |
| 65 const std::string& lang, | 66 const std::string& prod_id, |
| 66 const std::string& os_long_name, | 67 const std::string& browser_version, |
| 67 const std::string& download_preference, | 68 const std::string& channel, |
| 68 const std::string& request_body, | 69 const std::string& lang, |
| 69 const std::string& additional_attributes); | 70 const std::string& os_long_name, |
| 71 const std::string& download_preference, |
| 72 const std::string& request_body, |
| 73 const std::string& additional_attributes, |
| 74 const std::unique_ptr<UpdaterState::Attributes>& updater_state_attributes); |
| 70 | 75 |
| 71 // Sends a protocol request to the the service endpoint specified by |url|. | 76 // Sends a protocol request to the the service endpoint specified by |url|. |
| 72 // The body of the request is provided by |protocol_request| and it is | 77 // The body of the request is provided by |protocol_request| and it is |
| 73 // expected to contain XML data. The caller owns the returned object. | 78 // expected to contain XML data. The caller owns the returned object. |
| 74 std::unique_ptr<net::URLFetcher> SendProtocolRequest( | 79 std::unique_ptr<net::URLFetcher> SendProtocolRequest( |
| 75 const GURL& url, | 80 const GURL& url, |
| 76 const std::string& protocol_request, | 81 const std::string& protocol_request, |
| 77 net::URLFetcherDelegate* url_fetcher_delegate, | 82 net::URLFetcherDelegate* url_fetcher_delegate, |
| 78 net::URLRequestContextGetter* url_request_context_getter); | 83 net::URLRequestContextGetter* url_request_context_getter); |
| 79 | 84 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Removes the unsecure urls in the |urls| parameter. | 122 // Removes the unsecure urls in the |urls| parameter. |
| 118 void RemoveUnsecureUrls(std::vector<GURL>* urls); | 123 void RemoveUnsecureUrls(std::vector<GURL>* urls); |
| 119 | 124 |
| 120 // Adapter function for the old definitions of CrxInstaller::Install until the | 125 // Adapter function for the old definitions of CrxInstaller::Install until the |
| 121 // component installer code is migrated to use a REsult instead of bool. | 126 // component installer code is migrated to use a REsult instead of bool. |
| 122 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback); | 127 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback); |
| 123 | 128 |
| 124 } // namespace update_client | 129 } // namespace update_client |
| 125 | 130 |
| 126 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_ | 131 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_ |
| OLD | NEW |