| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #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/slide_animation.h" | 8 #include "app/slide_animation.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // An interface implemented by an object that provides data to populate | 27 // An interface implemented by an object that provides data to populate |
| 28 // individual result views. | 28 // individual result views. |
| 29 class AutocompleteResultViewModel { | 29 class AutocompleteResultViewModel { |
| 30 public: | 30 public: |
| 31 // Returns true if the index is selected. | 31 // Returns true if the index is selected. |
| 32 virtual bool IsSelectedIndex(size_t index) const = 0; | 32 virtual bool IsSelectedIndex(size_t index) const = 0; |
| 33 | 33 |
| 34 // Returns true if the index is hovered. | 34 // Returns true if the index is hovered. |
| 35 virtual bool IsHoveredIndex(size_t index) const = 0; | 35 virtual bool IsHoveredIndex(size_t index) const = 0; |
| 36 |
| 37 // Returns the special-case icon we should use for the given index, or NULL |
| 38 // if we should use the default icon. |
| 39 virtual const SkBitmap* GetSpecialIcon(size_t index) const = 0; |
| 36 }; | 40 }; |
| 37 | 41 |
| 38 // A view representing the contents of the autocomplete popup. | 42 // A view representing the contents of the autocomplete popup. |
| 39 class AutocompletePopupContentsView : public views::View, | 43 class AutocompletePopupContentsView : public views::View, |
| 40 public AutocompleteResultViewModel, | 44 public AutocompleteResultViewModel, |
| 41 public AutocompletePopupView, | 45 public AutocompletePopupView, |
| 42 public AnimationDelegate { | 46 public AnimationDelegate { |
| 43 public: | 47 public: |
| 44 AutocompletePopupContentsView(const gfx::Font& font, | 48 AutocompletePopupContentsView(const gfx::Font& font, |
| 45 AutocompleteEditView* edit_view, | 49 AutocompleteEditView* edit_view, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 virtual bool IsOpen() const; | 60 virtual bool IsOpen() const; |
| 57 virtual void InvalidateLine(size_t line); | 61 virtual void InvalidateLine(size_t line); |
| 58 virtual void UpdatePopupAppearance(); | 62 virtual void UpdatePopupAppearance(); |
| 59 virtual void PaintUpdatesNow(); | 63 virtual void PaintUpdatesNow(); |
| 60 virtual void OnDragCanceled(); | 64 virtual void OnDragCanceled(); |
| 61 virtual AutocompletePopupModel* GetModel(); | 65 virtual AutocompletePopupModel* GetModel(); |
| 62 | 66 |
| 63 // Overridden from AutocompleteResultViewModel: | 67 // Overridden from AutocompleteResultViewModel: |
| 64 virtual bool IsSelectedIndex(size_t index) const; | 68 virtual bool IsSelectedIndex(size_t index) const; |
| 65 virtual bool IsHoveredIndex(size_t index) const; | 69 virtual bool IsHoveredIndex(size_t index) const; |
| 70 virtual const SkBitmap* GetSpecialIcon(size_t index) const; |
| 66 | 71 |
| 67 // Overridden from AnimationDelegate: | 72 // Overridden from AnimationDelegate: |
| 68 virtual void AnimationProgressed(const Animation* animation); | 73 virtual void AnimationProgressed(const Animation* animation); |
| 69 | 74 |
| 70 // Overridden from views::View: | 75 // Overridden from views::View: |
| 71 virtual void Paint(gfx::Canvas* canvas); | 76 virtual void Paint(gfx::Canvas* canvas); |
| 72 virtual void PaintChildren(gfx::Canvas* canvas) { | 77 virtual void PaintChildren(gfx::Canvas* canvas) { |
| 73 // We paint our children inside Paint(). | 78 // We paint our children inside Paint(). |
| 74 } | 79 } |
| 75 virtual void Layout(); | 80 virtual void Layout(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // The popup sizes vertically using an animation when the popup is getting | 151 // The popup sizes vertically using an animation when the popup is getting |
| 147 // shorter (not larger, that makes it look "slow"). | 152 // shorter (not larger, that makes it look "slow"). |
| 148 SlideAnimation size_animation_; | 153 SlideAnimation size_animation_; |
| 149 gfx::Rect start_bounds_; | 154 gfx::Rect start_bounds_; |
| 150 gfx::Rect target_bounds_; | 155 gfx::Rect target_bounds_; |
| 151 | 156 |
| 152 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 157 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 153 }; | 158 }; |
| 154 | 159 |
| 155 #endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 160 #endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| OLD | NEW |