autofill_popup_view_delegate.h revision effb81e5f8246d0db0270817048dc992db66e9fb
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
10namespace gfx {
11class Point;
12class Rect;
13}
14
15namespace ui {
16class MouseEvent;
17}
18
19namespace autofill {
20
21// Base class for Controllers of Autofill style popups. This interface is
22// used by the relevant views to communicate with the controller.
23class AutofillPopupViewDelegate {
24 public:
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;
28
29  // Called whent the popup view was destroyed.
30  virtual void ViewDestroyed() = 0;
31
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;
35
36  // The user has accepted the currently selected line. Returns whether there
37  // was a selection to accept.
38  virtual bool AcceptSelectedLine() = 0;
39
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;
43
44  // Whether |event| should be reposted to the native window management.
45  virtual bool ShouldRepostEvent(const ui::MouseEvent& event) = 0;
46
47  // Whether the view should be hidden on outside mouse presses.
48  virtual bool ShouldHideOnOutsideClick() const = 0;
49
50  // The actual bounds of the popup.
51  virtual const gfx::Rect& popup_bounds() const = 0;
52
53  // The view that the form field element sits in.
54  virtual gfx::NativeView container_view() = 0;
55
56 protected:
57  virtual ~AutofillPopupViewDelegate() {}
58};
59
60}  // namespace autofill
61
62#endif  // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_POPUP_VIEW_DELEGATE_H_
63