OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_UI_COCOA_PASSWORDS_PASSWORD_ITEM_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_ITEM_VIEWS_H_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 namespace autofill { |
| 11 struct PasswordForm; |
| 12 } // namespace autofill |
| 13 |
| 14 @class HoverImageButton; |
| 15 class ManagePasswordsBubbleModel; |
| 16 @protocol PasswordItemDelegate; |
| 17 |
| 18 // The state of the password item. |
| 19 enum ManagePasswordItemState { |
| 20 MANAGE_PASSWORD_ITEM_STATE_PENDING, |
| 21 MANAGE_PASSWORD_ITEM_STATE_MANAGE, |
| 22 MANAGE_PASSWORD_ITEM_STATE_DELETED |
| 23 }; |
| 24 |
| 25 // Protocol for items that have two dynamic columns. |
| 26 @protocol PasswordItemTwoColumnView<NSObject> |
| 27 // Resize the subelements according to cummulative column's sizes across all the |
| 28 // rows. |
| 29 - (void)layoutWithFirstColumn:(CGFloat)firstWidth |
| 30 secondColumn:(CGFloat)secondWidth; |
| 31 |
| 32 @property(readonly, nonatomic) CGFloat firstColumnWidth; |
| 33 @property(readonly, nonatomic) CGFloat secondColumnWidth; |
| 34 @end |
| 35 |
| 36 // Shows the option to undelete a password. |
| 37 @interface UndoPasswordItemView : NSView<PasswordItemTwoColumnView> { |
| 38 @private |
| 39 base::scoped_nsobject<NSTextField> label_; |
| 40 base::scoped_nsobject<NSButton> undoButton_; |
| 41 } |
| 42 - (id)initWithTarget:(id)target action:(SEL)action; |
| 43 @end |
| 44 |
| 45 @interface UndoPasswordItemView (Testing) |
| 46 @property(readonly) NSButton* undoButton; |
| 47 @end |
| 48 |
| 49 // Shows a username, obscured password, and delete button in a single row. |
| 50 @interface ManagePasswordItemView : NSView<PasswordItemTwoColumnView> { |
| 51 @private |
| 52 base::scoped_nsobject<NSTextField> usernameField_; |
| 53 // The field contains the password or IDP origin for federated credentials. |
| 54 base::scoped_nsobject<NSTextField> passwordField_; |
| 55 base::scoped_nsobject<HoverImageButton> deleteButton_; |
| 56 } |
| 57 - (id)initWithForm:(const autofill::PasswordForm&)form |
| 58 target:(id)target |
| 59 action:(SEL)action; |
| 60 @end |
| 61 |
| 62 @interface ManagePasswordItemView (Testing) |
| 63 @property(readonly) NSTextField* usernameField; |
| 64 @property(readonly) NSTextField* passwordField; |
| 65 @property(readonly) NSButton* deleteButton; |
| 66 @end |
| 67 |
| 68 // Shows a username and obscured password in a single row. |
| 69 @interface PendingPasswordItemView : NSView<PasswordItemTwoColumnView> { |
| 70 @private |
| 71 base::scoped_nsobject<NSTextField> usernameField_; |
| 72 // The field contains the password or IDP origin for federated credentials. |
| 73 base::scoped_nsobject<NSTextField> passwordField_; |
| 74 } |
| 75 - (id)initWithForm:(const autofill::PasswordForm&)form; |
| 76 @end |
| 77 |
| 78 @interface PendingPasswordItemView (Testing) |
| 79 @property(readonly) NSTextField* usernameField; |
| 80 @property(readonly) NSSecureTextField* passwordField; |
| 81 @end |
| 82 |
| 83 // Shows a single item in a password management list. Transitions between |
| 84 // PENDING, MANAGE, and DELETED states according to user interaction. |
| 85 @interface ManagePasswordItemViewController |
| 86 : NSViewController<PasswordItemTwoColumnView> { |
| 87 @private |
| 88 id<PasswordItemDelegate> delegate_; // weak |
| 89 const autofill::PasswordForm* passwordForm_; |
| 90 ManagePasswordItemState state_; |
| 91 base::scoped_nsobject<NSView<PasswordItemTwoColumnView>> contentView_; |
| 92 } |
| 93 - (id)initWithDelegate:(id<PasswordItemDelegate>)delegate |
| 94 passwordForm:(const autofill::PasswordForm*)passwordForm; |
| 95 @end |
| 96 |
| 97 @interface ManagePasswordItemViewController (Testing) |
| 98 @property(readonly) ManagePasswordItemState state; |
| 99 @property(readonly) NSView* contentView; |
| 100 @end |
| 101 |
| 102 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_ITEM_VIEWS_H_ |
OLD | NEW |