OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_ADDRESS_SHEET_CONTROLLER_MAC_ | |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_ADDRESS_SHEET_CONTROLLER_MAC_ | |
7 #pragma once | |
8 | |
9 #import <Cocoa/Cocoa.h> | |
10 | |
11 @class AutoFillAddressModel; | |
12 class AutoFillProfile; | |
13 | |
14 // The sheet can be invoked in "Add" or "Edit" mode. This dictates the caption | |
15 // seen at the top of the sheet. | |
16 enum { | |
17 kAutoFillAddressAddMode = 0, | |
18 kAutoFillAddressEditMode = 1 | |
19 }; | |
20 typedef NSInteger AutoFillAddressMode; | |
21 | |
22 // A class that coordinates the |addressModel| and the associated view | |
23 // held in AutoFillAddressSheet.xib. | |
24 // |initWithProfile:| is the designated initializer. It takes |profile| | |
25 // and transcribes it to |addressModel| to which the view is bound. | |
26 @interface AutoFillAddressSheetController : NSWindowController { | |
27 @private | |
28 // The caption at top of dialog. Text changes according to usage. Either | |
29 // "New address" or "Edit address" depending on |mode_|. | |
30 IBOutlet NSTextField* caption_; | |
31 | |
32 // The primary model for this controller. The model is instantiated | |
33 // from within |initWithProfile:|. We do not hold it as a scoped_nsobject | |
34 // because it is exposed as a KVO compliant property. | |
35 // Strong reference. | |
36 AutoFillAddressModel* addressModel_; | |
37 | |
38 // Either "Add" or "Edit" mode of sheet. | |
39 AutoFillAddressMode mode_; | |
40 } | |
41 | |
42 @property(nonatomic, retain) AutoFillAddressModel* addressModel; | |
43 | |
44 // IBActions for save and cancel buttons. Both invoke |endSheet:|. | |
45 - (IBAction)save:(id)sender; | |
46 - (IBAction)cancel:(id)sender; | |
47 | |
48 // Designated initializer. Takes a copy of the data in |profile|, | |
49 // it is not held as a reference. | |
50 - (id)initWithProfile:(const AutoFillProfile&)profile | |
51 mode:(AutoFillAddressMode)mode; | |
52 | |
53 // Copy data from internal model to |profile|. | |
54 - (void)copyModelToProfile:(AutoFillProfile*)profile; | |
55 | |
56 @end | |
57 | |
58 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_ADDRESS_SHEET_CONTROLLER_MAC_ | |
OLD | NEW |