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

Unified Diff: chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.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: chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.cc
diff --git a/chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.cc b/chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..04d46e55168fa7abe78d8165792ae4a68b793558
--- /dev/null
+++ b/chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.cc
@@ -0,0 +1,65 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/strings/string_number_conversions.h"
+#include "chrome/browser/extensions/updater/chrome_manifest_fetch_data_delegate.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"
+
+using extensions::ManifestFetchData;
+
+ChromeManifestFetchDataDelegate::ChromeManifestFetchDataDelegate() {
+}
+
+ChromeManifestFetchDataDelegate::~ChromeManifestFetchDataDelegate() {
+}
+
+std::string ChromeManifestFetchDataDelegate::GetBaseQueryParams() {
+ return omaha_query_params::OmahaQueryParams::Get(
+ omaha_query_params::OmahaQueryParams::CRX);
+}
+
+bool ChromeManifestFetchDataDelegate::ShouldAlwaysCheckWebstore() {
+ return ChromeMetricsServiceAccessor::IsMetricsReportingEnabled();
+}
+
+std::string ChromeManifestFetchDataDelegate::GetBrandCode() {
+#if defined(GOOGLE_CHROME_BUILD)
+ std::string brand;
+ google_brand::GetBrand(&brand);
+ if (!brand.empty() && !google_brand::IsOrganic(brand))
+ return brand;
+#endif
+ return "";
+}
+
+// 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
+// the number of days since the last time it was present in an update check.
+std::string ChromeManifestFetchDataDelegate::GetPingParamsAndData(
+ const std::string& extension_id,
+ const ManifestFetchData::PingData& old_ping_data,
+ ManifestFetchData::PingData* new_ping_data) {
+ std::string ping_value;
+ if (old_ping_data.rollcall_days == ManifestFetchData::kNeverPinged ||
+ old_ping_data.rollcall_days > 0) {
+ ping_value += "r=" + base::IntToString(old_ping_data.rollcall_days);
+ if (ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()) {
+ ping_value += "&e=" + std::string(old_ping_data.is_enabled ? "1" : "0");
+ }
+ new_ping_data->rollcall_days = old_ping_data.rollcall_days;
+ new_ping_data->is_enabled = old_ping_data.is_enabled;
+ }
+ if (old_ping_data.active_days == ManifestFetchData::kNeverPinged ||
+ old_ping_data.active_days > 0) {
+ if (!ping_value.empty())
+ ping_value += "&";
+ ping_value += "a=" + base::IntToString(old_ping_data.active_days);
+ new_ping_data->active_days = old_ping_data.active_days;
+ }
+ return ping_value;
+}

Powered by Google App Engine
This is Rietveld 408576698