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 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ |
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/optional.h" | |
15 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 16 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
16 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" | 17 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
18 #include "ui/accessibility/ax_enums.h" | |
groby-ooo-7-16
2017/03/20 22:53:10
Probably not needed.
csashi
2017/03/20 23:13:30
Done.
| |
17 | 19 |
18 @class AutofillPopupViewCocoa; | 20 @class AutofillPopupViewCocoa; |
19 @class NSWindow; | 21 @class NSWindow; |
20 | 22 |
21 namespace autofill { | 23 namespace autofill { |
22 | 24 |
23 class AutofillPopupViewCocoaDelegate { | 25 class AutofillPopupViewCocoaDelegate { |
24 public: | 26 public: |
25 // Returns the bounds of the item at |index| in the popup, relative to | 27 // Returns the bounds of the item at |index| in the popup, relative to |
26 // the top left of the popup. | 28 // the top left of the popup. |
27 virtual gfx::Rect GetRowBounds(size_t index) = 0; | 29 virtual gfx::Rect GetRowBounds(int index) = 0; |
28 | 30 |
29 // Gets the resource value for the given resource, returning -1 if the | 31 // Gets the resource value for the given resource, returning -1 if the |
30 // resource isn't recognized. | 32 // resource isn't recognized. |
31 virtual int GetIconResourceID(const base::string16& resource_name) = 0; | 33 virtual int GetIconResourceID(const base::string16& resource_name) = 0; |
32 }; | 34 }; |
33 | 35 |
34 // Mac implementation of the AutofillPopupView interface. | 36 // Mac implementation of the AutofillPopupView interface. |
35 // Serves as a bridge to an instance of the Objective-C class which actually | 37 // Serves as a bridge to an instance of the Objective-C class which actually |
36 // implements the view. | 38 // implements the view. |
37 class AutofillPopupViewBridge : public AutofillPopupView, | 39 class AutofillPopupViewBridge : public AutofillPopupView, |
38 public AutofillPopupViewCocoaDelegate { | 40 public AutofillPopupViewCocoaDelegate { |
39 public: | 41 public: |
40 explicit AutofillPopupViewBridge(AutofillPopupController* controller); | 42 explicit AutofillPopupViewBridge(AutofillPopupController* controller); |
41 | 43 |
42 // AutofillPopupViewCocoaDelegate implementation. | 44 // AutofillPopupViewCocoaDelegate implementation. |
43 gfx::Rect GetRowBounds(size_t index) override; | 45 gfx::Rect GetRowBounds(int index) override; |
44 int GetIconResourceID(const base::string16& resource_name) override; | 46 int GetIconResourceID(const base::string16& resource_name) override; |
45 | 47 |
46 private: | 48 private: |
47 ~AutofillPopupViewBridge() override; | 49 ~AutofillPopupViewBridge() override; |
48 | 50 |
49 // AutofillPopupView implementation. | 51 // AutofillPopupView implementation. |
50 void Hide() override; | 52 void Hide() override; |
51 void Show() override; | 53 void Show() override; |
52 void InvalidateRow(size_t row) override; | 54 void OnSelectedRowChanged(base::Optional<int> previous_row_selection, |
53 void UpdateBoundsAndRedrawPopup() override; | 55 base::Optional<int> current_row_selection) override; |
56 void OnSuggestionsChanged() override; | |
54 | 57 |
55 // Set the initial bounds of the popup, including its placement. | 58 // Set the initial bounds of the popup, including its placement. |
56 void SetInitialBounds(); | 59 void SetInitialBounds(); |
57 | 60 |
58 // The native Cocoa view. | 61 // The native Cocoa view. |
59 base::scoped_nsobject<AutofillPopupViewCocoa> view_; | 62 base::scoped_nsobject<AutofillPopupViewCocoa> view_; |
60 | 63 |
61 AutofillPopupController* controller_; // Weak. | 64 AutofillPopupController* controller_; // Weak. |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); | 66 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); |
64 }; | 67 }; |
65 | 68 |
66 } // namespace autofill | 69 } // namespace autofill |
67 | 70 |
68 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ | 71 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ |
OLD | NEW |