OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; | 66 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; |
67 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; | 67 [alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)]; |
68 [alert setMessageText:base::SysUTF16ToNSString(title)]; | 68 [alert setMessageText:base::SysUTF16ToNSString(title)]; |
69 [alert setInformativeText:base::SysUTF16ToNSString(message)]; | 69 [alert setInformativeText:base::SysUTF16ToNSString(message)]; |
70 [alert setAlertStyle:NSWarningAlertStyle]; | 70 [alert setAlertStyle:NSWarningAlertStyle]; |
71 [alert runModal]; | 71 [alert runModal]; |
72 } | 72 } |
73 | 73 |
74 string16 GetVersionStringModifier() { | 74 string16 GetVersionStringModifier() { |
75 #if defined(GOOGLE_CHROME_BUILD) | 75 #if defined(GOOGLE_CHROME_BUILD) |
76 NSBundle* bundle = mac_util::MainAppBundle(); | 76 // Use the main application bundle and not the framework bundle. Keystone |
| 77 // keys don't live in the framework. |
| 78 NSBundle* bundle = [NSBundle mainBundle]; |
77 NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"]; | 79 NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"]; |
78 | 80 |
79 // Only ever return "", "unknown", "beta" or "dev" in a branded build. | 81 // Only ever return "", "unknown", "beta" or "dev" in a branded build. |
80 if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) { | 82 if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) { |
81 // This build is not Keystone-enabled, it can't have a channel. | 83 // This build is not Keystone-enabled, it can't have a channel. |
82 channel = @"unknown"; | 84 channel = @"unknown"; |
83 } else if (!channel || [channel isEqual:@"stable"]) { | 85 } else if (!channel) { |
84 // For the stable channel, KSChannelID is not set. | 86 // For the stable channel, KSChannelID is not set. |
85 channel = @""; | 87 channel = @""; |
86 } else if ([channel isEqual:@"beta"] || [channel isEqual:@"dev"]) { | 88 } else if ([channel isEqual:@"beta"] || [channel isEqual:@"dev"]) { |
87 // do nothing. | 89 // do nothing. |
88 } else { | 90 } else { |
89 channel = @"unknown"; | 91 channel = @"unknown"; |
90 } | 92 } |
91 | 93 |
92 return base::SysNSStringToUTF16(channel); | 94 return base::SysNSStringToUTF16(channel); |
93 #else | 95 #else |
94 return string16(); | 96 return string16(); |
95 #endif | 97 #endif |
96 } | 98 } |
97 | 99 |
98 } // namespace platform_util | 100 } // namespace platform_util |
OLD | NEW |