1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
7 #include "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge.h"
9 #include "base/logging.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
11 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h"
12 #include "ui/gfx/geometry/size.h"
16 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge(
17 PasswordGenerationPopupController* controller) {
19 [[PasswordGenerationPopupViewCocoa alloc]
20 initWithController:controller
24 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() {
25 [view_ controllerDestroyed];
29 void PasswordGenerationPopupViewBridge::Hide() {
33 void PasswordGenerationPopupViewBridge::Show() {
37 gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() {
38 return gfx::Size(NSSizeToCGSize([view_ preferredSize]));
41 void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() {
42 [view_ updateBoundsAndRedrawPopup];
45 void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() {
46 [view_ setNeedsDisplay:YES];
49 bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds(
50 const gfx::Point& point) {
51 return [view_ isPointInPasswordBounds:NSPointFromCGPoint(point.ToCGPoint())];
54 PasswordGenerationPopupView* PasswordGenerationPopupView::Create(
55 PasswordGenerationPopupController* controller) {
56 return new PasswordGenerationPopupViewBridge(controller);
59 } // namespace autofill