OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file defines the interface class AutocompletePopupView. Each toolkit | 5 // This file defines the interface class AutocompletePopupView. Each toolkit |
6 // will implement the popup view differently, so that code is inheriently | 6 // will implement the popup view differently, so that code is inheriently |
7 // platform specific. However, the AutocompletePopupModel needs to do some | 7 // platform specific. However, the AutocompletePopupModel needs to do some |
8 // communication with the view. Since the model is shared between platforms, | 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. | 9 // we need to define an interface that all view implementations will share. |
10 | 10 |
11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ | 11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ |
12 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ | 12 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ |
13 | 13 |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 | 15 |
16 class AutocompleteEditView; | 16 class AutocompleteEditView; |
17 class AutocompletePopupModel; | 17 class AutocompletePopupModel; |
| 18 class BubblePositioner; |
18 namespace gfx { | 19 namespace gfx { |
19 class Font; | 20 class Font; |
20 class Rect; | |
21 } | 21 } |
22 #if defined(OS_WIN) || defined(OS_LINUX) | 22 #if defined(OS_WIN) || defined(OS_LINUX) |
23 class AutocompleteEditViewWin; | 23 class AutocompleteEditViewWin; |
24 class AutocompleteEditModel; | 24 class AutocompleteEditModel; |
25 class Profile; | 25 class Profile; |
26 #endif | 26 #endif |
27 | 27 |
28 // An object in the browser UI can implement this interface to provide display | |
29 // bounds for the autocomplete popup view. | |
30 class AutocompletePopupPositioner { | |
31 public: | |
32 virtual ~AutocompletePopupPositioner() { } | |
33 | |
34 // Returns the bounds at which the popup should be shown, in screen | |
35 // coordinates. The height is ignored, since the popup is sized to its | |
36 // contents automatically. | |
37 virtual gfx::Rect GetPopupBounds() const = 0; | |
38 }; | |
39 | |
40 class AutocompletePopupView { | 28 class AutocompletePopupView { |
41 public: | 29 public: |
42 virtual ~AutocompletePopupView() { } | 30 virtual ~AutocompletePopupView() { } |
43 | 31 |
44 // Returns true if the popup is currently open. | 32 // Returns true if the popup is currently open. |
45 virtual bool IsOpen() const = 0; | 33 virtual bool IsOpen() const = 0; |
46 | 34 |
47 // Invalidates one line of the autocomplete popup. | 35 // Invalidates one line of the autocomplete popup. |
48 virtual void InvalidateLine(size_t line) = 0; | 36 virtual void InvalidateLine(size_t line) = 0; |
49 | 37 |
50 // Redraws the popup window to match any changes in the result set; this may | 38 // Redraws the popup window to match any changes in the result set; this may |
51 // mean opening or closing the window. | 39 // mean opening or closing the window. |
52 virtual void UpdatePopupAppearance() = 0; | 40 virtual void UpdatePopupAppearance() = 0; |
53 | 41 |
54 // Paint any pending updates. | 42 // Paint any pending updates. |
55 virtual void PaintUpdatesNow() = 0; | 43 virtual void PaintUpdatesNow() = 0; |
56 | 44 |
57 // Returns the popup's model. | 45 // Returns the popup's model. |
58 virtual AutocompletePopupModel* GetModel() = 0; | 46 virtual AutocompletePopupModel* GetModel() = 0; |
59 | 47 |
60 #if defined(OS_WIN) || defined(OS_LINUX) | 48 #if defined(OS_WIN) || defined(OS_LINUX) |
61 // Create a popup view implementation. It may make sense for this to become | 49 // Create a popup view implementation. It may make sense for this to become |
62 // platform independent eventually. | 50 // platform independent eventually. |
63 static AutocompletePopupView* CreatePopupView( | 51 static AutocompletePopupView* CreatePopupView( |
64 const gfx::Font& font, | 52 const gfx::Font& font, |
65 AutocompleteEditView* edit_view, | 53 AutocompleteEditView* edit_view, |
66 AutocompleteEditModel* edit_model, | 54 AutocompleteEditModel* edit_model, |
67 Profile* profile, | 55 Profile* profile, |
68 AutocompletePopupPositioner* popup_positioner); | 56 const BubblePositioner* bubble_positioner); |
69 #endif | 57 #endif |
70 }; | 58 }; |
71 | 59 |
72 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ | 60 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_ |
OLD | NEW |