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

Unified Diff: chrome/browser/ui/cocoa/autofill/autofill_main_container.mm

Issue 19287006: [rAC, OSX] "Save In Chrome" checkbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-upload - CQ is capricious Created 7 years, 5 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/autofill/autofill_main_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
index 82908757fcfbda0ff93eea11c1c5c6df9957c92a..4a9492adde58493e26c9715af410858274f7d204 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
+++ b/chrome/browser/ui/cocoa/autofill/autofill_main_container.mm
@@ -50,6 +50,15 @@
[self layoutButtons];
+ // Set up "Save in Chrome" checkbox.
+ saveInChromeCheckbox_.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
+ [saveInChromeCheckbox_ setButtonType:NSSwitchButton];
+ [saveInChromeCheckbox_ setTitle:
+ base::SysUTF16ToNSString(controller_->SaveLocallyText())];
+ [saveInChromeCheckbox_ setState:NSOnState];
+ [saveInChromeCheckbox_ sizeToFit];
+ [[self view] addSubview:saveInChromeCheckbox_];
+
detailsContainer_.reset(
[[AutofillDetailsContainer alloc] initWithController:controller_]);
NSSize frameSize = [[detailsContainer_ view] frame].size;
@@ -122,6 +131,10 @@
buttonFrame.origin.y = currentY;
[buttonContainer_ setFrameOrigin:buttonFrame.origin];
+ NSRect checkboxFrame = [saveInChromeCheckbox_ frame];
+ checkboxFrame.origin.y = NSMidY(buttonFrame) - NSHeight(checkboxFrame) / 2.0;
+ [saveInChromeCheckbox_ setFrameOrigin:checkboxFrame.origin];
+
[detailsContainer_ performLayout];
NSRect containerFrame = [[detailsContainer_ view] frame];
containerFrame.origin.y = NSMaxY(buttonFrame);
@@ -208,9 +221,14 @@
}
- (void)modelChanged {
+ [saveInChromeCheckbox_ setHidden:!controller_->ShouldOfferToSaveInChrome()];
[detailsContainer_ modelChanged];
}
+- (BOOL)saveDetailsLocally {
+ return [saveInChromeCheckbox_ state] == NSOnState;
+}
+
- (void)updateLegalDocuments {
NSString* text = base::SysUTF16ToNSString(controller_->LegalDocumentsText());
@@ -254,3 +272,12 @@
}
@end
+
+
+@implementation AutofillMainContainer (Testing)
+
+- (NSButton*)saveInChromeCheckboxForTesting {
+ return saveInChromeCheckbox_.get();
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698