OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_view_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/chrome_style.h" | 10 #include "chrome/browser/ui/chrome_style.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // for this site" message. | 70 // for this site" message. |
71 NSView* contentView = nil; | 71 NSView* contentView = nil; |
72 if (self.model->local_credentials().empty()) { | 72 if (self.model->local_credentials().empty()) { |
73 const CGFloat noPasswordsWidth = std::max( | 73 const CGFloat noPasswordsWidth = std::max( |
74 kDesiredBubbleWidth - 2 * kFramePadding, NSWidth([titleLabel frame])); | 74 kDesiredBubbleWidth - 2 * kFramePadding, NSWidth([titleLabel frame])); |
75 noPasswordsView_.reset( | 75 noPasswordsView_.reset( |
76 [[NoPasswordsView alloc] initWithWidth:noPasswordsWidth]); | 76 [[NoPasswordsView alloc] initWithWidth:noPasswordsWidth]); |
77 contentView = noPasswordsView_.get(); | 77 contentView = noPasswordsView_.get(); |
78 } else { | 78 } else { |
79 passwordsListController_.reset([[PasswordsListViewController alloc] | 79 passwordsListController_.reset([[PasswordsListViewController alloc] |
80 initWithModel:self.model | 80 initWithModelAndForms:self.model |
81 forms:self.model->local_credentials().get()]); | 81 forms:&self.model->local_credentials()]); |
82 contentView = [passwordsListController_ view]; | 82 contentView = [passwordsListController_ view]; |
83 } | 83 } |
84 [view addSubview:contentView]; | 84 [view addSubview:contentView]; |
85 | 85 |
86 // Wrap the title if necessary to match the width of the content view. | 86 // Wrap the title if necessary to match the width of the content view. |
87 if (NSWidth([titleLabel frame]) > NSWidth([contentView frame])) { | 87 if (NSWidth([titleLabel frame]) > NSWidth([contentView frame])) { |
88 [titleLabel setFrameSize:NSMakeSize(NSWidth([contentView frame]), 0)]; | 88 [titleLabel setFrameSize:NSMakeSize(NSWidth([contentView frame]), 0)]; |
89 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:titleLabel]; | 89 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:titleLabel]; |
90 } | 90 } |
91 | 91 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 - (NoPasswordsView*)noPasswordsView { | 175 - (NoPasswordsView*)noPasswordsView { |
176 return noPasswordsView_.get(); | 176 return noPasswordsView_.get(); |
177 } | 177 } |
178 | 178 |
179 - (PasswordsListViewController*)passwordsListController { | 179 - (PasswordsListViewController*)passwordsListController { |
180 return passwordsListController_.get(); | 180 return passwordsListController_.get(); |
181 } | 181 } |
182 | 182 |
183 @end | 183 @end |
OLD | NEW |