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