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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/mac/scoped_nsobject.h" |
12 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 13 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 14 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" |
13 | 15 |
14 @class AutofillPopupViewCocoa; | 16 @class AutofillPopupViewCocoa; |
15 @class NSWindow; | 17 @class NSWindow; |
16 | 18 |
17 namespace autofill { | 19 namespace autofill { |
18 | 20 |
19 class AutofillPopupController; | 21 class AutofillPopupViewDelegate; |
20 | 22 |
21 // Mac implementation for AutofillPopupView interface. | 23 // Mac implementation of the AutofillPopupView interface. |
22 // Serves as a bridge to the Objective-C class AutofillPopupViewCocoa which | 24 // Serves as a bridge to an instance of the Objective-C class which actually |
23 // actually implements the view. | 25 // implements the view. |
24 class AutofillPopupViewBridge : public AutofillPopupView { | 26 class AutofillPopupViewBridge : public AutofillPopupView { |
25 public: | 27 public: |
26 explicit AutofillPopupViewBridge(AutofillPopupController* controller); | 28 explicit AutofillPopupViewBridge(AutofillPopupController* controller); |
27 | 29 |
28 private: | 30 private: |
29 virtual ~AutofillPopupViewBridge(); | 31 virtual ~AutofillPopupViewBridge(); |
30 | 32 |
31 // AutofillPopupView implementation. | 33 // AutofillPopupView implementation. |
32 virtual void Hide() OVERRIDE; | 34 virtual void Hide() OVERRIDE; |
33 virtual void Show() OVERRIDE; | 35 virtual void Show() OVERRIDE; |
34 virtual void InvalidateRow(size_t row) OVERRIDE; | 36 virtual void InvalidateRow(size_t row) OVERRIDE; |
35 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; | 37 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; |
36 | 38 |
37 // Set the initial bounds of the popup to show, including the placement | 39 // Set the initial bounds of the popup, including its placement. |
38 // of it. | |
39 void SetInitialBounds(); | 40 void SetInitialBounds(); |
40 | 41 |
41 // The controller for this view. | 42 // The native Cocoa view. |
42 AutofillPopupController* controller_; // Weak reference. | 43 base::scoped_nsobject<AutofillPopupViewCocoa> view_; |
43 | 44 |
44 // The native Cocoa window and view. | 45 AutofillPopupController* controller_; // Weak. |
45 NSWindow* window_; // Weak reference, owns itself. | |
46 AutofillPopupViewCocoa* view_; // Weak reference, owned by the |window_|. | |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); | 47 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); |
49 }; | 48 }; |
50 | 49 |
51 } // namespace autofill | 50 } // namespace autofill |
52 | 51 |
53 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ | 52 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ |
OLD | NEW |