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

Unified Diff: extensions/browser/updater/manifest_fetch_data.cc

Issue 465543004: Factor Chrome details out of update manifest fetching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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: extensions/browser/updater/manifest_fetch_data.cc
diff --git a/chrome/browser/extensions/updater/manifest_fetch_data.cc b/extensions/browser/updater/manifest_fetch_data.cc
similarity index 83%
rename from chrome/browser/extensions/updater/manifest_fetch_data.cc
rename to extensions/browser/updater/manifest_fetch_data.cc
index 4190cbf2b867c8af7f0ecd5c8b094a31530e0c09..afbf4cf30348c4db4e8e08b7c78ce687185d82d6 100644
--- a/chrome/browser/extensions/updater/manifest_fetch_data.cc
+++ b/extensions/browser/updater/manifest_fetch_data.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/updater/manifest_fetch_data.h"
+#include "extensions/browser/updater/manifest_fetch_data.h"
#include <vector>
@@ -10,9 +10,7 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
-#include "chrome/browser/google/google_brand.h"
-#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
-#include "components/omaha_query_params/omaha_query_params.h"
+#include "base/strings/stringprintf.h"
#include "net/base/escape.h"
namespace {
@@ -25,13 +23,18 @@ const int kExtensionsManifestMaxURLSize = 2000;
namespace extensions {
-ManifestFetchData::ManifestFetchData(const GURL& update_url, int request_id)
+ManifestFetchData::ManifestFetchData(const GURL& update_url,
+ int request_id,
+ const std::string& brand_code,
+ const std::string& base_query_params,
+ PingMode ping_mode)
: base_url_(update_url),
- full_url_(update_url) {
- std::string query = full_url_.has_query() ?
- full_url_.query() + "&" : std::string();
- query += omaha_query_params::OmahaQueryParams::Get(
- omaha_query_params::OmahaQueryParams::CRX);
+ full_url_(update_url),
+ brand_code_(brand_code),
+ ping_mode_(ping_mode) {
+ std::string query =
+ full_url_.has_query() ? full_url_.query() + "&" : std::string();
+ query += base_query_params;
GURL::Replacements replacements;
replacements.SetQueryStr(query);
full_url_ = full_url_.ReplaceComponents(replacements);
@@ -39,7 +42,8 @@ ManifestFetchData::ManifestFetchData(const GURL& update_url, int request_id)
request_ids_.insert(request_id);
}
-ManifestFetchData::~ManifestFetchData() {}
+ManifestFetchData::~ManifestFetchData() {
+}
// The format for request parameters in update checks is:
//
@@ -49,7 +53,7 @@ ManifestFetchData::~ManifestFetchData() {}
//
// id=EXTENSION_ID&v=VERSION&uc
//
-// Additionally, we may include the parameter ping=PING_DATA where PING_DATA
+// Provide ping data with the parameter ping=PING_DATA where PING_DATA
// looks like r=DAYS or a=DAYS for extensions in the Chrome extensions gallery.
// ('r' refers to 'roll call' ie installation, and 'a' refers to 'active').
// These values will each be present at most once every 24 hours, and indicate
@@ -89,22 +93,17 @@ bool ManifestFetchData::AddExtension(const std::string& id,
}
// Append brand code, rollcall and active ping parameters.
- if (base_url_.DomainIs("google.com")) {
-#if defined(GOOGLE_CHROME_BUILD)
- std::string brand;
- google_brand::GetBrand(&brand);
- if (!brand.empty() && !google_brand::IsOrganic(brand))
- parts.push_back("brand=" + brand);
-#endif
+ if (ping_mode_ >= PING) {
not at google - send to devlin 2014/08/13 01:30:02 Since when did PingMode define an ordering? Either
+ if (!brand_code_.empty())
+ parts.push_back(base::StringPrintf("brand=%s", brand_code_.c_str()));
std::string ping_value;
pings_[id] = PingData(0, 0, false);
-
if (ping_data) {
if (ping_data->rollcall_days == kNeverPinged ||
ping_data->rollcall_days > 0) {
ping_value += "r=" + base::IntToString(ping_data->rollcall_days);
- if (ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()) {
+ if (ping_mode_ == PING_WITH_METRICS) {
ping_value += "&e=" + std::string(ping_data->is_enabled ? "1" : "0");
}
pings_[id].rollcall_days = ping_data->rollcall_days;

Powered by Google App Engine
This is Rietveld 408576698