Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #import "chrome/browser/ui/cocoa/passwords/base_passwords_content_view_controlle r.h" | |
| 12 #import "chrome/browser/ui/cocoa/passwords/credential_item_view.h" | 11 #import "chrome/browser/ui/cocoa/passwords/credential_item_view.h" |
| 13 | 12 |
| 14 @class AccountAvatarFetcherManager; | 13 @class AccountAvatarFetcherManager; |
| 15 @class BubbleCombobox; | 14 |
| 16 class ManagePasswordsBubbleModel; | 15 namespace net { |
| 17 @class ManagePasswordCredentialItemViewController; | 16 class URLRequestContextGetter; |
| 17 } | |
| 18 class PasswordDialogController; | |
|
vabr (Chromium)
2016/01/21 10:02:10
nit: I would move line 18 above the "namespace net
vasilii
2016/01/21 12:48:50
Done.
| |
| 18 | 19 |
| 19 // A custom cell that displays a credential item in an NSTableView. | 20 // A custom cell that displays a credential item in an NSTableView. |
| 20 @interface CredentialItemCell : NSCell | 21 @interface CredentialItemCell : NSCell |
| 21 - (id)initWithView:(CredentialItemView*)view; | 22 - (id)initWithView:(CredentialItemView*)view; |
| 22 @property(nonatomic, readonly) CredentialItemView* view; | 23 @property(nonatomic, readonly) CredentialItemView* view; |
| 23 @end | 24 @end |
| 24 | 25 |
| 26 // An interface for the bridge between AccountChooserViewController and platform | |
| 27 // independent UI code. | |
| 28 class AccountChooserBridge { | |
| 29 public: | |
| 30 // Closes the dialog. | |
| 31 virtual void PerformClose() = 0; | |
| 32 | |
| 33 // Returns the controller containing the data. | |
| 34 virtual PasswordDialogController* GetDialogController() = 0; | |
| 35 | |
| 36 // Returns the request context for fetching the avatars. | |
| 37 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; | |
| 38 protected: | |
|
vabr (Chromium)
2016/01/21 10:02:09
nit: Blank line above.
vasilii
2016/01/21 12:48:50
Done.
| |
| 39 virtual ~AccountChooserBridge() = default; | |
| 40 }; | |
| 41 | |
| 25 // Manages a view that shows a list of credentials that can be used for | 42 // Manages a view that shows a list of credentials that can be used for |
| 26 // authentication to a site. | 43 // authentication to a site. |
| 27 @interface ManagePasswordsBubbleAccountChooserViewController | 44 @interface AccountChooserViewController |
| 28 : ManagePasswordsBubbleContentViewController<CredentialItemDelegate, | 45 : NSViewController<CredentialItemDelegate, |
| 29 NSTableViewDataSource, | 46 NSTableViewDataSource, |
| 30 NSTableViewDelegate> { | 47 NSTableViewDelegate, |
| 48 NSTextViewDelegate> { | |
| 31 @private | 49 @private |
| 32 ManagePasswordsBubbleModel* model_; // Weak. | 50 AccountChooserBridge* bridge_; // Weak. |
| 33 NSButton* cancelButton_; // Weak. | 51 NSButton* cancelButton_; // Weak. |
| 34 BubbleCombobox* moreButton_; // Weak. | |
| 35 NSTableView* credentialsView_; // Weak. | 52 NSTableView* credentialsView_; // Weak. |
| 53 NSTextView* titleView_; // Weak. | |
| 36 base::scoped_nsobject<NSArray> credentialItems_; | 54 base::scoped_nsobject<NSArray> credentialItems_; |
| 37 base::scoped_nsobject<AccountAvatarFetcherManager> avatarManager_; | 55 base::scoped_nsobject<AccountAvatarFetcherManager> avatarManager_; |
| 38 } | 56 } |
| 39 | 57 |
| 40 // Initializes a new account chooser and populates it with the credentials | 58 // Initializes a new account chooser and populates it with the credentials |
| 41 // stored in |model|. Designated initializer. | 59 // stored in |bridge->controller()|. |
| 42 - (id)initWithModel:(ManagePasswordsBubbleModel*)model | 60 - (id)initWithBridge:(AccountChooserBridge*)bridge; |
| 43 delegate:(id<ManagePasswordsBubbleContentViewDelegate>)delegate; | 61 @end |
| 62 | |
| 63 @interface AccountChooserViewController(Testing) | |
| 64 - (id)initWithBridge:(AccountChooserBridge*)bridge | |
| 65 avatarManager:(AccountAvatarFetcherManager*)avatarManager; | |
| 66 @property(nonatomic, readonly) NSButton* cancelButton; | |
| 67 @property(nonatomic, readonly) NSTableView* credentialsView; | |
| 68 @property(nonatomic, readonly) NSTextView* titleView; | |
| 44 @end | 69 @end |
| 45 | 70 |
| 46 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ | 71 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ |
| OLD | NEW |