Index: chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller.h |
diff --git a/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller.h b/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller.h |
index 3e2037541d0793c3f9ba8b6d06b7d0584ad9f64b..438d00a5e75e04275859dfdfe4dfb61869108e1e 100644 |
--- a/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller.h |
+++ b/chrome/browser/ui/cocoa/passwords/manage_password_item_view_controller.h |
@@ -5,100 +5,46 @@ |
#ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_ |
#define CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_ |
+#include <vector> |
+ |
#import <Cocoa/Cocoa.h> |
#import "base/mac/scoped_nsobject.h" |
-#include "components/autofill/core/common/password_form.h" |
-#include "components/password_manager/core/common/password_manager_ui.h" |
-#import "ui/base/cocoa/tracking_area.h" |
namespace autofill { |
struct PasswordForm; |
} // namespace autofill |
-@class HoverImageButton; |
class ManagePasswordsBubbleModel; |
-// The state of the password item. |
-enum ManagePasswordItemState { |
- MANAGE_PASSWORD_ITEM_STATE_PENDING, |
- MANAGE_PASSWORD_ITEM_STATE_MANAGE, |
- MANAGE_PASSWORD_ITEM_STATE_DELETED |
-}; |
- |
-// Abstract superclass for items that are clickable. Highlights on hover. |
-@interface ManagePasswordItemClickableView : NSView { |
- @private |
- BOOL hovering_; |
- ui::ScopedCrTrackingArea trackingArea_; |
-} |
-@end |
- |
-// Shows the option to undelete a password. |
-@interface ManagePasswordItemUndoView : ManagePasswordItemClickableView { |
- @private |
- base::scoped_nsobject<NSButton> undoButton_; |
-} |
-- (id)initWithTarget:(id)target action:(SEL)action; |
-@end |
- |
-@interface ManagePasswordItemUndoView (Testing) |
-@property(readonly) NSButton* undoButton; |
-@end |
- |
-// Shows a username, obscured password, and delete button in a single row. |
-@interface ManagePasswordItemManageView : ManagePasswordItemClickableView { |
- @private |
- base::scoped_nsobject<NSTextField> usernameField_; |
- base::scoped_nsobject<NSSecureTextField> passwordField_; |
- base::scoped_nsobject<HoverImageButton> deleteButton_; |
-} |
-- (id)initWithForm:(const autofill::PasswordForm&)form |
- target:(id)target |
- action:(SEL)action; |
-@end |
+typedef std::vector<const autofill::PasswordForm*> PasswordFormsVector; |
-@interface ManagePasswordItemManageView (Testing) |
-@property(readonly) NSTextField* usernameField; |
-@property(readonly) NSSecureTextField* passwordField; |
-@property(readonly) NSButton* deleteButton; |
-@end |
- |
-// Shows a username and obscured password in a single row. |
-@interface ManagePasswordItemPendingView : NSView { |
- @private |
- base::scoped_nsobject<NSTextField> usernameField_; |
- base::scoped_nsobject<NSSecureTextField> passwordField_; |
- base::scoped_nsobject<NSTextField> federationField_; |
-} |
-- (id)initWithForm:(const autofill::PasswordForm&)form; |
-@end |
+// Handles callbacks from ManagePasswordItemViewController. |
+@protocol PasswordItemDelegate<NSObject> |
+// Retrieves the model |
+@property(readonly, nonatomic) ManagePasswordsBubbleModel* model; |
-@interface ManagePasswordItemPendingView (Testing) |
-@property(readonly) NSTextField* usernameField; |
-@property(readonly) NSSecureTextField* passwordField; |
-@property(readonly) NSTextField* federationField; |
+@property(readonly, nonatomic) CGFloat firstColumnMaxWidth; |
+@property(readonly, nonatomic) CGFloat secondColumnMaxWidth; |
@end |
-// Shows a single item in a password management list. Transitions between |
-// PENDING, MANAGE, and DELETED states according to user interaction. |
-@interface ManagePasswordItemViewController : NSViewController { |
+// Shows a list of usernames/passwords. |
+@interface PasswordsListViewController |
+ : NSViewController<PasswordItemDelegate> { |
@private |
ManagePasswordsBubbleModel* model_; // weak |
- autofill::PasswordForm passwordForm_; |
- ManagePasswordItemState state_; |
- password_manager::ui::PasswordItemPosition position_; |
- base::scoped_nsobject<NSView> contentView_; |
+ // Array of ManagePasswordItemViewController for each row. |
+ base::scoped_nsobject<NSArray> itemViews_; |
+ // Maximum widthes of columns across all the rows. |
+ CGFloat firstColumnMaxWidth_; |
+ CGFloat secondColumnMaxWidth_; |
} |
- (id)initWithModel:(ManagePasswordsBubbleModel*)model |
- passwordForm:(const autofill::PasswordForm&)passwordForm |
- position:(password_manager::ui::PasswordItemPosition)position; |
+ forms:(const PasswordFormsVector&)password_forms; |
@end |
-@interface ManagePasswordItemViewController (Testing) |
-@property(readonly) ManagePasswordItemState state; |
-@property(readonly) NSView* contentView; |
-@property(readonly) autofill::PasswordForm passwordForm; |
+@interface PasswordsListViewController (Testing) |
+@property(readonly) NSArray* itemViews; |
@end |
#endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_ |