Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autofill/autofill_dialog_controller_mac.h" | 5 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" |
| 6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #import "chrome/browser/autofill/autofill_address_model_mac.h" | 9 #import "chrome/browser/autofill/autofill_address_model_mac.h" |
| 10 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" | 10 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 modalForWindow:[self window] | 328 modalForWindow:[self window] |
| 329 modalDelegate:self | 329 modalDelegate:self |
| 330 didEndSelector:@selector(creditCardAddDidEnd:returnCode:contextInfo:) | 330 didEndSelector:@selector(creditCardAddDidEnd:returnCode:contextInfo:) |
| 331 contextInfo:NULL]; | 331 contextInfo:NULL]; |
| 332 } | 332 } |
| 333 | 333 |
| 334 // Add address sheet was dismissed. Non-zero |returnCode| indicates a save. | 334 // Add address sheet was dismissed. Non-zero |returnCode| indicates a save. |
| 335 - (void)addressAddDidEnd:(NSWindow*)sheet | 335 - (void)addressAddDidEnd:(NSWindow*)sheet |
| 336 returnCode:(int)returnCode | 336 returnCode:(int)returnCode |
| 337 contextInfo:(void*)contextInfo { | 337 contextInfo:(void*)contextInfo { |
| 338 DCHECK(contextInfo == NULL); | 338 DCHECK(!contextInfo); |
| 339 | 339 |
| 340 if (returnCode) { | 340 if (returnCode) { |
| 341 // Create a new address and save it to the |profiles_| list. | 341 // Create a new address and save it to the |profiles_| list. |
| 342 AutoFillProfile newAddress; | 342 AutoFillProfile newAddress; |
| 343 [addressSheetController copyModelToProfile:&newAddress]; | 343 [addressSheetController copyModelToProfile:&newAddress]; |
| 344 if (!newAddress.IsEmpty() && !FindByContents(profiles_, newAddress)) { | 344 if (!newAddress.IsEmpty() && !FindByContents(profiles_, newAddress)) { |
| 345 profiles_.push_back(newAddress); | 345 profiles_.push_back(newAddress); |
| 346 | 346 |
| 347 // Saving will save to the PDM and the table will refresh when PDM sends | 347 // Saving will save to the PDM and the table will refresh when PDM sends |
| 348 // notification that the underlying model has changed. | 348 // notification that the underlying model has changed. |
| 349 [self save]; | 349 [self save]; |
| 350 | 350 |
| 351 // Update the selection to the newly added item. | 351 // Update the selection to the newly added item. |
| 352 NSInteger row = [self rowFromProfileIndex:profiles_.size() - 1]; | 352 NSInteger row = [self rowFromProfileIndex:profiles_.size() - 1]; |
| 353 [tableView_ selectRowIndexes:[NSIndexSet indexSetWithIndex:row] | 353 [tableView_ selectRowIndexes:[NSIndexSet indexSetWithIndex:row] |
| 354 byExtendingSelection:NO]; | 354 byExtendingSelection:NO]; |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 [sheet orderOut:self]; | 357 [sheet orderOut:self]; |
| 358 addressSheetController.reset(nil); | 358 addressSheetController.reset(nil); |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Add credit card sheet was dismissed. Non-zero |returnCode| indicates a save. | 361 // Add credit card sheet was dismissed. Non-zero |returnCode| indicates a save. |
| 362 - (void)creditCardAddDidEnd:(NSWindow *)sheet | 362 - (void)creditCardAddDidEnd:(NSWindow *)sheet |
|
Robert Sesek
2011/02/17 17:17:32
nit: while you're here, remove the space between N
KushalP
2011/02/17 17:38:11
Done.
| |
| 363 returnCode:(int)returnCode | 363 returnCode:(int)returnCode |
| 364 contextInfo:(void *)contextInfo { | 364 contextInfo:(void *)contextInfo { |
|
Robert Sesek
2011/02/17 17:17:32
same here
KushalP
2011/02/17 17:38:11
Done.
| |
| 365 DCHECK(contextInfo == NULL); | 365 DCHECK(!contextInfo); |
| 366 | 366 |
| 367 if (returnCode) { | 367 if (returnCode) { |
| 368 // Create a new credit card and save it to the |creditCards_| list. | 368 // Create a new credit card and save it to the |creditCards_| list. |
| 369 CreditCard newCreditCard; | 369 CreditCard newCreditCard; |
| 370 [creditCardSheetController copyModelToCreditCard:&newCreditCard]; | 370 [creditCardSheetController copyModelToCreditCard:&newCreditCard]; |
| 371 if (!newCreditCard.IsEmpty() && | 371 if (!newCreditCard.IsEmpty() && |
| 372 !FindByContents(creditCards_, newCreditCard)) { | 372 !FindByContents(creditCards_, newCreditCard)) { |
| 373 creditCards_.push_back(newCreditCard); | 373 creditCards_.push_back(newCreditCard); |
| 374 | 374 |
| 375 // Saving will save to the PDM and the table will refresh when PDM sends | 375 // Saving will save to the PDM and the table will refresh when PDM sends |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 if (!image) { | 932 if (!image) { |
| 933 image = rb.GetNativeImageNamed(IDR_INPUT_GOOD); | 933 image = rb.GetNativeImageNamed(IDR_INPUT_GOOD); |
| 934 DCHECK(image); | 934 DCHECK(image); |
| 935 return image; | 935 return image; |
| 936 } | 936 } |
| 937 | 937 |
| 938 return nil; | 938 return nil; |
| 939 } | 939 } |
| 940 | 940 |
| 941 @end | 941 @end |
| OLD | NEW |