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

Side by Side Diff: chrome/browser/services/gcm/gcm_utils.cc

Issue 301973009: Add browser-global GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build on Android. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/services/gcm/gcm_utils.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/services/gcm/gcm_utils.h"
6
7 #include "base/logging.h"
8 #include "chrome/common/chrome_version_info.h"
9
10 namespace gcm {
11
12 namespace {
13
14 GCMClient::ChromePlatform GetPlatform() {
15 #if defined(OS_WIN)
16 return GCMClient::PLATFORM_WIN;
17 #elif defined(OS_MACOSX)
18 return GCMClient::PLATFORM_MAC;
19 #elif defined(OS_IOS)
20 return GCMClient::PLATFORM_IOS;
21 #elif defined(OS_ANDROID)
22 return GCMClient::PLATFORM_ANDROID;
23 #elif defined(OS_CHROMEOS)
24 return GCMClient::PLATFORM_CROS;
25 #elif defined(OS_LINUX)
26 return GCMClient::PLATFORM_LINUX;
27 #else
28 // For all other platforms, return as LINUX.
29 return GCMClient::PLATFORM_LINUX;
30 #endif
31 }
32
33 GCMClient::ChromeChannel GetChannel() {
34 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
35 switch (channel) {
36 case chrome::VersionInfo::CHANNEL_UNKNOWN:
37 return GCMClient::CHANNEL_UNKNOWN;
38 case chrome::VersionInfo::CHANNEL_CANARY:
39 return GCMClient::CHANNEL_CANARY;
40 case chrome::VersionInfo::CHANNEL_DEV:
41 return GCMClient::CHANNEL_DEV;
42 case chrome::VersionInfo::CHANNEL_BETA:
43 return GCMClient::CHANNEL_BETA;
44 case chrome::VersionInfo::CHANNEL_STABLE:
45 return GCMClient::CHANNEL_STABLE;
46 default:
47 NOTREACHED();
48 return GCMClient::CHANNEL_UNKNOWN;
49 }
50 }
51
52 std::string GetVersion() {
53 chrome::VersionInfo version_info;
54 return version_info.Version();
55 }
56
57 } // namespace
58
59 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
60 GCMClient::ChromeBuildInfo chrome_build_info;
61 chrome_build_info.platform = GetPlatform();
62 chrome_build_info.channel = GetChannel();
63 chrome_build_info.version = GetVersion();
64 return chrome_build_info;
65 }
66
67 } // namespace gcm
OLDNEW
« 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