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

Unified Diff: chrome/browser/component_updater/component_updater_ping_manager.cc

Issue 334783002: Componentize component_updater: Move some paths/constants to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge origin/master Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/component_updater_ping_manager.cc
diff --git a/chrome/browser/component_updater/component_updater_ping_manager.cc b/chrome/browser/component_updater/component_updater_ping_manager.cc
index cf284acbee1d9fe307f37a2ae5f9fad7f3dabee2..1a1840e52cd9976b4b492f7d985738133f443887 100644
--- a/chrome/browser/component_updater/component_updater_ping_manager.cc
+++ b/chrome/browser/component_updater/component_updater_ping_manager.cc
@@ -38,7 +38,9 @@ class PingSender : public net::URLFetcherDelegate {
public:
PingSender();
- void SendPing(const GURL& ping_url,
+ void SendPing(const std::string& application_version,
+ const std::string& platform_name,
+ const GURL& ping_url,
net::URLRequestContextGetter* url_request_context_getter,
const CrxUpdateItem* item);
@@ -48,7 +50,9 @@ class PingSender : public net::URLFetcherDelegate {
// Overrides for URLFetcherDelegate.
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
- static std::string BuildPing(const CrxUpdateItem* item);
+ static std::string BuildPing(const std::string& application_version,
+ const std::string& platform_name,
+ const CrxUpdateItem* item);
static std::string BuildDownloadCompleteEventElements(
const CrxUpdateItem* item);
static std::string BuildUpdateCompleteEventElement(const CrxUpdateItem* item);
@@ -69,6 +73,8 @@ void PingSender::OnURLFetchComplete(const net::URLFetcher* source) {
}
void PingSender::SendPing(
+ const std::string& application_version,
+ const std::string& platform_name,
const GURL& ping_url,
net::URLRequestContextGetter* url_request_context_getter,
const CrxUpdateItem* item) {
@@ -77,12 +83,17 @@ void PingSender::SendPing(
if (!ping_url.is_valid())
return;
- url_fetcher_.reset(SendProtocolRequest(
- ping_url, BuildPing(item), this, url_request_context_getter));
+ url_fetcher_.reset(
+ SendProtocolRequest(ping_url,
+ BuildPing(application_version, platform_name, item),
+ this,
+ url_request_context_getter));
}
// Builds a ping message for the specified update item.
-std::string PingSender::BuildPing(const CrxUpdateItem* item) {
+std::string PingSender::BuildPing(const std::string& application_version,
+ const std::string& platform_name,
+ const CrxUpdateItem* item) {
const char app_element_format[] =
"<app appid=\"%s\" version=\"%s\" nextversion=\"%s\">"
"%s"
@@ -96,7 +107,8 @@ std::string PingSender::BuildPing(const CrxUpdateItem* item) {
BuildUpdateCompleteEventElement(item).c_str(), // update event
BuildDownloadCompleteEventElements(item).c_str())); // download events
- return BuildProtocolRequest(app_element, "");
+ return BuildProtocolRequest(
+ application_version, platform_name, app_element, "");
Sorin Jianu 2014/06/19 00:48:22 It looks to me that the additional member variable
}
// Returns a string representing a sequence of download complete events
@@ -179,9 +191,13 @@ std::string PingSender::BuildUpdateCompleteEventElement(
}
PingManager::PingManager(
+ const std::string& application_version,
+ const std::string& platform_name,
const GURL& ping_url,
net::URLRequestContextGetter* url_request_context_getter)
- : ping_url_(ping_url),
+ : application_version_(application_version),
+ platform_name_(platform_name),
+ ping_url_(ping_url),
url_request_context_getter_(url_request_context_getter) {
}
@@ -192,7 +208,11 @@ PingManager::~PingManager() {
// sender object self-deletes after sending the ping.
void PingManager::OnUpdateComplete(const CrxUpdateItem* item) {
PingSender* ping_sender(new PingSender);
- ping_sender->SendPing(ping_url_, url_request_context_getter_, item);
+ ping_sender->SendPing(application_version_,
+ platform_name_,
+ ping_url_,
+ url_request_context_getter_,
+ item);
}
} // namespace component_updater

Powered by Google App Engine
This is Rietveld 408576698