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_CREDENTIAL_ITEM_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #import "base/mac/scoped_nsobject.h" | |
11 #include "components/autofill/core/common/password_form.h" | |
12 #include "components/password_manager/content/common/credential_manager_types.h" | |
13 | |
14 class GURL; | |
15 | |
16 @class CredentialItemView; | |
groby-ooo-7-16
2015/03/03 17:34:33
We usually combine class/@class forward decls into
dconnelly
2015/03/04 12:30:54
Done.
| |
17 | |
18 // Handles user interaction with and image fetching for a CredentialItemView. | |
19 @protocol CredentialItemDelegate<NSObject> | |
20 | |
21 // Retrieves the image located at |avatarURL| and updates |view| by calling | |
22 // [CredentialItemView updateAvatar:] if successful. | |
23 - (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemView*)view; | |
24 | |
25 @end | |
26 | |
27 // A view to show a single account credential. | |
28 @interface CredentialItemView : NSView { | |
29 autofill::PasswordForm passwordForm_; | |
30 password_manager::CredentialType credentialType_; | |
31 base::scoped_nsobject<NSTextField> nameLabel_; | |
groby-ooo-7-16
2015/03/03 17:34:33
Do we want to refcount here? (I know, I contradict
dconnelly
2015/03/04 12:30:54
I've removed the scoping to match the other review
groby-ooo-7-16
2015/03/04 16:17:59
Well, they're not entirely free :) I don't have a
| |
32 base::scoped_nsobject<NSTextField> usernameLabel_; | |
33 base::scoped_nsobject<NSImageView> avatarView_; | |
34 id<CredentialItemDelegate> delegate_; | |
groby-ooo-7-16
2015/03/03 17:34:33
Do you want scoped_nsprotocol here? (I.e. do we wa
dconnelly
2015/03/04 12:30:54
ManagePasswordsBubbleAccountChooserViewController,
groby-ooo-7-16
2015/03/04 16:17:59
Acknowledged.
| |
35 } | |
36 | |
37 @property(nonatomic, readonly) autofill::PasswordForm passwordForm; | |
38 @property(nonatomic, readonly) password_manager::CredentialType credentialType; | |
39 | |
40 // Initializes an item view populated with the data in |passwordForm|. Uses | |
41 // |delegate| to asynchronously fetch the avatar image. | |
42 - (id)initWithPasswordForm:(const autofill::PasswordForm&)passwordForm | |
43 credentialType:(password_manager::CredentialType)credentialType | |
44 delegate:(id<CredentialItemDelegate>)delegate; | |
45 | |
46 // Sets a custom avatar for this item. The image should be scaled and cropped | |
47 // to a circle of size |kAvatarImageSize|, otherwise it will look ridiculous. | |
48 - (void)updateAvatar:(NSImage*)avatar; | |
49 | |
50 // The default avatar image, used when a custom one is not set. | |
51 + (NSImage*)defaultAvatar; | |
52 | |
53 @end | |
54 | |
55 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_ | |
OLD | NEW |