| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge
.h" | 7 #include "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_bridge
.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" | 11 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" |
| 12 #include "ui/base/cocoa/window_size_constants.h" | 12 #include "ui/gfx/size.h" |
| 13 #include "ui/gfx/rect.h" | |
| 14 | 13 |
| 15 namespace autofill { | 14 namespace autofill { |
| 16 | 15 |
| 17 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge( | 16 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge( |
| 18 PasswordGenerationPopupController* controller) { | 17 PasswordGenerationPopupController* controller) { |
| 19 view_.reset( | 18 view_.reset( |
| 20 [[PasswordGenerationPopupViewCocoa alloc] | 19 [[PasswordGenerationPopupViewCocoa alloc] |
| 21 initWithController:controller | 20 initWithController:controller |
| 22 frame:NSZeroRect]); | 21 frame:NSZeroRect]); |
| 23 } | 22 } |
| 24 | 23 |
| 25 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() { | 24 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() { |
| 26 [view_ controllerDestroyed]; | 25 [view_ controllerDestroyed]; |
| 27 [view_ hidePopup]; | 26 [view_ hidePopup]; |
| 28 } | 27 } |
| 29 | 28 |
| 30 void PasswordGenerationPopupViewBridge::Hide() { | 29 void PasswordGenerationPopupViewBridge::Hide() { |
| 31 delete this; | 30 delete this; |
| 32 } | 31 } |
| 33 | 32 |
| 34 void PasswordGenerationPopupViewBridge::Show() { | 33 void PasswordGenerationPopupViewBridge::Show() { |
| 35 [view_ showPopup]; | 34 [view_ showPopup]; |
| 36 } | 35 } |
| 37 | 36 |
| 38 gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() { | 37 gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() { |
| 39 // TODO(gcasto): Implement this function. | 38 return gfx::Size(NSSizeToCGSize([view_ preferredSize])); |
| 40 return gfx::Size(); | |
| 41 } | 39 } |
| 42 | 40 |
| 43 void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { | 41 void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
| 44 [view_ updateBoundsAndRedrawPopup]; | 42 [view_ updateBoundsAndRedrawPopup]; |
| 45 } | 43 } |
| 46 | 44 |
| 47 void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { | 45 void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { |
| 48 [view_ setNeedsDisplay:YES]; | 46 [view_ setNeedsDisplay:YES]; |
| 49 } | 47 } |
| 50 | 48 |
| 51 bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds( | 49 bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds( |
| 52 const gfx::Point& point) { | 50 const gfx::Point& point) { |
| 53 // TODO(gcasto): Implement this function. | 51 return [view_ isPointInPasswordBounds:NSPointFromCGPoint(point.ToCGPoint())]; |
| 54 return true; | |
| 55 } | 52 } |
| 56 | 53 |
| 57 PasswordGenerationPopupView* PasswordGenerationPopupView::Create( | 54 PasswordGenerationPopupView* PasswordGenerationPopupView::Create( |
| 58 PasswordGenerationPopupController* controller) { | 55 PasswordGenerationPopupController* controller) { |
| 59 return new PasswordGenerationPopupViewBridge(controller); | 56 return new PasswordGenerationPopupViewBridge(controller); |
| 60 } | 57 } |
| 61 | 58 |
| 62 } // namespace autofill | 59 } // namespace autofill |
| OLD | NEW |