15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file defines the interface class OmniboxPopupView.  Each toolkit
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// will implement the popup view differently, so that code is inheriently
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// platform specific.  However, the OmniboxPopupModel needs to do some
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// communication with the view.  Since the model is shared between platforms,
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// we need to define an interface that all view implementations will share.
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "build/build_config.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace gfx {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Rect;
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class OmniboxPopupView {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~OmniboxPopupView() {}
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the popup is currently open.
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsOpen() const = 0;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Invalidates one line of the autocomplete popup.
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void InvalidateLine(size_t line) = 0;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Redraws the popup window to match any changes in the result set; this may
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // mean opening or closing the window.
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdatePopupAppearance() = 0;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the target bounds for the popup. This returns the popup's current
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // bounds when not animating, or the desired target bounds when animating.
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The return value is in screen coordinates.
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Rect GetTargetBounds() = 0;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Paint any pending updates.
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void PaintUpdatesNow() = 0;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This method is called when the view should cancel any active drag (e.g.
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // because the user pressed ESC). The view may or may not need to take any
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // action (e.g. releasing mouse capture).  Note that this can be called when
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // no drag is in progress.
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDragCanceled() = 0;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_H_
50