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 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" | |
12 #include "chrome/browser/ui/autofill/popup_constants.h" | |
11 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h " | 13 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h " |
12 #include "ui/base/cocoa/window_size_constants.h" | 14 #include "ui/base/cocoa/window_size_constants.h" |
groby-ooo-7-16
2014/08/19 23:32:17
Do you need window_size_constants?
dconnelly
2014/08/20 17:07:05
Done.
| |
13 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
groby-ooo-7-16
2014/08/19 23:32:17
Do you need gfx/rect.h?
dconnelly
2014/08/20 17:07:05
Done.
| |
16 #include "ui/gfx/size.h" | |
14 | 17 |
15 namespace autofill { | 18 namespace autofill { |
16 | 19 |
17 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge( | 20 PasswordGenerationPopupViewBridge::PasswordGenerationPopupViewBridge( |
18 PasswordGenerationPopupController* controller) { | 21 PasswordGenerationPopupController* controller) |
22 : controller_(controller) { | |
19 view_.reset( | 23 view_.reset( |
20 [[PasswordGenerationPopupViewCocoa alloc] | 24 [[PasswordGenerationPopupViewCocoa alloc] |
21 initWithController:controller | 25 initWithController:controller |
22 frame:NSZeroRect]); | 26 frame:NSZeroRect]); |
23 } | 27 } |
24 | 28 |
25 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() { | 29 PasswordGenerationPopupViewBridge::~PasswordGenerationPopupViewBridge() { |
26 [view_ controllerDestroyed]; | 30 [view_ controllerDestroyed]; |
27 [view_ hidePopup]; | 31 [view_ hidePopup]; |
28 } | 32 } |
29 | 33 |
30 void PasswordGenerationPopupViewBridge::Hide() { | 34 void PasswordGenerationPopupViewBridge::Hide() { |
31 delete this; | 35 delete this; |
32 } | 36 } |
33 | 37 |
34 void PasswordGenerationPopupViewBridge::Show() { | 38 void PasswordGenerationPopupViewBridge::Show() { |
35 [view_ showPopup]; | 39 [view_ showPopup]; |
36 } | 40 } |
37 | 41 |
38 gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() { | 42 gfx::Size PasswordGenerationPopupViewBridge::GetPreferredSizeOfPasswordView() { |
39 // TODO(gcasto): Implement this function. | 43 return gfx::Size(NSSizeToCGSize([view_ preferredSize])); |
40 return gfx::Size(); | |
41 } | 44 } |
42 | 45 |
43 void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { | 46 void PasswordGenerationPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
44 [view_ updateBoundsAndRedrawPopup]; | 47 [view_ updateBoundsAndRedrawPopup]; |
45 } | 48 } |
46 | 49 |
47 void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { | 50 void PasswordGenerationPopupViewBridge::PasswordSelectionUpdated() { |
48 [view_ setNeedsDisplay:YES]; | 51 [view_ setNeedsDisplay:YES]; |
49 } | 52 } |
50 | 53 |
51 bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds( | 54 bool PasswordGenerationPopupViewBridge::IsPointInPasswordBounds( |
52 const gfx::Point& point) { | 55 const gfx::Point& point) { |
53 // TODO(gcasto): Implement this function. | 56 return [view_ isPointInPasswordBounds:point.ToCGPoint()]; |
54 return true; | |
55 } | 57 } |
56 | 58 |
57 PasswordGenerationPopupView* PasswordGenerationPopupView::Create( | 59 PasswordGenerationPopupView* PasswordGenerationPopupView::Create( |
58 PasswordGenerationPopupController* controller) { | 60 PasswordGenerationPopupController* controller) { |
59 return new PasswordGenerationPopupViewBridge(controller); | 61 return new PasswordGenerationPopupViewBridge(controller); |
60 } | 62 } |
61 | 63 |
62 } // namespace autofill | 64 } // namespace autofill |
OLD | NEW |