| Index: chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.mm
|
| index c674a6a35306cce386f719433a5c0b3719738361..9b40159090d6382d9f4d25c9af62dda6d158b784 100644
|
| --- a/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.mm
|
| @@ -36,24 +36,12 @@
|
| }
|
| @end
|
|
|
| -@interface ManagePasswordsBubbleManageViewController ()
|
| +@interface ManagePasswordsViewController ()
|
| - (void)onDoneClicked:(id)sender;
|
| - (void)onManageClicked:(id)sender;
|
| @end
|
|
|
| -@implementation ManagePasswordsBubbleManageViewController
|
| -
|
| -- (NSButton*)defaultButton {
|
| - return doneButton_;
|
| -}
|
| -
|
| -- (id)initWithModel:(ManagePasswordsBubbleModel*)model
|
| - delegate:(id<ManagePasswordsBubbleContentViewDelegate>)delegate {
|
| - if (([super initWithDelegate:delegate])) {
|
| - model_ = model;
|
| - }
|
| - return self;
|
| -}
|
| +@implementation ManagePasswordsViewController
|
|
|
| - (void)loadView {
|
| base::scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]);
|
| @@ -74,14 +62,14 @@
|
|
|
| // Create the elements and add them to the view.
|
| NSTextField* titleLabel =
|
| - [self addTitleLabel:base::SysUTF16ToNSString(model_->title())
|
| + [self addTitleLabel:base::SysUTF16ToNSString(self.model->title())
|
| toView:view];
|
|
|
| // Content. If we have a list of passwords to store for the current site, we
|
| // display them to the user for management. Otherwise, we show a "No passwords
|
| // for this site" message.
|
| NSView* contentView = nil;
|
| - if (model_->local_credentials().empty()) {
|
| + if (self.model->local_credentials().empty()) {
|
| const CGFloat noPasswordsWidth = std::max(
|
| kDesiredBubbleWidth - 2 * kFramePadding, NSWidth([titleLabel frame]));
|
| noPasswordsView_.reset(
|
| @@ -89,8 +77,8 @@
|
| contentView = noPasswordsView_.get();
|
| } else {
|
| passwordsListController_.reset([[PasswordsListViewController alloc]
|
| - initWithModel:model_
|
| - forms:model_->local_credentials().get()]);
|
| + initWithModel:self.model
|
| + forms:self.model->local_credentials().get()]);
|
| contentView = [passwordsListController_ view];
|
| }
|
| [view addSubview:contentView];
|
| @@ -110,7 +98,7 @@
|
| // Manage button.
|
| manageButton_.reset([[NSButton alloc] initWithFrame:NSZeroRect]);
|
| base::scoped_nsobject<HyperlinkButtonCell> cell([[HyperlinkButtonCell alloc]
|
| - initTextCell:base::SysUTF16ToNSString(model_->manage_link())]);
|
| + initTextCell:base::SysUTF16ToNSString(self.model->manage_link())]);
|
| [cell setControlSize:NSSmallControlSize];
|
| [cell setTextColor:skia::SkColorToCalibratedNSColor(
|
| chrome_style::GetLinkColor())];
|
| @@ -153,18 +141,28 @@
|
| }
|
|
|
| - (void)onDoneClicked:(id)sender {
|
| - model_->OnDoneClicked();
|
| - [delegate_ viewShouldDismiss];
|
| + if (self.model)
|
| + self.model->OnDoneClicked();
|
| + [self.delegate viewShouldDismiss];
|
| }
|
|
|
| - (void)onManageClicked:(id)sender {
|
| - model_->OnManageLinkClicked();
|
| - [delegate_ viewShouldDismiss];
|
| + if (self.model)
|
| + self.model->OnManageLinkClicked();
|
| + [self.delegate viewShouldDismiss];
|
| +}
|
| +
|
| +- (ManagePasswordsBubbleModel*)model {
|
| + return [self.delegate model];
|
| +}
|
| +
|
| +- (NSButton*)defaultButton {
|
| + return doneButton_;
|
| }
|
|
|
| @end
|
|
|
| -@implementation ManagePasswordsBubbleManageViewController (Testing)
|
| +@implementation ManagePasswordsViewController (Testing)
|
|
|
| - (NSButton*)doneButton {
|
| return doneButton_.get();
|
|
|