1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ 7 8 #include "ui/gfx/native_widget_types.h" 9 10 namespace gfx { 11 class Point; 12 class Rect; 13 } 14 15 namespace autofill { 16 17 // Base class for Controllers of Autofill-style popups. This interface is 18 // used by the relevant views to communicate with the controller. 19 class AutofillPopupViewDelegate { 20 public: 21 // Called when the popup should be hidden. Controller will be deleted after 22 // the view has been hidden and destroyed. 23 virtual void Hide() = 0; 24 25 // Called whent the popup view was destroyed. 26 virtual void ViewDestroyed() = 0; 27 28 // The user has selected |point|, e.g. by hovering the mouse cursor. |point| 29 // must be in popup coordinates. 30 virtual void SetSelectionAtPoint(const gfx::Point& point) = 0; 31 32 // The user has accepted the currently selected line. Returns whether there 33 // was a selection to accept. 34 virtual bool AcceptSelectedLine() = 0; 35 36 // The user cleared the current selection, e.g. by moving the mouse cursor 37 // out of the popup bounds. 38 virtual void SelectionCleared() = 0; 39 40 // The actual bounds of the popup. 41 virtual const gfx::Rect& popup_bounds() const = 0; 42 43 // The view that the form field element sits in. 44 virtual gfx::NativeView container_view() = 0; 45 46 protected: 47 virtual ~AutofillPopupViewDelegate() {} 48 }; 49 50 } // namespace autofill 51 52 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_ 53