| 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 class PasswordDialogController; |
| 17 @class ManagePasswordCredentialItemViewController; | 16 |
| 17 namespace net { |
| 18 class URLRequestContextGetter; |
| 19 } |
| 18 | 20 |
| 19 // A custom cell that displays a credential item in an NSTableView. | 21 // A custom cell that displays a credential item in an NSTableView. |
| 20 @interface CredentialItemCell : NSCell | 22 @interface CredentialItemCell : NSCell |
| 21 - (id)initWithView:(CredentialItemView*)view; | 23 - (id)initWithView:(CredentialItemView*)view; |
| 22 @property(nonatomic, readonly) CredentialItemView* view; | 24 @property(nonatomic, readonly) CredentialItemView* view; |
| 23 @end | 25 @end |
| 24 | 26 |
| 27 // An interface for the bridge between AccountChooserViewController and platform |
| 28 // independent UI code. |
| 29 class AccountChooserBridge { |
| 30 public: |
| 31 // Closes the dialog. |
| 32 virtual void PerformClose() = 0; |
| 33 |
| 34 // Returns the controller containing the data. |
| 35 virtual PasswordDialogController* GetDialogController() = 0; |
| 36 |
| 37 // Returns the request context for fetching the avatars. |
| 38 virtual net::URLRequestContextGetter* GetRequestContext() const = 0; |
| 39 |
| 40 protected: |
| 41 virtual ~AccountChooserBridge() = default; |
| 42 }; |
| 43 |
| 25 // Manages a view that shows a list of credentials that can be used for | 44 // Manages a view that shows a list of credentials that can be used for |
| 26 // authentication to a site. | 45 // authentication to a site. |
| 27 @interface ManagePasswordsBubbleAccountChooserViewController | 46 @interface AccountChooserViewController |
| 28 : ManagePasswordsBubbleContentViewController<CredentialItemDelegate, | 47 : NSViewController<CredentialItemDelegate, |
| 29 NSTableViewDataSource, | 48 NSTableViewDataSource, |
| 30 NSTableViewDelegate> { | 49 NSTableViewDelegate, |
| 50 NSTextViewDelegate> { |
| 31 @private | 51 @private |
| 32 ManagePasswordsBubbleModel* model_; // Weak. | 52 AccountChooserBridge* bridge_; // Weak. |
| 33 NSButton* cancelButton_; // Weak. | 53 NSButton* cancelButton_; // Weak. |
| 34 BubbleCombobox* moreButton_; // Weak. | |
| 35 NSTableView* credentialsView_; // Weak. | 54 NSTableView* credentialsView_; // Weak. |
| 55 NSTextView* titleView_; // Weak. |
| 36 base::scoped_nsobject<NSArray> credentialItems_; | 56 base::scoped_nsobject<NSArray> credentialItems_; |
| 37 base::scoped_nsobject<AccountAvatarFetcherManager> avatarManager_; | 57 base::scoped_nsobject<AccountAvatarFetcherManager> avatarManager_; |
| 38 } | 58 } |
| 39 | 59 |
| 40 // Initializes a new account chooser and populates it with the credentials | 60 // Initializes a new account chooser and populates it with the credentials |
| 41 // stored in |model|. Designated initializer. | 61 // stored in |bridge->controller()|. |
| 42 - (id)initWithModel:(ManagePasswordsBubbleModel*)model | 62 - (id)initWithBridge:(AccountChooserBridge*)bridge; |
| 43 delegate:(id<ManagePasswordsBubbleContentViewDelegate>)delegate; | 63 @end |
| 64 |
| 65 @interface AccountChooserViewController(Testing) |
| 66 - (id)initWithBridge:(AccountChooserBridge*)bridge |
| 67 avatarManager:(AccountAvatarFetcherManager*)avatarManager; |
| 68 @property(nonatomic, readonly) NSButton* cancelButton; |
| 69 @property(nonatomic, readonly) NSTableView* credentialsView; |
| 70 @property(nonatomic, readonly) NSTextView* titleView; |
| 44 @end | 71 @end |
| 45 | 72 |
| 46 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ | 73 #endif // CHROME_BROWSER_UI_COCOA_PASSWORDS_ACCOUNT_CHOOSER_VIEW_CONTROLLER_H_ |
| OLD | NEW |