| 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" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #import "chrome/browser/cocoa/keystone_glue.h" | 12 #import "chrome/browser/cocoa/keystone_glue.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/platform_util.h" | |
| 15 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 17 #import "chrome/browser/ui/cocoa/background_tile_view.h" | 16 #import "chrome/browser/ui/cocoa/background_tile_view.h" |
| 18 #include "chrome/browser/ui/cocoa/restart_browser.h" | 17 #include "chrome/browser/ui/cocoa/restart_browser.h" |
| 18 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "grit/locale_settings.h" | 22 #include "grit/locale_settings.h" |
| 23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 24 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 24 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/l10n/l10n_util_mac.h" | 26 #include "ui/base/l10n/l10n_util_mac.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| (...skipping 94 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(); | 133 chrome::VersionInfo version_info; |
| 134 NSString* chromeVersion = | |
| 135 [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; | |
| 136 | |
| 137 NSString* versionModifier = @""; | |
| 138 NSString* svnRevision = @""; | |
| 139 std::string modifier = platform_util::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 | 134 // The format string is not localized, but this is how the displayed version |
| 149 // is built on Windows too. | 135 // is built on Windows too. |
| 150 NSString* version = | 136 NSString* version = [NSString stringWithFormat:@"%@", |
| 151 [NSString stringWithFormat:@"%@%@%@", | 137 base::SysUTF8ToNSString( |
| 152 chromeVersion, svnRevision, versionModifier]; | 138 version_info.CreateVersionString())]; |
| 153 | 139 |
| 154 [version_ setStringValue:version]; | 140 [version_ setStringValue:version]; |
| 155 | 141 |
| 156 // Put the two images into the UI. | 142 // Put the two images into the UI. |
| 157 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 143 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 158 NSImage* backgroundImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND_COLOR); | 144 NSImage* backgroundImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND_COLOR); |
| 159 DCHECK(backgroundImage); | 145 DCHECK(backgroundImage); |
| 160 [backgroundView_ setTileImage:backgroundImage]; | 146 [backgroundView_ setTileImage:backgroundImage]; |
| 161 NSImage* logoImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND); | 147 NSImage* logoImage = rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND); |
| 162 DCHECK(logoImage); | 148 DCHECK(logoImage); |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 NSRange string_range = NSMakeRange(0, [legal_block length]); | 742 NSRange string_range = NSMakeRange(0, [legal_block length]); |
| 757 [legal_block addAttribute:NSFontAttributeName | 743 [legal_block addAttribute:NSFontAttributeName |
| 758 value:[NSFont labelFontOfSize:11] | 744 value:[NSFont labelFontOfSize:11] |
| 759 range:string_range]; | 745 range:string_range]; |
| 760 | 746 |
| 761 [legal_block endEditing]; | 747 [legal_block endEditing]; |
| 762 return legal_block; | 748 return legal_block; |
| 763 } | 749 } |
| 764 | 750 |
| 765 @end // @implementation AboutWindowController | 751 @end // @implementation AboutWindowController |
| OLD | NEW |