Update Mac password generation autofill popup to match latest mocks.

Screenshots available on the bug.

BUG=394303

Review URL: https://codereview.chromium.org/487193003

Cr-Commit-Position: refs/heads/master@{#291389}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291389 0039d316-1c4b-4281-b951-d872f2087c98
parent bfaf1a9e
...@@ -22,6 +22,9 @@ class PasswordGenerationPopupController : public AutofillPopupViewDelegate { ...@@ -22,6 +22,9 @@ class PasswordGenerationPopupController : public AutofillPopupViewDelegate {
// Spacing between the border of the popup and any text. // Spacing between the border of the popup and any text.
static const int kHorizontalPadding = 10; static const int kHorizontalPadding = 10;
// Desired height of the password section.
static const int kPopupPasswordSectionHeight = 62;
// Called by the view when the saved passwords link is clicked. // Called by the view when the saved passwords link is clicked.
virtual void OnSavedPasswordsLinkClicked() = 0; virtual void OnSavedPasswordsLinkClicked() = 0;
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h" #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h" #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h"
#include "ui/base/cocoa/window_size_constants.h" #include "ui/gfx/size.h"
#include "ui/gfx/rect.h"
namespace autofill { namespace autofill {
...@@ -36,8 +35,7 @@ void PasswordGenerationPopupViewBridge::Show() { ...@@ -36,8 +35,7 @@ void PasswordGenerationPopupViewBridge::Show() {
} }
gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() { gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() {
// TODO(gcasto): Implement this function. return gfx::Size(NSSizeToCGSize([view_ preferredSize]));
return gfx::Size();
} }
void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() {
...@@ -50,8 +48,7 @@ void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { ...@@ -50,8 +48,7 @@ void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() {
bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds( bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds(
const gfx::Point& point) { const gfx::Point& point) {
// TODO(gcasto): Implement this function. return [view_ isPointInPasswordBounds:NSPointFromCGPoint(point.ToCGPoint())];
return true;
} }
PasswordGenerationPopupView* PasswordGenerationPopupView::Create( PasswordGenerationPopupView* PasswordGenerationPopupView::Create(
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "chrome/browser/ui/autofill/password_generation_popup_controller.h" #include "chrome/browser/ui/autofill/password_generation_popup_controller.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h" #import "chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h"
...@@ -23,9 +24,12 @@ class AutofillPopupController; ...@@ -23,9 +24,12 @@ class AutofillPopupController;
// The cross-platform controller for this view. // The cross-platform controller for this view.
__weak autofill::PasswordGenerationPopupController* controller_; __weak autofill::PasswordGenerationPopupController* controller_;
__weak NSTextField* passwordField_; base::scoped_nsobject<NSView> passwordSection_;
__weak NSTextField* passwordSubtextField_; base::scoped_nsobject<NSTextField> passwordField_;
__weak HyperlinkTextView* helpTextView_; base::scoped_nsobject<NSTextField> passwordTitleField_;
base::scoped_nsobject<NSImageView> keyIcon_;
base::scoped_nsobject<NSBox> divider_;
base::scoped_nsobject<HyperlinkTextView> helpTextView_;
} }
// Designated initializer. // Designated initializer.
...@@ -33,10 +37,17 @@ class AutofillPopupController; ...@@ -33,10 +37,17 @@ class AutofillPopupController;
(autofill::PasswordGenerationPopupController*)controller (autofill::PasswordGenerationPopupController*)controller
frame:(NSRect)frame; frame:(NSRect)frame;
// Determines whether |point| falls inside the password section of the popup.
// |point| needs to be in the popup's coordinate system.
- (BOOL)isPointInPasswordBounds:(NSPoint)point;
// Informs the view that its controller has been (or will imminently be) // Informs the view that its controller has been (or will imminently be)
// destroyed. // destroyed.
- (void)controllerDestroyed; - (void)controllerDestroyed;
// The preferred size for the popup.
- (NSSize)preferredSize;
@end @end
#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_COCOA_H_ #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_COCOA_H_
...@@ -25,7 +25,6 @@ namespace { ...@@ -25,7 +25,6 @@ namespace {
// The amount of whitespace that is present when there is no padding. Used // The amount of whitespace that is present when there is no padding. Used
// to get the proper spacing in the help section. // to get the proper spacing in the help section.
const int kHelpVerticalOffset = 5; const int kHelpVerticalOffset = 5;
const int kPasswordSectionHeight = 62;
// Wrapper around just the text portions of the generation UI (password and // Wrapper around just the text portions of the generation UI (password and
// prompting text). // prompting text).
...@@ -173,7 +172,8 @@ gfx::Size PasswordGenerationPopupViewViews::GetPreferredSizeOfPasswordView() { ...@@ -173,7 +172,8 @@ gfx::Size PasswordGenerationPopupViewViews::GetPreferredSizeOfPasswordView() {
int height = kPopupBorderThickness; int height = kPopupBorderThickness;
if (controller_->display_password()) { if (controller_->display_password()) {
// Add divider height as well. // Add divider height as well.
height += kPasswordSectionHeight + 1; height +=
PasswordGenerationPopupController::kPopupPasswordSectionHeight + 1;
} }
int width = controller_->GetMinimumWidth(); int width = controller_->GetMinimumWidth();
int popup_width = width - 2 * kPopupBorderThickness; int popup_width = width - 2 * kPopupBorderThickness;
...@@ -217,7 +217,10 @@ void PasswordGenerationPopupViewViews::Layout() { ...@@ -217,7 +217,10 @@ void PasswordGenerationPopupViewViews::Layout() {
// it), but it can't change the other way around. // it), but it can't change the other way around.
CreatePasswordView(); CreatePasswordView();
password_view_->SetBounds( password_view_->SetBounds(
kPopupBorderThickness, y, popup_width, kPasswordSectionHeight); kPopupBorderThickness,
y,
popup_width,
PasswordGenerationPopupController::kPopupPasswordSectionHeight);
divider_bounds_ = divider_bounds_ =
gfx::Rect(kPopupBorderThickness, password_view_->bounds().bottom(), gfx::Rect(kPopupBorderThickness, password_view_->bounds().bottom(),
popup_width, 1); popup_width, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment