| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 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 | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 7 | 7 |
| 8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
| 9 #include "app/slide_animation.h" | 9 #include "app/slide_animation.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 virtual void AnimationProgressed(const Animation* animation); | 80 virtual void AnimationProgressed(const Animation* animation); |
| 81 | 81 |
| 82 // Overridden from views::View: | 82 // Overridden from views::View: |
| 83 virtual void Paint(gfx::Canvas* canvas); | 83 virtual void Paint(gfx::Canvas* canvas); |
| 84 virtual void PaintChildren(gfx::Canvas* canvas) { | 84 virtual void PaintChildren(gfx::Canvas* canvas) { |
| 85 // We paint our children inside Paint(). | 85 // We paint our children inside Paint(). |
| 86 } | 86 } |
| 87 virtual void Layout(); | 87 virtual void Layout(); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 #if defined(OS_WIN) |
| 91 typedef AutocompletePopupWin AutocompletePopupClass; |
| 92 #else |
| 93 typedef AutocompletePopupGtk AutocompletePopupClass; |
| 94 #endif |
| 95 |
| 90 // Returns true if the model has a match at the specified index. | 96 // Returns true if the model has a match at the specified index. |
| 91 bool HasMatchAt(size_t index) const; | 97 bool HasMatchAt(size_t index) const; |
| 92 | 98 |
| 93 // Returns the match at the specified index within the popup model. | 99 // Returns the match at the specified index within the popup model. |
| 94 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; | 100 const AutocompleteMatch& GetMatchAtIndex(size_t index) const; |
| 95 | 101 |
| 96 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that | 102 // Fill a path for the contents' roundrect. |bounding_rect| is the rect that |
| 97 // bounds the path. | 103 // bounds the path. |
| 98 void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect); | 104 void MakeContentsPath(gfx::Path* path, const gfx::Rect& bounding_rect); |
| 99 | 105 |
| 100 // Updates the window's blur region for the current size. | 106 // Updates the window's blur region for the current size. |
| 101 void UpdateBlurRegion(); | 107 void UpdateBlurRegion(); |
| 102 | 108 |
| 103 // Makes the contents of the canvas slightly transparent. | 109 // Makes the contents of the canvas slightly transparent. |
| 104 void MakeCanvasTransparent(gfx::Canvas* canvas); | 110 void MakeCanvasTransparent(gfx::Canvas* canvas); |
| 105 | 111 |
| 106 #if defined(OS_WIN) | |
| 107 // The popup that contains this view. | 112 // The popup that contains this view. |
| 108 scoped_ptr<AutocompletePopupWin> popup_; | 113 scoped_ptr<AutocompletePopupClass> popup_; |
| 109 #else | |
| 110 scoped_ptr<AutocompletePopupGtk> popup_; | |
| 111 #endif | |
| 112 | 114 |
| 113 // The provider of our result set. | 115 // The provider of our result set. |
| 114 scoped_ptr<AutocompletePopupModel> model_; | 116 scoped_ptr<AutocompletePopupModel> model_; |
| 115 | 117 |
| 116 // The edit view that invokes us. | 118 // The edit view that invokes us. |
| 117 AutocompleteEditView* edit_view_; | 119 AutocompleteEditView* edit_view_; |
| 118 | 120 |
| 119 // An object that tells the popup how to position itself. | 121 // An object that tells the popup how to position itself. |
| 120 const BubblePositioner* bubble_positioner_; | 122 const BubblePositioner* bubble_positioner_; |
| 121 | 123 |
| 122 // Our border, which can compute our desired bounds. | 124 // Our border, which can compute our desired bounds. |
| 123 const BubbleBorder* bubble_border_; | 125 const BubbleBorder* bubble_border_; |
| 124 | 126 |
| 125 // The font that we should use for result rows. This is based on the font used | 127 // The font that we should use for result rows. This is based on the font used |
| 126 // by the edit that created us. | 128 // by the edit that created us. |
| 127 gfx::Font result_font_; | 129 gfx::Font result_font_; |
| 128 | 130 |
| 129 // The popup sizes vertically using an animation when the popup is getting | 131 // The popup sizes vertically using an animation when the popup is getting |
| 130 // shorter (not larger, that makes it look "slow"). | 132 // shorter (not larger, that makes it look "slow"). |
| 131 SlideAnimation size_animation_; | 133 SlideAnimation size_animation_; |
| 132 gfx::Rect start_bounds_; | 134 gfx::Rect start_bounds_; |
| 133 gfx::Rect target_bounds_; | 135 gfx::Rect target_bounds_; |
| 134 | 136 |
| 135 bool is_open_; // Used only for sanity-checking. | |
| 136 | |
| 137 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 137 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 | 140 |
| 141 #endif // #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS
_VIEW_H_ | 141 #endif // #ifndef CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS
_VIEW_H_ |
| OLD | NEW |