| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util_mac.h" | 5 #include "app/l10n_util_mac.h" |
| 6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // These methods maintain the image (or throbber) and text displayed regarding | 66 // These methods maintain the image (or throbber) and text displayed regarding |
| 67 // update status. -setUpdateThrobberMessage: starts a progress throbber and | 67 // update status. -setUpdateThrobberMessage: starts a progress throbber and |
| 68 // sets the text. -setUpdateImage:message: displays an image and sets the | 68 // sets the text. -setUpdateImage:message: displays an image and sets the |
| 69 // text. | 69 // text. |
| 70 - (void)setUpdateThrobberMessage:(NSString*)message; | 70 - (void)setUpdateThrobberMessage:(NSString*)message; |
| 71 - (void)setUpdateImage:(int)imageID message:(NSString*)message; | 71 - (void)setUpdateImage:(int)imageID message:(NSString*)message; |
| 72 | 72 |
| 73 @end // @interface AboutWindowController(Private) | 73 @end // @interface AboutWindowController(Private) |
| 74 | 74 |
| 75 const NSString* const kUserClosedAboutNotification = | |
| 76 @"UserClosedAboutNotification"; | |
| 77 | |
| 78 @implementation AboutWindowController | 75 @implementation AboutWindowController |
| 79 | 76 |
| 80 - (id)initWithProfile:(Profile*)profile { | 77 - (id)initWithProfile:(Profile*)profile { |
| 81 NSString* nibPath = [mac_util::MainAppBundle() pathForResource:@"About" | 78 NSString* nibPath = [mac_util::MainAppBundle() pathForResource:@"About" |
| 82 ofType:@"nib"]; | 79 ofType:@"nib"]; |
| 83 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { | 80 if ((self = [super initWithWindowNibPath:nibPath owner:self])) { |
| 84 profile_ = profile; | 81 profile_ = profile; |
| 85 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 82 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 86 [center addObserver:self | 83 [center addObserver:self |
| 87 selector:@selector(updateStatus:) | 84 selector:@selector(updateStatus:) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 [backgroundView_ setFrame:backgroundFrame]; | 184 [backgroundView_ setFrame:backgroundFrame]; |
| 188 | 185 |
| 189 NSSize windowDelta = NSMakeSize(0.0, legalShift - updateShift); | 186 NSSize windowDelta = NSMakeSize(0.0, legalShift - updateShift); |
| 190 | 187 |
| 191 [GTMUILocalizerAndLayoutTweaker | 188 [GTMUILocalizerAndLayoutTweaker |
| 192 resizeWindowWithoutAutoResizingSubViews:[self window] | 189 resizeWindowWithoutAutoResizingSubViews:[self window] |
| 193 delta:windowDelta]; | 190 delta:windowDelta]; |
| 194 } | 191 } |
| 195 | 192 |
| 196 - (void)windowWillClose:(NSNotification*)notification { | 193 - (void)windowWillClose:(NSNotification*)notification { |
| 197 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 194 [self autorelease]; |
| 198 [center postNotificationName:kUserClosedAboutNotification object:self]; | |
| 199 } | 195 } |
| 200 | 196 |
| 201 - (void)setUpdateThrobberMessage:(NSString*)message { | 197 - (void)setUpdateThrobberMessage:(NSString*)message { |
| 202 [updateStatusIndicator_ setHidden:YES]; | 198 [updateStatusIndicator_ setHidden:YES]; |
| 203 | 199 |
| 204 [spinner_ setHidden:NO]; | 200 [spinner_ setHidden:NO]; |
| 205 [spinner_ startAnimation:self]; | 201 [spinner_ startAnimation:self]; |
| 206 | 202 |
| 207 [updateText_ setStringValue:message]; | 203 [updateText_ setStringValue:message]; |
| 208 } | 204 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 NSRange string_range = NSMakeRange(0, [legal_block length]); | 476 NSRange string_range = NSMakeRange(0, [legal_block length]); |
| 481 [legal_block addAttribute:NSFontAttributeName | 477 [legal_block addAttribute:NSFontAttributeName |
| 482 value:[NSFont labelFontOfSize:11] | 478 value:[NSFont labelFontOfSize:11] |
| 483 range:string_range]; | 479 range:string_range]; |
| 484 | 480 |
| 485 [legal_block endEditing]; | 481 [legal_block endEditing]; |
| 486 return legal_block; | 482 return legal_block; |
| 487 } | 483 } |
| 488 | 484 |
| 489 @end // @implementation AboutWindowController | 485 @end // @implementation AboutWindowController |
| OLD | NEW |