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

Unified Diff: chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm

Issue 2716353003: [Extensions UI] Initially disabled OK button for extension install prompts. (Closed)
Patch Set: Fixing grammar in comments. Created 3 years, 9 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/browser/ui/cocoa/extensions/extension_install_view_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
index fe1a09d6940ed00958af4e90771a091ef287917c..c363db633dab97f3577b2880fa707c25f27b18d2 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
@@ -97,6 +97,9 @@ const CGFloat kLinkCellPaddingLeft = 3;
// contents.
const CGFloat kMaxControlHeight = 250;
+// Time delay before the install button is enabled after initial display.
+NSTimeInterval g_install_delay_in_s = 0.5;
Avi (use Gerrit) 2017/03/23 02:32:33 camelcase. No "in s".
Ackerman 2017/03/31 22:03:21 Noted.
+
NSString* const kTitleKey = @"title";
NSString* const kChildrenKey = @"children";
NSString* const kCellAttributesKey = @"cellAttributes";
@@ -384,6 +387,11 @@ bool HasAttribute(id item, CellAttributesMask attributeMask) {
currentRect.size.height += totalOffset;
[self updateViewFrame:currentRect];
}
+
+ // Default state of install button is disabled and then enabled after a short
+ // time delay.
+ [okButton_ setEnabled:NO];
+ [self startTimerToEnableInstall];
Devlin 2017/03/23 01:25:29 I'm a little worried that we start this at constru
Ackerman 2017/03/31 22:03:21 Noted. This will require a little work, so I'm goi
}
- (BOOL)hasWebstoreData {
@@ -776,6 +784,22 @@ appendPermissionsForPrompt:(const ExtensionInstallPrompt::Prompt&)prompt
[[self view] setFrame:frame];
}
+- (void)startTimerToEnableInstall {
+ [NSTimer scheduledTimerWithTimeInterval:g_install_delay_in_s
Devlin 2017/03/23 01:25:29 nit: maybe just inline this method
Ackerman 2017/03/31 22:03:21 Noted.
+ target:self
+ selector:@selector(enableInstall:)
+ userInfo:nil
+ repeats:NO];
+}
+
+- (void)enableInstall:(NSTimer*)timer {
+ [okButton_ setEnabled:YES];
+}
+
++ (void)setInstallDelayForTesting:(NSTimeInterval)time_delay_in_s {
+ g_install_delay_in_s = time_delay_in_s;
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698