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

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

Issue 25673002: Revert 226376 "[rAC, OSX] saveInChrome status now persistent." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | « trunk/src/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: 58 [saveInChromeCheckbox_ setState:NSOnState];
59 (delegate_->ShouldSaveInChrome() ? NSOnState : NSOffState)];
60 [saveInChromeCheckbox_ sizeToFit]; 59 [saveInChromeCheckbox_ sizeToFit];
61 [[self view] addSubview:saveInChromeCheckbox_]; 60 [[self view] addSubview:saveInChromeCheckbox_];
62 61
63 detailsContainer_.reset( 62 detailsContainer_.reset(
64 [[AutofillDetailsContainer alloc] initWithDelegate:delegate_]); 63 [[AutofillDetailsContainer alloc] initWithDelegate:delegate_]);
65 NSSize frameSize = [[detailsContainer_ view] frame].size; 64 NSSize frameSize = [[detailsContainer_ view] frame].size;
66 [[detailsContainer_ view] setFrameOrigin: 65 [[detailsContainer_ view] setFrameOrigin:
67 NSMakePoint(0, NSHeight([buttonContainer_ frame]))]; 66 NSMakePoint(0, NSHeight([buttonContainer_ frame]))];
68 frameSize.height += NSHeight([buttonContainer_ frame]); 67 frameSize.height += NSHeight([buttonContainer_ frame]);
69 [[self view] setFrameSize:frameSize]; 68 [[self view] setFrameSize:frameSize];
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 legalDocumentsSizeDirty_ = NO; 224 legalDocumentsSizeDirty_ = NO;
226 legalDocumentsSize_ = newFrame.size; 225 legalDocumentsSize_ = newFrame.size;
227 return legalDocumentsSize_; 226 return legalDocumentsSize_;
228 } 227 }
229 228
230 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section { 229 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section {
231 return [detailsContainer_ sectionForId:section]; 230 return [detailsContainer_ sectionForId:section];
232 } 231 }
233 232
234 - (void)modelChanged { 233 - (void)modelChanged {
235 [self updateSaveInChrome]; 234 [saveInChromeCheckbox_ setHidden:!delegate_->ShouldOfferToSaveInChrome()];
236 [detailsContainer_ modelChanged]; 235 [detailsContainer_ modelChanged];
237 } 236 }
238 237
239 - (BOOL)saveDetailsLocally { 238 - (BOOL)saveDetailsLocally {
240 return [saveInChromeCheckbox_ state] == NSOnState; 239 return [saveInChromeCheckbox_ state] == NSOnState;
241 } 240 }
242 241
243 - (void)updateLegalDocuments { 242 - (void)updateLegalDocuments {
244 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText()); 243 NSString* text = base::SysUTF16ToNSString(delegate_->LegalDocumentsText());
245 244
(...skipping 29 matching lines...) Expand all
275 } 274 }
276 275
277 - (void)setAnchorView:(NSView*)anchorView { 276 - (void)setAnchorView:(NSView*)anchorView {
278 [notificationContainer_ setAnchorView:anchorView]; 277 [notificationContainer_ setAnchorView:anchorView];
279 } 278 }
280 279
281 - (BOOL)validate { 280 - (BOOL)validate {
282 return [detailsContainer_ validate]; 281 return [detailsContainer_ validate];
283 } 282 }
284 283
285 - (void)updateSaveInChrome {
286 [saveInChromeCheckbox_ setHidden:!delegate_->ShouldOfferToSaveInChrome()];
287 }
288
289 @end 284 @end
290 285
291 286
292 @implementation AutofillMainContainer (Testing) 287 @implementation AutofillMainContainer (Testing)
293 288
294 - (NSButton*)saveInChromeCheckboxForTesting { 289 - (NSButton*)saveInChromeCheckboxForTesting {
295 return saveInChromeCheckbox_.get(); 290 return saveInChromeCheckbox_.get();
296 } 291 }
297 292
298 @end 293 @end
OLDNEW
« no previous file with comments | « trunk/src/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