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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_main_container.mm

Issue 25405003: [rAC, OSX] saveInChrome status now persistent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_main_container.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/autofill/autofill_main_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 [view setSubviews:@[buttonContainer_]]; 48 [view setSubviews:@[buttonContainer_]];
49 [self setView:view]; 49 [self setView:view];
50 50
51 [self layoutButtons]; 51 [self layoutButtons];
52 52
53 // Set up "Save in Chrome" checkbox. 53 // Set up "Save in Chrome" checkbox.
54 saveInChromeCheckbox_.reset([[NSButton alloc] initWithFrame:NSZeroRect]); 54 saveInChromeCheckbox_.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
55 [saveInChromeCheckbox_ setButtonType:NSSwitchButton]; 55 [saveInChromeCheckbox_ setButtonType:NSSwitchButton];
56 [saveInChromeCheckbox_ setTitle: 56 [saveInChromeCheckbox_ setTitle:
57 base::SysUTF16ToNSString(delegate_->SaveLocallyText())]; 57 base::SysUTF16ToNSString(delegate_->SaveLocallyText())];
58 [saveInChromeCheckbox_ setState:NSOnState]; 58 [saveInChromeCheckbox_ setState:
59 (delegate_->ShouldSaveInChrome() ? NSOnState : NSOffState)];
Avi (use Gerrit) 2013/10/01 02:06:09 Indentation is still wrong. That's three spaces, n
groby-ooo-7-16 2013/10/01 02:12:02 Done.
59 [saveInChromeCheckbox_ sizeToFit]; 60 [saveInChromeCheckbox_ sizeToFit];
60 [[self view] addSubview:saveInChromeCheckbox_]; 61 [[self view] addSubview:saveInChromeCheckbox_];
61 62
62 detailsContainer_.reset( 63 detailsContainer_.reset(
63 [[AutofillDetailsContainer alloc] initWithDelegate:delegate_]); 64 [[AutofillDetailsContainer alloc] initWithDelegate:delegate_]);
64 NSSize frameSize = [[detailsContainer_ view] frame].size; 65 NSSize frameSize = [[detailsContainer_ view] frame].size;
65 [[detailsContainer_ view] setFrameOrigin: 66 [[detailsContainer_ view] setFrameOrigin:
66 NSMakePoint(0, NSHeight([buttonContainer_ frame]))]; 67 NSMakePoint(0, NSHeight([buttonContainer_ frame]))];
67 frameSize.height += NSHeight([buttonContainer_ frame]); 68 frameSize.height += NSHeight([buttonContainer_ frame]);
68 [[self view] setFrameSize:frameSize]; 69 [[self view] setFrameSize:frameSize];
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 legalDocumentsSizeDirty_ = NO; 225 legalDocumentsSizeDirty_ = NO;
225 legalDocumentsSize_ = newFrame.size; 226 legalDocumentsSize_ = newFrame.size;
226 return legalDocumentsSize_; 227 return legalDocumentsSize_;
227 } 228 }
228 229
229 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section { 230 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section {
230 return [detailsContainer_ sectionForId:section]; 231 return [detailsContainer_ sectionForId:section];
231 } 232 }
232 233
233 - (void)modelChanged { 234 - (void)modelChanged {
234 [saveInChromeCheckbox_ setHidden:!delegate_->ShouldOfferToSaveInChrome()]; 235 [self updateSaveInChrome];
235 [detailsContainer_ modelChanged]; 236 [detailsContainer_ modelChanged];
236 } 237 }
237 238
238 - (BOOL)saveDetailsLocally { 239 - (BOOL)saveDetailsLocally {
239 return [saveInChromeCheckbox_ state] == NSOnState; 240 return [saveInChromeCheckbox_ state] == NSOnState;
240 } 241 }
241 242
242 - (void)updateLegalDocuments { 243 - (void)updateLegalDocuments {
243 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText()); 244 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText());
244 245
(...skipping 29 matching lines...) Expand all
274 } 275 }
275 276
276 - (void)setAnchorView:(NSView*)anchorView { 277 - (void)setAnchorView:(NSView*)anchorView {
277 [notificationContainer_ setAnchorView:anchorView]; 278 [notificationContainer_ setAnchorView:anchorView];
278 } 279 }
279 280
280 - (BOOL)validate { 281 - (BOOL)validate {
281 return [detailsContainer_ validate]; 282 return [detailsContainer_ validate];
282 } 283 }
283 284
285 - (void)updateSaveInChrome {
286 [saveInChromeCheckbox_ setHidden:!delegate_->ShouldOfferToSaveInChrome()];
287 }
288
284 @end 289 @end
285 290
286 291
287 @implementation AutofillMainContainer (Testing) 292 @implementation AutofillMainContainer (Testing)
288 293
289 - (NSButton*)saveInChromeCheckboxForTesting { 294 - (NSButton*)saveInChromeCheckboxForTesting {
290 return saveInChromeCheckbox_.get(); 295 return saveInChromeCheckbox_.get();
291 } 296 }
292 297
293 @end 298 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_main_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698