Chromium Code Reviews| Index: chrome/browser/ui/cocoa/passwords/credential_item_view.h |
| diff --git a/chrome/browser/ui/cocoa/passwords/credential_item_view.h b/chrome/browser/ui/cocoa/passwords/credential_item_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b502d1b4e61ad400e5d99d04d7c53155d4f7011a |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/passwords/credential_item_view.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_ |
| +#define CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_ |
| + |
| +#import <Cocoa/Cocoa.h> |
| + |
| +#import "base/mac/scoped_nsobject.h" |
| +#include "components/autofill/core/common/password_form.h" |
| +#include "components/password_manager/content/common/credential_manager_types.h" |
| + |
| +class GURL; |
| + |
| +@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.
|
| + |
| +// Handles user interaction with and image fetching for a CredentialItemView. |
| +@protocol CredentialItemDelegate<NSObject> |
| + |
| +// Retrieves the image located at |avatarURL| and updates |view| by calling |
| +// [CredentialItemView updateAvatar:] if successful. |
| +- (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemView*)view; |
| + |
| +@end |
| + |
| +// A view to show a single account credential. |
| +@interface CredentialItemView : NSView { |
| + autofill::PasswordForm passwordForm_; |
| + password_manager::CredentialType credentialType_; |
| + 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
|
| + base::scoped_nsobject<NSTextField> usernameLabel_; |
| + base::scoped_nsobject<NSImageView> avatarView_; |
| + 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.
|
| +} |
| + |
| +@property(nonatomic, readonly) autofill::PasswordForm passwordForm; |
| +@property(nonatomic, readonly) password_manager::CredentialType credentialType; |
| + |
| +// Initializes an item view populated with the data in |passwordForm|. Uses |
| +// |delegate| to asynchronously fetch the avatar image. |
| +- (id)initWithPasswordForm:(const autofill::PasswordForm&)passwordForm |
| + credentialType:(password_manager::CredentialType)credentialType |
| + delegate:(id<CredentialItemDelegate>)delegate; |
| + |
| +// Sets a custom avatar for this item. The image should be scaled and cropped |
| +// to a circle of size |kAvatarImageSize|, otherwise it will look ridiculous. |
| +- (void)updateAvatar:(NSImage*)avatar; |
| + |
| +// The default avatar image, used when a custom one is not set. |
| ++ (NSImage*)defaultAvatar; |
| + |
| +@end |
| + |
| +#endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_CREDENTIAL_ITEM_VIEW_H_ |