OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #import "chrome/browser/ui/cocoa/about_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/about_window_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // YES when an About box is currently showing the kAutoupdateInstallFailed | 123 // YES when an About box is currently showing the kAutoupdateInstallFailed |
124 // status, or if no About box is visible, if the most recent About box to be | 124 // status, or if no About box is visible, if the most recent About box to be |
125 // closed was closed while showing this status. When an About box opens, if | 125 // closed was closed while showing this status. When an About box opens, if |
126 // the recent status is kAutoupdateInstallFailed or kAutoupdatePromoteFailed | 126 // the recent status is kAutoupdateInstallFailed or kAutoupdatePromoteFailed |
127 // and recentShownUserActionFailedStatus is NO, the failure needs to be shown | 127 // and recentShownUserActionFailedStatus is NO, the failure needs to be shown |
128 // instead of launching a new update check. recentShownInstallFailedStatus is | 128 // instead of launching a new update check. recentShownInstallFailedStatus is |
129 // maintained by -updateStatus:. | 129 // maintained by -updateStatus:. |
130 static BOOL recentShownUserActionFailedStatus = NO; | 130 static BOOL recentShownUserActionFailedStatus = NO; |
131 | 131 |
132 - (void)awakeFromNib { | 132 - (void)awakeFromNib { |
133 NSBundle* bundle = base::mac::MainAppBundle(); | |
134 NSString* chromeVersion = | |
135 [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; | |
136 | |
137 NSString* versionModifier = @""; | |
138 NSString* svnRevision = @""; | |
139 std::string modifier = chrome::VersionInfo::GetVersionStringModifier(); | |
140 if (!modifier.empty()) | |
141 versionModifier = [NSString stringWithFormat:@" %@", | |
142 base::SysUTF8ToNSString(modifier)]; | |
143 | |
144 #if !defined(GOOGLE_CHROME_BUILD) | |
145 svnRevision = [NSString stringWithFormat:@" (%@)", | |
146 [bundle objectForInfoDictionaryKey:@"SVNRevision"]]; | |
147 #endif | |
148 // The format string is not localized, but this is how the displayed version | 133 // The format string is not localized, but this is how the displayed version |
149 // is built on Windows too. | 134 // is built on Windows too. |
| 135 chrome::VersionInfo version_info; |
150 NSString* version = | 136 NSString* version = |
151 [NSString stringWithFormat:@"%@%@%@", | 137 base::SysUTF8ToNSString(version_info.CreateVersionString()); |
152 chromeVersion, svnRevision, versionModifier]; | |
153 | |
154 [version_ setStringValue:version]; | 138 [version_ setStringValue:version]; |
155 | 139 |
156 // Put the two images into the UI. | 140 // Put the two images into the UI. |
157 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 141 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
158 NSImage* backgroundImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND_COLOR); | 142 NSImage* backgroundImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND_COLOR); |
159 DCHECK(backgroundImage); | 143 DCHECK(backgroundImage); |
160 [backgroundView_ setTileImage:backgroundImage]; | 144 [backgroundView_ setTileImage:backgroundImage]; |
161 NSImage* logoImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND); | 145 NSImage* logoImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND); |
162 DCHECK(logoImage); | 146 DCHECK(logoImage); |
163 [logoView_ setImage:logoImage]; | 147 [logoView_ setImage:logoImage]; |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 NSRange string_range = NSMakeRange(0, [legal_block length]); | 740 NSRange string_range = NSMakeRange(0, [legal_block length]); |
757 [legal_block addAttribute:NSFontAttributeName | 741 [legal_block addAttribute:NSFontAttributeName |
758 value:[NSFont labelFontOfSize:11] | 742 value:[NSFont labelFontOfSize:11] |
759 range:string_range]; | 743 range:string_range]; |
760 | 744 |
761 [legal_block endEditing]; | 745 [legal_block endEditing]; |
762 return legal_block; | 746 return legal_block; |
763 } | 747 } |
764 | 748 |
765 @end // @implementation AboutWindowController | 749 @end // @implementation AboutWindowController |
OLD | NEW |