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/autofill_popup_view_bridge.h" | 7 #include "chrome/browser/ui/cocoa/autofill/autofill_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/autofill_popup_view_delegate.h" | 11 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
12 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 | 16 |
17 AutofillPopupViewBridge::AutofillPopupViewBridge( | 17 AutofillPopupViewBridge::AutofillPopupViewBridge( |
18 AutofillPopupController* controller) | 18 AutofillPopupController* controller) |
19 : controller_(controller) { | 19 : view_helper_(controller), controller_(controller) { |
20 view_.reset( | 20 view_.reset([[AutofillPopupViewCocoa alloc] initWithController:controller |
21 [[AutofillPopupViewCocoa alloc] initWithController:controller | 21 frame:NSZeroRect |
22 frame:NSZeroRect]); | 22 delegate:this]); |
23 } | 23 } |
24 | 24 |
25 AutofillPopupViewBridge::~AutofillPopupViewBridge() { | 25 AutofillPopupViewBridge::~AutofillPopupViewBridge() { |
26 [view_ controllerDestroyed]; | 26 [view_ controllerDestroyed]; |
27 [view_ hidePopup]; | 27 [view_ hidePopup]; |
28 } | 28 } |
29 | 29 |
| 30 gfx::Rect AutofillPopupViewBridge::GetRowBounds(size_t index) { |
| 31 return view_helper_.GetRowBounds(index); |
| 32 } |
| 33 |
| 34 int AutofillPopupViewBridge::GetIconResourceID( |
| 35 const base::string16& resource_name) { |
| 36 return view_helper_.GetIconResourceID(resource_name); |
| 37 } |
| 38 |
30 void AutofillPopupViewBridge::Hide() { | 39 void AutofillPopupViewBridge::Hide() { |
31 delete this; | 40 delete this; |
32 } | 41 } |
33 | 42 |
34 void AutofillPopupViewBridge::Show() { | 43 void AutofillPopupViewBridge::Show() { |
35 [view_ showPopup]; | 44 [view_ showPopup]; |
36 } | 45 } |
37 | 46 |
38 void AutofillPopupViewBridge::InvalidateRow(size_t row) { | 47 void AutofillPopupViewBridge::InvalidateRow(size_t row) { |
39 [view_ invalidateRow:row]; | 48 [view_ invalidateRow:row]; |
40 } | 49 } |
41 | 50 |
42 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { | 51 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { |
43 [view_ updateBoundsAndRedrawPopup]; | 52 [view_ updateBoundsAndRedrawPopup]; |
44 } | 53 } |
45 | 54 |
| 55 void AutofillPopupViewBridge::UpdatePopupBounds() { |
| 56 view_helper_.UpdatePopupBounds(); |
| 57 } |
| 58 |
| 59 int AutofillPopupViewBridge::GetAvailableWidthForRow(int row, bool with_label) { |
| 60 return view_helper_.GetAvailableWidthForRow(row, with_label); |
| 61 } |
| 62 |
| 63 int AutofillPopupViewBridge::LineFromY(int y) { |
| 64 return view_helper_.LineFromY(y); |
| 65 } |
| 66 |
| 67 gfx::Rect AutofillPopupViewBridge::GetPopupBounds() { |
| 68 return view_helper_.popup_bounds(); |
| 69 } |
| 70 |
46 AutofillPopupView* AutofillPopupView::Create( | 71 AutofillPopupView* AutofillPopupView::Create( |
47 AutofillPopupController* controller) { | 72 AutofillPopupController* controller) { |
48 return new AutofillPopupViewBridge(controller); | 73 return new AutofillPopupViewBridge(controller); |
49 } | 74 } |
50 | 75 |
51 } // namespace autofill | 76 } // namespace autofill |
OLD | NEW |