Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7442)

Unified Diff: chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm

Issue 1645503002: Remove dangling ManagePasswordsBubbleModel pointers. Test that different password bubbles don't pin… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm
diff --git a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm
index 96fbd4a85fdaa35dad9405b4b3b542d785d7f247..8b525be853e28f51e202e22883262160516b239b 100644
--- a/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/confirmation_password_saved_view_controller.mm
@@ -18,34 +18,32 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font_list.h"
-@interface ManagePasswordsBubbleConfirmationViewController ()
+@interface ConfirmationPasswordSavedViewController ()
- (void)onOKClicked:(id)sender;
@end
-@implementation ManagePasswordsBubbleConfirmationViewController
-
-- (id)initWithModel:(ManagePasswordsBubbleModel*)model
- delegate:(id<ManagePasswordsBubbleContentViewDelegate>)delegate {
- if (([super initWithDelegate:delegate])) {
- model_ = model;
- }
- return self;
-}
+@implementation ConfirmationPasswordSavedViewController
- (NSButton*)defaultButton {
return okButton_;
}
+- (ManagePasswordsBubbleModel*)model {
+ return [self.delegate model];
+}
+
- (void)onOKClicked:(id)sender {
- model_->OnOKClicked();
- [delegate_ viewShouldDismiss];
+ if (self.model)
+ self.model->OnOKClicked();
+ [self.delegate viewShouldDismiss];
}
- (BOOL)textView:(NSTextView*)textView
clickedOnLink:(id)link
atIndex:(NSUInteger)charIndex {
- model_->OnManageLinkClicked();
- [delegate_ viewShouldDismiss];
+ if (self.model)
+ self.model->OnManageLinkClicked();
+ [self.delegate viewShouldDismiss];
return YES;
}
@@ -64,7 +62,7 @@
// Title.
NSTextField* titleLabel =
- [self addTitleLabel:base::SysUTF16ToNSString(model_->title())
+ [self addTitleLabel:base::SysUTF16ToNSString(self.model->title())
toView:view];
// Text.
@@ -74,14 +72,14 @@
.GetPrimaryFont()
.GetNativeFont();
NSColor* textColor = [NSColor blackColor];
- [confirmationText_
- setMessage:base::SysUTF16ToNSString(model_->save_confirmation_text())
- withFont:font
- messageColor:textColor];
+ [confirmationText_ setMessage:base::SysUTF16ToNSString(
+ self.model->save_confirmation_text())
+ withFont:font
+ messageColor:textColor];
NSColor* linkColor =
skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
[confirmationText_
- addLinkRange:model_->save_confirmation_link_range().ToNSRange()
+ addLinkRange:self.model->save_confirmation_link_range().ToNSRange()
withURL:nil
linkColor:linkColor];
[confirmationText_ setDelegate:self];
@@ -97,7 +95,7 @@
NSTextStorage* text = [confirmationText_ textStorage];
[text addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:NSUnderlineStyleNone]
- range:model_->save_confirmation_link_range().ToNSRange()];
+ range:self.model->save_confirmation_link_range().ToNSRange()];
[view addSubview:confirmationText_];
// OK button.
@@ -132,7 +130,7 @@
@end
-@implementation ManagePasswordsBubbleConfirmationViewController (Testing)
+@implementation ConfirmationPasswordSavedViewController (Testing)
- (HyperlinkTextView*)confirmationText {
return confirmationText_.get();

Powered by Google App Engine
This is Rietveld 408576698