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

Side by Side Diff: chrome/common/chrome_version_info_mac.mm

Issue 7249003: Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info_* (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: correct nits Created 9 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/common/chrome_version_info_linux.cc ('k') | chrome/common/chrome_version_info_win.cc » ('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 (c) 2011 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/common/chrome_version_info.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #include "base/basictypes.h"
10 #include "base/sys_string_conversions.h"
11
12 namespace chrome {
13
14 // static
15 std::string VersionInfo::GetVersionStringModifier() {
16 #if defined(GOOGLE_CHROME_BUILD)
17 // Use the main application bundle and not the framework bundle. Keystone
18 // keys don't live in the framework.
19 NSBundle* bundle = [NSBundle mainBundle];
20 NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"];
21
22 // Only ever return "", "unknown", "beta", "dev", or "canary" in a branded
23 // build.
24 if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) {
25 // This build is not Keystone-enabled, it can't have a channel.
26 channel = @"unknown";
27 } else if (!channel) {
28 // For the stable channel, KSChannelID is not set.
29 channel = @"";
30 } else if ([channel isEqual:@"beta"] ||
31 [channel isEqual:@"dev"] ||
32 [channel isEqual:@"canary"]) {
33 // do nothing.
34 } else {
35 channel = @"unknown";
36 }
37
38 return base::SysNSStringToUTF8(channel);
39 #else
40 return std::string();
41 #endif
42 }
43
44 // static
45 VersionInfo::Channel VersionInfo::GetChannel() {
46 #if defined(GOOGLE_CHROME_BUILD)
47 std::string channel = GetVersionStringModifier();
48 if (channel.empty()) {
49 return CHANNEL_STABLE;
50 } else if (channel == "beta") {
51 return CHANNEL_BETA;
52 } else if (channel == "dev") {
53 return CHANNEL_DEV;
54 } else if (channel == "canary") {
55 return CHANNEL_CANARY;
56 }
57 #endif
58
59 return CHANNEL_UNKNOWN;
60 }
61
62 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_version_info_linux.cc ('k') | chrome/common/chrome_version_info_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698