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 #import "chrome/browser/ui/cocoa/about_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/about_window_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/l10n_util_mac.h" | 8 #include "app/l10n_util_mac.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac_util.h" | 11 #include "base/mac/mac_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
15 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
17 #include "chrome/browser/platform_util.h" | 17 #include "chrome/browser/platform_util.h" |
18 #import "chrome/browser/ui/cocoa/background_tile_view.h" | 18 #import "chrome/browser/ui/cocoa/background_tile_view.h" |
19 #import "chrome/browser/ui/cocoa/keystone_glue.h" | 19 #import "chrome/browser/ui/cocoa/keystone_glue.h" |
20 #include "chrome/browser/ui/cocoa/restart_browser.h" | 20 #include "chrome/browser/ui/cocoa/restart_browser.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // action if full keyboard accessibility is enabled). | 93 // action if full keyboard accessibility is enabled). |
94 - (BOOL)shouldDrawInsertionPoint { | 94 - (BOOL)shouldDrawInsertionPoint { |
95 return NO; | 95 return NO; |
96 } | 96 } |
97 | 97 |
98 @end | 98 @end |
99 | 99 |
100 @implementation AboutWindowController | 100 @implementation AboutWindowController |
101 | 101 |
102 - (id)initWithProfile:(Profile*)profile { | 102 - (id)initWithProfile:(Profile*)profile { |
103 NSString* nibPath = [mac_util::MainAppBundle() pathForResource:@"About" | 103 NSString* nibPath = [base::mac::MainAppBundle() pathForResource:@"About" |
104 ofType:@"nib"]; | 104 ofType:@"nib"]; |
105 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { | 105 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { |
106 profile_ = profile; | 106 profile_ = profile; |
107 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 107 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
108 [center addObserver:self | 108 [center addObserver:self |
109 selector:@selector(updateStatus:) | 109 selector:@selector(updateStatus:) |
110 name:kAutoupdateStatusNotification | 110 name:kAutoupdateStatusNotification |
111 object:nil]; | 111 object:nil]; |
112 } | 112 } |
113 return self; | 113 return self; |
114 } | 114 } |
115 | 115 |
116 - (void)dealloc { | 116 - (void)dealloc { |
117 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 117 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
118 [super dealloc]; | 118 [super dealloc]; |
119 } | 119 } |
120 | 120 |
121 // YES when an About box is currently showing the kAutoupdateInstallFailed | 121 // YES when an About box is currently showing the kAutoupdateInstallFailed |
122 // status, or if no About box is visible, if the most recent About box to be | 122 // status, or if no About box is visible, if the most recent About box to be |
123 // closed was closed while showing this status. When an About box opens, if | 123 // closed was closed while showing this status. When an About box opens, if |
124 // the recent status is kAutoupdateInstallFailed or kAutoupdatePromoteFailed | 124 // the recent status is kAutoupdateInstallFailed or kAutoupdatePromoteFailed |
125 // and recentShownUserActionFailedStatus is NO, the failure needs to be shown | 125 // and recentShownUserActionFailedStatus is NO, the failure needs to be shown |
126 // instead of launching a new update check. recentShownInstallFailedStatus is | 126 // instead of launching a new update check. recentShownInstallFailedStatus is |
127 // maintained by -updateStatus:. | 127 // maintained by -updateStatus:. |
128 static BOOL recentShownUserActionFailedStatus = NO; | 128 static BOOL recentShownUserActionFailedStatus = NO; |
129 | 129 |
130 - (void)awakeFromNib { | 130 - (void)awakeFromNib { |
131 NSBundle* bundle = mac_util::MainAppBundle(); | 131 NSBundle* bundle = base::mac::MainAppBundle(); |
132 NSString* chromeVersion = | 132 NSString* chromeVersion = |
133 [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; | 133 [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; |
134 | 134 |
135 NSString* versionModifier = @""; | 135 NSString* versionModifier = @""; |
136 NSString* svnRevision = @""; | 136 NSString* svnRevision = @""; |
137 std::string modifier = platform_util::GetVersionStringModifier(); | 137 std::string modifier = platform_util::GetVersionStringModifier(); |
138 if (!modifier.empty()) | 138 if (!modifier.empty()) |
139 versionModifier = [NSString stringWithFormat:@" %@", | 139 versionModifier = [NSString stringWithFormat:@" %@", |
140 base::SysUTF8ToNSString(modifier)]; | 140 base::SysUTF8ToNSString(modifier)]; |
141 | 141 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 NSRange string_range = NSMakeRange(0, [legal_block length]); | 752 NSRange string_range = NSMakeRange(0, [legal_block length]); |
753 [legal_block addAttribute:NSFontAttributeName | 753 [legal_block addAttribute:NSFontAttributeName |
754 value:[NSFont labelFontOfSize:11] | 754 value:[NSFont labelFontOfSize:11] |
755 range:string_range]; | 755 range:string_range]; |
756 | 756 |
757 [legal_block endEditing]; | 757 [legal_block endEditing]; |
758 return legal_block; | 758 return legal_block; |
759 } | 759 } |
760 | 760 |
761 @end // @implementation AboutWindowController | 761 @end // @implementation AboutWindowController |
OLD | NEW |