Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h

Issue 1570783003: [Autofill] Move functions from the AutofillPopupController to AutofillPopupLayoutModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AutofillPopupViewHelper Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/scoped_ptr.h"
15 #include "chrome/browser/ui/autofill/autofill_popup_view.h" 16 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
17 #include "chrome/browser/ui/autofill/autofill_popup_view_helper.h"
16 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h" 18 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
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 AutofillPopupViewDelegate; 25 class AutofillPopupViewDelegate;
24 26
27 class AutofillPopupViewBridgeDelegate {
28 public:
29 // Returns the bounds of the item at |index| in the popup, relative to
30 // the top left of the popup.
31 virtual gfx::Rect GetRowBounds(size_t index) = 0;
32
33 // Gets the resource value for the given resource, returning -1 if the
34 // resource isn't recognized.
35 virtual int GetIconResourceID(const base::string16& resource_name) = 0;
36 };
37
25 // Mac implementation of the AutofillPopupView interface. 38 // Mac implementation of the AutofillPopupView interface.
26 // Serves as a bridge to an instance of the Objective-C class which actually 39 // Serves as a bridge to an instance of the Objective-C class which actually
27 // implements the view. 40 // implements the view.
28 class AutofillPopupViewBridge : public AutofillPopupView { 41 class AutofillPopupViewBridge : public AutofillPopupView,
42 public AutofillPopupViewBridgeDelegate {
Ilya Sherman 2016/01/11 21:06:45 The bridge is its own delegate? The naming of thi
Mathieu 2016/01/13 17:04:27 Yes, it's rather a AutofillPopupCocoaViewDelegate
29 public: 43 public:
30 explicit AutofillPopupViewBridge(AutofillPopupController* controller); 44 explicit AutofillPopupViewBridge(AutofillPopupController* controller);
31 45
46 // AutofillPopupViewBridgeDelegate implementation.
47 gfx::Rect GetRowBounds(size_t index) override;
48 int GetIconResourceID(const base::string16& resource_name) override;
49
32 private: 50 private:
33 ~AutofillPopupViewBridge() override; 51 ~AutofillPopupViewBridge() override;
34 52
35 // AutofillPopupView implementation. 53 // AutofillPopupView implementation.
36 void Hide() override; 54 void Hide() override;
37 void Show() override; 55 void Show() override;
38 void InvalidateRow(size_t row) override; 56 void InvalidateRow(size_t row) override;
39 void UpdateBoundsAndRedrawPopup() override; 57 void UpdateBoundsAndRedrawPopup() override;
58 void UpdatePopupBounds() override;
59 int GetAvailableWidthForRow(int row, bool with_label) override;
60 int LineFromY(int y) override;
61 gfx::Rect GetPopupBounds() override;
40 62
41 // Set the initial bounds of the popup, including its placement. 63 // Set the initial bounds of the popup, including its placement.
42 void SetInitialBounds(); 64 void SetInitialBounds();
43 65
44 // The native Cocoa view. 66 // The native Cocoa view.
45 base::scoped_nsobject<AutofillPopupViewCocoa> view_; 67 base::scoped_nsobject<AutofillPopupViewCocoa> view_;
46 68
69 scoped_ptr<AutofillPopupViewHelper> view_helper_;
Ilya Sherman 2016/01/11 21:06:45 nit: Can you omit the scoped_ptr wrapper?
Mathieu 2016/01/13 17:04:27 Done.
70
47 AutofillPopupController* controller_; // Weak. 71 AutofillPopupController* controller_; // Weak.
48 72
49 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge); 73 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge);
50 }; 74 };
51 75
52 } // namespace autofill 76 } // namespace autofill
53 77
54 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_ 78 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_POPUP_VIEW_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698