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

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: Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info.cc 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
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 #include "build/build_config.h"
tony 2011/06/23 16:54:54 Nit: I don't think you need build_config.h here.
haraken1 2011/06/23 23:57:14 Done.
12
13 namespace chrome {
14
15 // static
16 std::string VersionInfo::GetVersionStringModifier() {
17 #if defined(GOOGLE_CHROME_BUILD)
18 // Use the main application bundle and not the framework bundle. Keystone
19 // keys don't live in the framework.
20 NSBundle* bundle = [NSBundle mainBundle];
21 NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"];
22
23 // Only ever return "", "unknown", "beta", "dev", or "canary" in a branded
24 // build.
25 if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) {
26 // This build is not Keystone-enabled, it can't have a channel.
27 channel = @"unknown";
28 } else if (!channel) {
29 // For the stable channel, KSChannelID is not set.
30 channel = @"";
31 } else if ([channel isEqual:@"beta"] ||
32 [channel isEqual:@"dev"] ||
33 [channel isEqual:@"canary"]) {
34 // do nothing.
35 } else {
36 channel = @"unknown";
37 }
38
39 return base::SysNSStringToUTF8(channel);
40 #else
41 return std::string();
42 #endif
43 }
44
45 // static
46 VersionInfo::Channel VersionInfo::GetChannel() {
47 #if defined(GOOGLE_CHROME_BUILD)
48 std::string channel = GetVersionStringModifier();
49 if (channel.empty()) {
50 return CHANNEL_STABLE;
51 } else if (channel == "beta") {
52 return CHANNEL_BETA;
53 } else if (channel == "dev") {
54 return CHANNEL_DEV;
55 } else if (channel == "canary") {
56 return CHANNEL_CANARY;
57 }
58 #endif
59
60 return CHANNEL_UNKNOWN;
61 }
62
63 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698