Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / autofill / password_generation_popup_view_bridge.mm
blob463ee81dd456152e46647e65d02821dc5031931f
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"
14 namespace autofill {
16 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge(
17     PasswordGenerationPopupController* controller) {
18   view_.reset(
19       [[PasswordGenerationPopupViewCocoa alloc]
20           initWithController:controller
21                        frame:NSZeroRect]);
24 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() {
25   [view_ controllerDestroyed];
26   [view_ hidePopup];
29 void PasswordGenerationPopupViewBridge::Hide() {
30   delete this;
33 void PasswordGenerationPopupViewBridge::Show() {
34   [view_ showPopup];
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