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