Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // Overridden from AutocompleteResultViewModel: | 62 // Overridden from AutocompleteResultViewModel: |
| 63 virtual bool IsSelectedIndex(size_t index) const; | 63 virtual bool IsSelectedIndex(size_t index) const; |
| 64 virtual bool IsHoveredIndex(size_t index) const; | 64 virtual bool IsHoveredIndex(size_t index) const; |
| 65 virtual const SkBitmap* GetSpecialIcon(size_t index) const; | 65 virtual const SkBitmap* GetSpecialIcon(size_t index) const; |
| 66 | 66 |
| 67 // Overridden from ui::AnimationDelegate: | 67 // Overridden from ui::AnimationDelegate: |
| 68 virtual void AnimationProgressed(const ui::Animation* animation); | 68 virtual void AnimationProgressed(const ui::Animation* animation); |
| 69 | 69 |
| 70 // Overridden from views::View: | 70 // Overridden from views::View: |
| 71 virtual void OnPaint(gfx::Canvas* canvas); | 71 virtual void OnPaint(gfx::Canvas* canvas); |
| 72 virtual void PaintChildren(gfx::CanvasSkia* canvas); | 72 virtual void PaintChildren(gfx::Canvas* canvas) { |
|
Peter Kasting
2011/02/21 04:59:30
Nit: Never define virtual functions in the class d
varunjain
2011/02/21 16:36:30
Done.
| |
| 73 // We paint our children inside OnPaint(). | |
|
Peter Kasting
2011/02/21 04:59:30
Nit: Add more detail: "... It's important not to a
varunjain
2011/02/21 16:36:30
Done.
| |
| 74 } | |
| 73 virtual void Layout(); | 75 virtual void Layout(); |
| 74 virtual void LayoutChildren(); | 76 virtual void LayoutChildren(); |
| 75 virtual void OnMouseEntered(const views::MouseEvent& event); | 77 virtual void OnMouseEntered(const views::MouseEvent& event); |
| 76 virtual void OnMouseMoved(const views::MouseEvent& event); | 78 virtual void OnMouseMoved(const views::MouseEvent& event); |
| 77 virtual void OnMouseExited(const views::MouseEvent& event); | 79 virtual void OnMouseExited(const views::MouseEvent& event); |
| 78 virtual bool OnMousePressed(const views::MouseEvent& event); | 80 virtual bool OnMousePressed(const views::MouseEvent& event); |
| 79 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 81 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
| 80 virtual bool OnMouseDragged(const views::MouseEvent& event); | 82 virtual bool OnMouseDragged(const views::MouseEvent& event); |
| 81 virtual views::View* GetViewForPoint(const gfx::Point& point); | 83 virtual views::View* GetViewForPoint(const gfx::Point& point); |
| 82 | 84 |
| 83 protected: | 85 protected: |
| 86 virtual void PaintResultViews(gfx::CanvasSkia* canvas); | |
| 87 | |
| 84 // Calculates the height needed to show all the results in the model. | 88 // Calculates the height needed to show all the results in the model. |
| 85 virtual int CalculatePopupHeight(); | 89 virtual int CalculatePopupHeight(); |
| 86 virtual AutocompleteResultView* CreateResultView( | 90 virtual AutocompleteResultView* CreateResultView( |
| 87 AutocompleteResultViewModel* model, | 91 AutocompleteResultViewModel* model, |
| 88 int model_index, | 92 int model_index, |
| 89 const gfx::Font& font, | 93 const gfx::Font& font, |
| 90 const gfx::Font& bold_font); | 94 const gfx::Font& bold_font); |
| 91 | 95 |
| 92 scoped_ptr<AutocompletePopupModel> model_; | 96 scoped_ptr<AutocompletePopupModel> model_; |
| 93 | 97 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 // The popup sizes vertically using an animation when the popup is getting | 171 // The popup sizes vertically using an animation when the popup is getting |
| 168 // shorter (not larger, that makes it look "slow"). | 172 // shorter (not larger, that makes it look "slow"). |
| 169 ui::SlideAnimation size_animation_; | 173 ui::SlideAnimation size_animation_; |
| 170 gfx::Rect start_bounds_; | 174 gfx::Rect start_bounds_; |
| 171 gfx::Rect target_bounds_; | 175 gfx::Rect target_bounds_; |
| 172 | 176 |
| 173 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 177 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
| 174 }; | 178 }; |
| 175 | 179 |
| 176 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW _H_ | 180 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW _H_ |
| OLD | NEW |