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" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 view_.reset([[AutofillPopupViewCocoa alloc] initWithController:controller | 21 view_.reset([[AutofillPopupViewCocoa alloc] initWithController:controller |
22 frame:NSZeroRect | 22 frame:NSZeroRect |
23 delegate:this]); | 23 delegate:this]); |
24 } | 24 } |
25 | 25 |
26 AutofillPopupViewBridge::~AutofillPopupViewBridge() { | 26 AutofillPopupViewBridge::~AutofillPopupViewBridge() { |
27 [view_ controllerDestroyed]; | 27 [view_ controllerDestroyed]; |
28 [view_ hidePopup]; | 28 [view_ hidePopup]; |
29 } | 29 } |
30 | 30 |
31 gfx::Rect AutofillPopupViewBridge::GetRowBounds(size_t index) { | 31 gfx::Rect AutofillPopupViewBridge::GetRowBounds(int index) { |
32 return controller_->layout_model().GetRowBounds(index); | 32 return controller_->layout_model().GetRowBounds(index); |
33 } | 33 } |
34 | 34 |
35 int AutofillPopupViewBridge::GetIconResourceID( | 35 int AutofillPopupViewBridge::GetIconResourceID( |
36 const base::string16& resource_name) { | 36 const base::string16& resource_name) { |
37 return controller_->layout_model().GetIconResourceID(resource_name); | 37 return controller_->layout_model().GetIconResourceID(resource_name); |
38 } | 38 } |
39 | 39 |
40 void AutofillPopupViewBridge::Hide() { | 40 void AutofillPopupViewBridge::Hide() { |
41 delete this; | 41 delete this; |
42 } | 42 } |
43 | 43 |
44 void AutofillPopupViewBridge::Show() { | 44 void AutofillPopupViewBridge::Show() { |
45 [view_ showPopup]; | 45 [view_ showPopup]; |
46 } | 46 } |
47 | 47 |
48 void AutofillPopupViewBridge::InvalidateRow(size_t row) { | 48 void AutofillPopupViewBridge::OnSelectedRowChanged( |
groby-ooo-7-16
2017/03/20 20:42:55
The docs[1] suggest not using Optional<> as a func
Evan Stade
2017/03/20 21:36:57
I asked for this. See discussion above.
Cocoa wil
Evan Stade
2017/03/20 21:41:05
also, I think that those docs need to be updated.
csashi
2017/03/20 21:41:51
Discussed in https://codereview.chromium.org/27272
groby-ooo-7-16
2017/03/20 22:53:10
Fine with it for this CL. Would love it if you cou
Evan Stade
2017/03/20 22:57:30
The docs and impl were written by mlamouri so I se
groby-ooo-7-16
2017/03/20 22:58:42
Thank you!
| |
49 [view_ invalidateRow:row]; | 49 base::Optional<int> previous_row_selection, |
50 base::Optional<int> current_row_selection) { | |
51 if (previous_row_selection) { | |
52 [view_ invalidateRow:*previous_row_selection]; | |
53 } | |
54 | |
55 if (current_row_selection) { | |
56 [view_ invalidateRow:*current_row_selection]; | |
57 } | |
50 } | 58 } |
51 | 59 |
52 void AutofillPopupViewBridge::UpdateBoundsAndRedrawPopup() { | 60 void AutofillPopupViewBridge::OnSuggestionsChanged() { |
53 [view_ updateBoundsAndRedrawPopup]; | 61 [view_ updateBoundsAndRedrawPopup]; |
54 } | 62 } |
55 | 63 |
56 AutofillPopupView* AutofillPopupView::Create( | 64 AutofillPopupView* AutofillPopupView::Create( |
57 AutofillPopupController* controller) { | 65 AutofillPopupController* controller) { |
58 return new AutofillPopupViewBridge(controller); | 66 return new AutofillPopupViewBridge(controller); |
59 } | 67 } |
60 | 68 |
61 } // namespace autofill | 69 } // namespace autofill |
OLD | NEW |