Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3351)

Unified Diff: chrome/installer/mac/app/InstallerWindowController.m

Issue 2293923005: General comment cleaning / refactoring for Mac Installer (Closed)
Patch Set: Ivan fixes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/mac/app/InstallerWindowController.m
diff --git a/chrome/installer/mac/app/InstallerWindowController.m b/chrome/installer/mac/app/InstallerWindowController.m
index ebd2f4788ae6328d13885d760d9e53fe592b32e0..b5c2c2ab4a2906b769fe950c8bbcecbb0464977e 100644
--- a/chrome/installer/mac/app/InstallerWindowController.m
+++ b/chrome/installer/mac/app/InstallerWindowController.m
@@ -19,24 +19,13 @@
@implementation InstallerWindowController
-// Most buttons have the same style and differ only by their title, this method
-// simplifies styling the buttons and provides an argument for the title.
+// Simplify styling and naming buttons.
- (void)stylizeButton:(NSButton*)button withTitle:(NSString*)title {
button.buttonType = NSSwitchButton;
button.bezelStyle = NSRoundedBezelStyle;
button.title = title;
}
-// Similar to stylizeButton except works with NSTextField objects instead.
-- (void)stylizeTextField:(NSTextField*)textField
- withDescription:(NSString*)description {
- textField.backgroundColor = NSColor.clearColor;
- textField.textColor = NSColor.blackColor;
- textField.stringValue = description;
- textField.bezeled = NO;
- textField.editable = NO;
-}
-
// Positions and stylizes buttons.
- (void)setUpButtons {
importButton_ = [[NSButton alloc] initWithFrame:NSMakeRect(30, 20, 300, 25)];
@@ -60,6 +49,16 @@
[launchButton_ setAction:@selector(launchButtonClicked)];
}
+// Simplfy styling NSTextField objects.
+- (void)stylizeTextField:(NSTextField*)textField
+ withDescription:(NSString*)description {
+ textField.backgroundColor = NSColor.clearColor;
+ textField.textColor = NSColor.blackColor;
+ textField.stringValue = description;
+ textField.bezeled = NO;
+ textField.editable = NO;
+}
+
// Positions and stylizes textfields.
- (void)setUpTextfields {
statusDescription_ =
@@ -84,9 +83,9 @@
progressBar_.doubleValue = 0.0;
}
-// Positions and adds the rest of the UI elements to main window. Prevents
-// resizing the window so that the absolute position will look the same on all
-// computers. Window is hidden until all positioning is finished.
+// Positions the main window and adds the rest of the UI elements to it.
+// Prevents resizing the window so that the absolute position will look the same
+// on all computers. Window is hidden until all positioning is finished.
- (id)initWithWindow:(NSWindow*)window {
if (self = [super initWithWindow:window]) {
[window setFrame:NSMakeRect(0, 0, 430, 220) display:YES];
@@ -111,11 +110,10 @@
}
- (void)updateStatusDescription:(NSString*)text {
- // First setStringValue statement is required to clear the original string.
- // Omitting the first line will cause occasional ghosting of the previous
- // string.
- // TODO: Find a real solution to the ghosting problem.
- // downloadProgressDescription_.stringValue = @"";
+ // TODO: This method somehow causes ghosting of the previous string's contents
+ // after a redraw. The below line of code is a temporary hack to clear the
+ // ghosting behavior, but it should be replaced with a legitimate bug fix.
+ downloadProgressDescription_.stringValue = @"";
downloadProgressDescription_.stringValue = text;
}
@@ -123,6 +121,9 @@
if (progressPercent > 0.0) {
progressBar_.doubleValue = progressPercent;
} else {
+ // After the progress bar is made indeterminate, it will not need to track
+ // determinate progress any more. Therefore, there is nothing implemented to
+ // set indeterminate to NO.
progressBar_.doubleValue = 0.0;
progressBar_.indeterminate = YES;
[progressBar_ startAnimation:nil];

Powered by Google App Engine
This is Rietveld 408576698