OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 7 |
| 8 #include "chrome/browser/autocomplete/autocomplete.h" |
| 9 #include "chrome/views/view.h" |
| 10 |
| 11 class AutocompletePopupWin; |
| 12 |
| 13 // TODO(beng): documentation, finalize |
| 14 class AutocompleteResultViewModel { |
| 15 public: |
| 16 virtual bool IsSelectedIndex(size_t index) = 0; |
| 17 |
| 18 virtual AutocompleteMatch::Type GetResultTypeAtIndex(size_t index) = 0; |
| 19 |
| 20 virtual void OpenIndex(size_t index, WindowOpenDisposition disposition) = 0; |
| 21 |
| 22 virtual void SetHoveredLine(size_t index) = 0; |
| 23 virtual void SetSelectedLine(size_t index, bool revert_to_default) = 0; |
| 24 }; |
| 25 |
| 26 // TODO(beng): documentation |
| 27 class AutocompletePopupContentsView : public views::View, |
| 28 public AutocompleteResultViewModel { |
| 29 public: |
| 30 explicit AutocompletePopupContentsView(AutocompletePopupWin* popup); |
| 31 virtual ~AutocompletePopupContentsView() {} |
| 32 |
| 33 // Update the presentation with the latest result. |
| 34 void SetAutocompleteResult(const AutocompleteResult& result); |
| 35 |
| 36 // Schedule a repaint for the specified row. |
| 37 void InvalidateLine(int index); |
| 38 |
| 39 // Overridden from AutocompleteResultViewModel: |
| 40 virtual bool IsSelectedIndex(size_t index); |
| 41 virtual AutocompleteMatch::Type GetResultTypeAtIndex(size_t index); |
| 42 virtual void OpenIndex(size_t index, WindowOpenDisposition disposition); |
| 43 virtual void SetHoveredLine(size_t index); |
| 44 virtual void SetSelectedLine(size_t index, bool revert_to_default); |
| 45 |
| 46 // Overridden from views::View: |
| 47 virtual void PaintChildren(ChromeCanvas* canvas); |
| 48 virtual void Layout(); |
| 49 |
| 50 private: |
| 51 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that |
| 52 // bounds the path. |
| 53 void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect); |
| 54 |
| 55 // Updates the window's blur region for the current size. |
| 56 void UpdateBlurRegion(); |
| 57 |
| 58 // Makes the contents of the canvas slightly transparent. |
| 59 void MakeCanvasTransparent(ChromeCanvas* canvas); |
| 60 |
| 61 AutocompletePopupWin* popup_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 64 }; |
| 65 |
| 66 |
| 67 #endif // #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS
_VIEW_H_ |
OLD | NEW |