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 "chrome/browser/ui/autofill/autofill_popup_view.h" | 15 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
16 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" | 16 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
17 | 17 |
18 @class AutofillPopupViewCocoa; | 18 @class AutofillPopupViewCocoa; |
19 @class NSWindow; | 19 @class NSWindow; |
20 | 20 |
21 namespace autofill { | 21 namespace autofill { |
22 | 22 |
23 class AutofillPopupViewDelegate; | 23 class AutofillPopupViewDelegate; |
24 | 24 |
25 class AutofillPopupViewCocoaDelegate { | |
26 public: | |
27 // Returns the bounds of the item at |index| in the popup, relative to | |
28 // the top left of the popup. | |
29 virtual gfx::Rect GetRowBounds(size_t index) = 0; | |
30 | |
31 // Gets the resource value for the given resource, returning -1 if the | |
32 // resource isn't recognized. | |
33 virtual int GetIconResourceID(const base::string16& resource_name) = 0; | |
34 }; | |
35 | |
25 // Mac implementation of the AutofillPopupView interface. | 36 // Mac implementation of the AutofillPopupView interface. |
26 // 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 |
27 // implements the view. | 38 // implements the view. |
28 class AutofillPopupViewBridge : public AutofillPopupView { | 39 class AutofillPopupViewBridge : public AutofillPopupView, |
40 public AutofillPopupViewCocoaDelegate { | |
29 public: | 41 public: |
30 explicit AutofillPopupViewBridge(AutofillPopupController* controller); | 42 explicit AutofillPopupViewBridge(AutofillPopupController* controller); |
31 | 43 |
44 // AutofillPopupViewBridgeDelegate implementation. | |
Ilya Sherman
2016/01/20 23:25:18
nit: "AutofillPopupViewCocoaDelegate:"?
Mathieu
2016/01/21 01:25:08
Done.
| |
45 gfx::Rect GetRowBounds(size_t index) override; | |
46 int GetIconResourceID(const base::string16& resource_name) override; | |
47 | |
32 private: | 48 private: |
33 ~AutofillPopupViewBridge() override; | 49 ~AutofillPopupViewBridge() override; |
34 | 50 |
35 // AutofillPopupView implementation. | 51 // AutofillPopupView implementation. |
36 void Hide() override; | 52 void Hide() override; |
37 void Show() override; | 53 void Show() override; |
38 void InvalidateRow(size_t row) override; | 54 void InvalidateRow(size_t row) override; |
39 void UpdateBoundsAndRedrawPopup() override; | 55 void UpdateBoundsAndRedrawPopup() override; |
40 | 56 |
41 // Set the initial bounds of the popup, including its placement. | 57 // Set the initial bounds of the popup, including its placement. |
42 void SetInitialBounds(); | 58 void SetInitialBounds(); |
43 | 59 |
44 // The native Cocoa view. | 60 // The native Cocoa view. |
45 base::scoped_nsobject<AutofillPopupViewCocoa> view_; | 61 base::scoped_nsobject<AutofillPopupViewCocoa> view_; |
46 | 62 |
47 AutofillPopupController* controller_; // Weak. | 63 AutofillPopupController* controller_; // Weak. |
48 | 64 |
49 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); | 65 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); |
50 }; | 66 }; |
51 | 67 |
52 } // namespace autofill | 68 } // namespace autofill |
53 | 69 |
54 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ | 70 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ |
OLD | NEW |