1// Copyright (c) 2010 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// This file defines the interface class AutocompletePopupView.  Each toolkit
6// will implement the popup view differently, so that code is inheriently
7// platform specific.  However, the AutocompletePopupModel needs to do some
8// communication with the view.  Since the model is shared between platforms,
9// we need to define an interface that all view implementations will share.
10
11#ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_
12#define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_
13#pragma once
14
15#include "build/build_config.h"
16
17namespace gfx {
18class Rect;
19}
20
21class AutocompletePopupView {
22 public:
23  virtual ~AutocompletePopupView() {}
24
25  // Returns true if the popup is currently open.
26  virtual bool IsOpen() const = 0;
27
28  // Invalidates one line of the autocomplete popup.
29  virtual void InvalidateLine(size_t line) = 0;
30
31  // Redraws the popup window to match any changes in the result set; this may
32  // mean opening or closing the window.
33  virtual void UpdatePopupAppearance() = 0;
34
35  // Returns the target bounds for the popup. This returns the popup's current
36  // bounds when not animating, or the desired target bounds when animating.
37  // The return value is in screen coordinates.
38  virtual gfx::Rect GetTargetBounds() = 0;
39
40  // Paint any pending updates.
41  virtual void PaintUpdatesNow() = 0;
42
43  // This method is called when the view should cancel any active drag (e.g.
44  // because the user pressed ESC). The view may or may not need to take any
45  // action (e.g. releasing mouse capture).  Note that this can be called when
46  // no drag is in progress.
47  virtual void OnDragCanceled() = 0;
48};
49
50#endif  // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_
51