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

Unified Diff: chrome/browser/services/gcm/gcm_utils.cc

Issue 293053014: Retrieve chrome build info in GCMProfileService, instead of GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 7 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
« no previous file with comments | « chrome/browser/services/gcm/gcm_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_utils.cc
diff --git a/chrome/browser/services/gcm/gcm_utils.cc b/chrome/browser/services/gcm/gcm_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fbb7139c1e22a95db85cc73005920da1429fca3
--- /dev/null
+++ b/chrome/browser/services/gcm/gcm_utils.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 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 "chrome/browser/services/gcm/gcm_utils.h"
+
+#include "base/logging.h"
+#include "chrome/common/chrome_version_info.h"
+
+namespace gcm {
+
+namespace {
+
+GCMClient::ChromePlatform GetPlatform() {
+#if defined(OS_WIN)
+ return GCMClient::PLATFORM_WIN;
+#elif defined(OS_MACOSX)
+ return GCMClient::PLATFORM_MAC;
+#elif defined(OS_IOS)
+ return GCMClient::PLATFORM_IOS;
+#elif defined(OS_ANDROID)
+ return GCMClient::PLATFORM_ANDROID;
+#elif defined(OS_CHROMEOS)
+ return GCMClient::PLATFORM_CROS;
+#elif defined(OS_LINUX)
+ return GCMClient::PLATFORM_LINUX;
+#else
+ // For all other platforms, return as LINUX.
+ return GCMClient::PLATFORM_LINUX;
+#endif
+}
+
+GCMClient::ChromeChannel GetChannel() {
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ switch (channel) {
+ case chrome::VersionInfo::CHANNEL_UNKNOWN:
+ return GCMClient::CHANNEL_UNKNOWN;
+ case chrome::VersionInfo::CHANNEL_CANARY:
+ return GCMClient::CHANNEL_CANARY;
+ case chrome::VersionInfo::CHANNEL_DEV:
+ return GCMClient::CHANNEL_DEV;
+ case chrome::VersionInfo::CHANNEL_BETA:
+ return GCMClient::CHANNEL_BETA;
+ case chrome::VersionInfo::CHANNEL_STABLE:
+ return GCMClient::CHANNEL_STABLE;
+ default:
+ NOTREACHED();
+ return GCMClient::CHANNEL_UNKNOWN;
+ }
+}
+
+std::string GetVersion() {
+ chrome::VersionInfo version_info;
+ return version_info.Version();
+}
+
+} // namespace
+
+GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
+ GCMClient::ChromeBuildInfo chrome_build_info;
+ chrome_build_info.platform = GetPlatform();
+ chrome_build_info.channel = GetChannel();
+ chrome_build_info.version = GetVersion();
+ return chrome_build_info;
+}
+
+} // namespace gcm
« no previous file with comments | « chrome/browser/services/gcm/gcm_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698