Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: components/update_client/ping_manager.cc

Issue 2498873003: Refactor how the updater state data is serialized in update checks. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/update_client/configurator.h ('k') | components/update_client/update_checker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ping_manager.h" 5 #include "components/update_client/ping_manager.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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/sequenced_task_runner.h" 19 #include "base/sequenced_task_runner.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/threading/thread_checker.h" 23 #include "base/threading/thread_checker.h"
24 #include "components/update_client/configurator.h" 24 #include "components/update_client/configurator.h"
25 #include "components/update_client/crx_update_item.h" 25 #include "components/update_client/crx_update_item.h"
26 #include "components/update_client/request_sender.h" 26 #include "components/update_client/request_sender.h"
27 #include "components/update_client/updater_state.h"
27 #include "components/update_client/utils.h" 28 #include "components/update_client/utils.h"
28 #include "net/url_request/url_fetcher.h" 29 #include "net/url_request/url_fetcher.h"
29 #include "url/gurl.h" 30 #include "url/gurl.h"
30 31
31 namespace update_client { 32 namespace update_client {
32 33
33 namespace { 34 namespace {
34 35
35 // Returns a string literal corresponding to the value of the downloader |d|. 36 // Returns a string literal corresponding to the value of the downloader |d|.
36 const char* DownloaderToString(CrxDownloader::DownloadMetrics::Downloader d) { 37 const char* DownloaderToString(CrxDownloader::DownloadMetrics::Downloader d) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 156 }
156 157
157 const std::string app_element(base::StringPrintf( 158 const std::string app_element(base::StringPrintf(
158 app_element_format, 159 app_element_format,
159 item->id.c_str(), // "appid" 160 item->id.c_str(), // "appid"
160 item->previous_version.GetString().c_str(), // "version" 161 item->previous_version.GetString().c_str(), // "version"
161 item->next_version.GetString().c_str(), // "nextversion" 162 item->next_version.GetString().c_str(), // "nextversion"
162 ping_event.c_str(), // ping event 163 ping_event.c_str(), // ping event
163 BuildDownloadCompleteEventElements(item).c_str())); // download events 164 BuildDownloadCompleteEventElements(item).c_str())); // download events
164 165
166 // The ping request does not include any updater state.
165 return BuildProtocolRequest( 167 return BuildProtocolRequest(
166 config.GetProdId(), config.GetBrowserVersion().GetString(), 168 config.GetProdId(), config.GetBrowserVersion().GetString(),
167 config.GetChannel(), config.GetLang(), config.GetOSLongName(), 169 config.GetChannel(), config.GetLang(), config.GetOSLongName(),
168 config.GetDownloadPreference(), app_element, ""); 170 config.GetDownloadPreference(), app_element, "", nullptr);
169 } 171 }
170 172
171 // Sends a fire and forget ping. The instances of this class have no 173 // Sends a fire and forget ping. The instances of this class have no
172 // ownership and they self-delete upon completion. One instance of this class 174 // ownership and they self-delete upon completion. One instance of this class
173 // can send only one ping. 175 // can send only one ping.
174 class PingSender { 176 class PingSender {
175 public: 177 public:
176 explicit PingSender(const scoped_refptr<Configurator>& config); 178 explicit PingSender(const scoped_refptr<Configurator>& config);
177 ~PingSender(); 179 ~PingSender();
178 180
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 std::unique_ptr<PingSender> ping_sender(new PingSender(config_)); 236 std::unique_ptr<PingSender> ping_sender(new PingSender(config_));
235 if (!ping_sender->SendPing(item)) 237 if (!ping_sender->SendPing(item))
236 return false; 238 return false;
237 239
238 // The ping sender object self-deletes after sending the ping asynchrously. 240 // The ping sender object self-deletes after sending the ping asynchrously.
239 ping_sender.release(); 241 ping_sender.release();
240 return true; 242 return true;
241 } 243 }
242 244
243 } // namespace update_client 245 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/configurator.h ('k') | components/update_client/update_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698