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

Unified Diff: chrome/common/omaha_query_params.cc

Issue 12396002: Add chrome version information to extension update checks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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
« chrome/common/omaha_query_params.h ('K') | « chrome/common/omaha_query_params.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/omaha_query_params.cc
diff --git a/chrome/common/omaha_query_params.cc b/chrome/common/omaha_query_params.cc
new file mode 100644
index 0000000000000000000000000000000000000000..76b1fb8dc1dd1353d4a449a87c470af54d5b3121
--- /dev/null
+++ b/chrome/common/omaha_query_params.cc
@@ -0,0 +1,80 @@
+// Copyright (c) 2012 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 "chrome/common/omaha_query_params.h"
+
+#include "base/stringprintf.h"
+#include "chrome/common/chrome_version_info.h"
+
+namespace {
+
+const char kStable[] = "stable";
+const char kBeta[] = "beta";
+const char kDev[] = "dev";
+const char kCanary[] = "canary";
+const char kUnknown[] = "unknown";
+
+const char* GetChannelString() {
+ switch (chrome::VersionInfo::GetChannel()) {
+ case chrome::VersionInfo::CHANNEL_STABLE:
+ return kStable;
+ break;
+ case chrome::VersionInfo::CHANNEL_BETA:
+ return kBeta;
+ break;
+ case chrome::VersionInfo::CHANNEL_DEV:
+ return kDev;
+ break;
+ case chrome::VersionInfo::CHANNEL_CANARY:
+ return kCanary;
+ break;
+ default:
+ return kUnknown;
+ }
+}
+
+// The request extra information is the OS and architecture, this helps
+// the server select the right package to be delivered.
+const char kOs[] =
+#if defined(OS_MACOSX)
+ "mac";
+#elif defined(OS_WIN)
+ "win";
+#elif defined(OS_ANDROID)
+ "android";
+#elif defined(OS_CHROMEOS)
+ "cros";
+#elif defined(OS_LINUX)
+ "linux";
+#elif defined(OS_OPENBSD)
+ "openbsd";
+#else
+ #error "unknown os"
+#endif
+
+const char kArch[] =
+#if defined(__amd64__) || defined(_WIN64)
+ "x64";
+#elif defined(__i386__) || defined(_WIN32)
+ "x86";
+#elif defined(__arm__)
+ "arm";
+#else
+ "unknown";
asargent_no_longer_on_chrome 2013/03/06 00:45:06 Maybe we should do #error for this case too, simil
jackhou 2013/03/06 03:56:36 Done.
petarj 2013/04/18 16:05:05 MIPS architecture ain't wacky, is it? This part br
+#endif
+
+} // namespace
+
+namespace chrome {
+
+std::string GetOmahaQueryParams(const std::string& prod) {
+ return StringPrintf("os=%s&arch=%s&prod=%s&prodchannel=%s&prodversion=%s",
+ kOs,
+ kArch,
+ prod.c_str(),
+ GetChannelString(),
+ chrome::VersionInfo().Version().c_str());
+}
+
+} // namespace chrome
« chrome/common/omaha_query_params.h ('K') | « chrome/common/omaha_query_params.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698