Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / passwords / credential_item_view.h
blob8bb1b4f52e837f4ba990ce1425f4d3c395f1effa
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.
5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_
6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "components/autofill/core/common/password_form.h"
12 #include "components/password_manager/core/common/credential_manager_types.h"
14 @class CredentialItemView;
15 class GURL;
17 // Handles user interaction with and image fetching for a CredentialItemView.
18 @protocol CredentialItemDelegate<NSObject>
20 // Retrieves the image located at |avatarURL| and updates |view| by calling
21 // [CredentialItemView updateAvatar:] if successful.
22 - (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemView*)view;
24 @end
26 // A view to show a single account credential.
27 @interface CredentialItemView : NSView {
28 autofill::PasswordForm passwordForm_;
29 password_manager::CredentialType credentialType_;
30 NSTextField* nameLabel_;
31 NSTextField* usernameLabel_;
32 NSImageView* avatarView_;
33 id<CredentialItemDelegate> delegate_; // Weak.
36 @property(nonatomic, readonly) autofill::PasswordForm passwordForm;
37 @property(nonatomic, readonly) password_manager::CredentialType credentialType;
39 // Initializes an item view populated with the data in |passwordForm|. Uses
40 // |delegate| to asynchronously fetch the avatar image.
41 - (id)initWithPasswordForm:(const autofill::PasswordForm&)passwordForm
42 credentialType:(password_manager::CredentialType)credentialType
43 delegate:(id<CredentialItemDelegate>)delegate;
45 // Sets a custom avatar for this item. The image should be scaled and cropped
46 // to a circle of size |kAvatarImageSize|, otherwise it will look ridiculous.
47 - (void)updateAvatar:(NSImage*)avatar;
49 // The default avatar image, used when a custom one is not set.
50 + (NSImage*)defaultAvatar;
52 @end
54 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_