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.
5 #ifndef CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_
6 #define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_
8 #include "ui/gfx/native_widget_types.h"
21 // Base class for Controllers of Autofill style popups. This interface is
22 // used by the relevant views to communicate with the controller.
23 class AutofillPopupViewDelegate {
25 // Called when the popup should be hidden. Controller will be deleted after
26 // the view has been hidden and destroyed.
27 virtual void Hide() = 0;
29 // Called whent the popup view was destroyed.
30 virtual void ViewDestroyed() = 0;
32 // The user has selected |point|, e.g. by hovering the mouse cursor. |point|
33 // must be in popup coordinates.
34 virtual void SetSelectionAtPoint(const gfx::Point& point) = 0;
36 // The user has accepted the currently selected line. Returns whether there
37 // was a selection to accept.
38 virtual bool AcceptSelectedLine() = 0;
40 // The user cleared the current selection, e.g. by moving the mouse cursor
41 // out of the popup bounds.
42 virtual void SelectionCleared() = 0;
44 // Whether |event| should be reposted to the native window management.
45 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) = 0;
47 // Whether the view should be hidden on outside mouse presses.
48 virtual bool ShouldHideOnOutsideClick() const = 0;
50 // The actual bounds of the popup.
51 virtual const gfx::Rect& popup_bounds() const = 0;
53 // The view that the form field element sits in.
54 virtual gfx::NativeView container_view() = 0;
57 virtual ~AutofillPopupViewDelegate() {}
60 } // namespace autofill
62 #endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_