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 {
// Spacing between the border of the popup and any text.
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.
virtual void OnSavedPasswordsLinkClicked() = 0;
......
......@@ -9,8 +9,7 @@
#include "base/logging.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
#import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h"
#include "ui/base/cocoa/window_size_constants.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
namespace autofill {
......@@ -36,8 +35,7 @@ void PasswordGenerationPopupViewBridge::Show() {
}
gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() {
// TODO(gcasto): Implement this function.
return gfx::Size();
return gfx::Size(NSSizeToCGSize([view_ preferredSize]));
}
void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() {
......@@ -50,8 +48,7 @@ void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() {
bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds(
const gfx::Point& point) {
// TODO(gcasto): Implement this function.
return true;
return [view_ isPointInPasswordBounds:NSPointFromCGPoint(point.ToCGPoint())];
}
PasswordGenerationPopupView* PasswordGenerationPopupView::Create(
......
......@@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "chrome/browser/ui/autofill/password_generation_popup_controller.h"
#import "chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h"
......@@ -23,9 +24,12 @@ class AutofillPopupController;
// The cross-platform controller for this view.
__weak autofill::PasswordGenerationPopupController* controller_;
__weak NSTextField* passwordField_;
__weak NSTextField* passwordSubtextField_;
__weak HyperlinkTextView* helpTextView_;
base::scoped_nsobject<NSView> passwordSection_;
base::scoped_nsobject<NSTextField> passwordField_;
base::scoped_nsobject<NSTextField> passwordTitleField_;
base::scoped_nsobject<NSImageView> keyIcon_;
base::scoped_nsobject<NSBox> divider_;
base::scoped_nsobject<HyperlinkTextView> helpTextView_;
}
// Designated initializer.
......@@ -33,10 +37,17 @@ class AutofillPopupController;
(autofill::PasswordGenerationPopupController*)controller
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)
// destroyed.
- (void)controllerDestroyed;
// The preferred size for the popup.
- (NSSize)preferredSize;
@end
#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_PASSWORD_GENERATION_POPUP_VIEW_COCOA_H_
......@@ -25,7 +25,6 @@ namespace {
// The amount of whitespace that is present when there is no padding. Used
// to get the proper spacing in the help section.
const int kHelpVerticalOffset = 5;
const int kPasswordSectionHeight = 62;
// Wrapper around just the text portions of the generation UI (password and
// prompting text).
......@@ -173,7 +172,8 @@ gfx::Size PasswordGenerationPopupViewViews::GetPreferredSizeOfPasswordView() {
int height = kPopupBorderThickness;
if (controller_->display_password()) {
// Add divider height as well.
height += kPasswordSectionHeight + 1;
height +=
PasswordGenerationPopupController::kPopupPasswordSectionHeight + 1;
}
int width = controller_->GetMinimumWidth();
int popup_width = width - 2 * kPopupBorderThickness;
......@@ -217,7 +217,10 @@ void PasswordGenerationPopupViewViews::Layout() {
// it), but it can't change the other way around.
CreatePasswordView();
password_view_->SetBounds(
kPopupBorderThickness, y, popup_width, kPasswordSectionHeight);
kPopupBorderThickness,
y,
popup_width,
PasswordGenerationPopupController::kPopupPasswordSectionHeight);
divider_bounds_ =
gfx::Rect(kPopupBorderThickness, password_view_->bounds().bottom(),
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