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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h
index 314a6ab8753e7b7e867d5979d639b518cfb1befb..772fe4bd0bfb5f6526bf76d05fd1eb86507507dc 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h
+++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h
@@ -12,7 +12,9 @@
#include "base/compiler_specific.h"
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "chrome/browser/ui/autofill/autofill_popup_view.h"
+#include "chrome/browser/ui/autofill/autofill_popup_view_helper.h"
#include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
@class AutofillPopupViewCocoa;
@@ -22,13 +24,29 @@ namespace autofill {
class AutofillPopupViewDelegate;
+class AutofillPopupViewBridgeDelegate {
+ public:
+ // Returns the bounds of the item at |index| in the popup, relative to
+ // the top left of the popup.
+ virtual gfx::Rect GetRowBounds(size_t index) = 0;
+
+ // Gets the resource value for the given resource, returning -1 if the
+ // resource isn't recognized.
+ virtual int GetIconResourceID(const base::string16& resource_name) = 0;
+};
+
// Mac implementation of the AutofillPopupView interface.
// Serves as a bridge to an instance of the Objective-C class which actually
// implements the view.
-class AutofillPopupViewBridge : public AutofillPopupView {
+class AutofillPopupViewBridge : public AutofillPopupView,
+ 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
public:
explicit AutofillPopupViewBridge(AutofillPopupController* controller);
+ // AutofillPopupViewBridgeDelegate implementation.
+ gfx::Rect GetRowBounds(size_t index) override;
+ int GetIconResourceID(const base::string16& resource_name) override;
+
private:
~AutofillPopupViewBridge() override;
@@ -37,6 +55,10 @@ class AutofillPopupViewBridge : public AutofillPopupView {
void Show() override;
void InvalidateRow(size_t row) override;
void UpdateBoundsAndRedrawPopup() override;
+ void UpdatePopupBounds() override;
+ int GetAvailableWidthForRow(int row, bool with_label) override;
+ int LineFromY(int y) override;
+ gfx::Rect GetPopupBounds() override;
// Set the initial bounds of the popup, including its placement.
void SetInitialBounds();
@@ -44,6 +66,8 @@ class AutofillPopupViewBridge : public AutofillPopupView {
// The native Cocoa view.
base::scoped_nsobject<AutofillPopupViewCocoa> view_;
+ 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.
+
AutofillPopupController* controller_; // Weak.
DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewBridge);

Powered by Google App Engine
This is Rietveld 408576698