Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / passwords / manage_password_item_view_controller.h
1 // Copyright 2014 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_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "base/mac/scoped_nsobject.h"
11 #include "components/password_manager/core/common/password_manager_ui.h"
12
13 namespace autofill {
14 struct PasswordForm;
15 }  // namespace autofill
16
17 class ManagePasswordsBubbleModel;
18
19 // The state of the password item.
20 enum ManagePasswordItemState {
21   MANAGE_PASSWORD_ITEM_STATE_PENDING,
22   MANAGE_PASSWORD_ITEM_STATE_MANAGE,
23   MANAGE_PASSWORD_ITEM_STATE_DELETED
24 };
25
26 // Shows a username and obscured password in a single row.
27 @interface ManagePasswordItemPendingView : NSView {
28  @private
29   base::scoped_nsobject<NSTextField> usernameField_;
30   base::scoped_nsobject<NSSecureTextField> passwordField_;
31 }
32 - (id)initWithForm:(const autofill::PasswordForm&)form;
33 @end
34
35 @interface ManagePasswordItemPendingView (Testing)
36 @property(readonly) NSTextField* usernameField;
37 @property(readonly) NSSecureTextField* passwordField;
38 @end
39
40 // Shows a single item in a password management list. Transitions between
41 // PENDING, MANAGE, and DELETED states according to user interaction.
42 @interface ManagePasswordItemViewController : NSViewController {
43  @private
44   ManagePasswordsBubbleModel* model_;  // weak
45   ManagePasswordItemState state_;
46   password_manager::ui::PasswordItemPosition position_;
47   base::scoped_nsobject<NSView> contentView_;
48   CGFloat minWidth_;
49 }
50 - (id)initWithModel:(ManagePasswordsBubbleModel*)model
51            position:(password_manager::ui::PasswordItemPosition)position
52            minWidth:(CGFloat)minWidth;
53 @end
54
55 @interface ManagePasswordItemViewController (Testing)
56 @property(readonly) ManagePasswordItemState state;
57 @property(readonly) NSView* contentView;
58 @end
59
60 #endif  // CHROME_BROWSER_UI_COCOA_PASSWORDS_MANAGE_PASSWORD_ITEM_VIEW_CONTROLLER_H_