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 27 matching lines...) Expand all Loading... |
38 // A view representing the contents of the autocomplete popup. | 38 // A view representing the contents of the autocomplete popup. |
39 class AutocompletePopupContentsView : public views::View, | 39 class AutocompletePopupContentsView : public views::View, |
40 public AutocompleteResultViewModel, | 40 public AutocompleteResultViewModel, |
41 public AutocompletePopupView, | 41 public AutocompletePopupView, |
42 public AnimationDelegate { | 42 public AnimationDelegate { |
43 public: | 43 public: |
44 AutocompletePopupContentsView(const gfx::Font& font, | 44 AutocompletePopupContentsView(const gfx::Font& font, |
45 AutocompleteEditView* edit_view, | 45 AutocompleteEditView* edit_view, |
46 AutocompleteEditModel* edit_model, | 46 AutocompleteEditModel* edit_model, |
47 Profile* profile, | 47 Profile* profile, |
48 const BubblePositioner* bubble_positioner); | 48 const views::View* location_bar); |
49 virtual ~AutocompletePopupContentsView() {} | 49 virtual ~AutocompletePopupContentsView() {} |
50 | 50 |
51 // Returns the bounds the popup should be shown at. This is the display bounds | 51 // Returns the bounds the popup should be shown at. This is the display bounds |
52 // and includes offsets for the dropshadow which this view's border renders. | 52 // and includes offsets for the dropshadow which this view's border renders. |
53 gfx::Rect GetPopupBounds() const; | 53 gfx::Rect GetPopupBounds() const; |
54 | 54 |
55 // Overridden from AutocompletePopupView: | 55 // Overridden from AutocompletePopupView: |
56 virtual bool IsOpen() const; | 56 virtual bool IsOpen() const; |
57 virtual void InvalidateLine(size_t line); | 57 virtual void InvalidateLine(size_t line); |
58 virtual void UpdatePopupAppearance(); | 58 virtual void UpdatePopupAppearance(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // The popup that contains this view. | 116 // The popup that contains this view. |
117 scoped_ptr<AutocompletePopupClass> popup_; | 117 scoped_ptr<AutocompletePopupClass> popup_; |
118 | 118 |
119 // The provider of our result set. | 119 // The provider of our result set. |
120 scoped_ptr<AutocompletePopupModel> model_; | 120 scoped_ptr<AutocompletePopupModel> model_; |
121 | 121 |
122 // The edit view that invokes us. | 122 // The edit view that invokes us. |
123 AutocompleteEditView* edit_view_; | 123 AutocompleteEditView* edit_view_; |
124 | 124 |
125 // An object that tells the popup how to position itself. | 125 // An object that the popup positions itself against. |
126 const BubblePositioner* bubble_positioner_; | 126 const views::View* location_bar_; |
127 | 127 |
128 // Our border, which can compute our desired bounds. | 128 // Our border, which can compute our desired bounds. |
129 const BubbleBorder* bubble_border_; | 129 const BubbleBorder* bubble_border_; |
130 | 130 |
131 // The font that we should use for result rows. This is based on the font used | 131 // The font that we should use for result rows. This is based on the font used |
132 // by the edit that created us. | 132 // by the edit that created us. |
133 gfx::Font result_font_; | 133 gfx::Font result_font_; |
134 | 134 |
135 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have | 135 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have |
136 // a convenient way to release mouse capture. Instead we use this flag to | 136 // a convenient way to release mouse capture. Instead we use this flag to |
137 // simply ignore all remaining drag events, and the eventual mouse release | 137 // simply ignore all remaining drag events, and the eventual mouse release |
138 // event. Since OnDragCanceled() can be called when we're not dragging, this | 138 // event. Since OnDragCanceled() can be called when we're not dragging, this |
139 // flag is reset to false on a mouse pressed event, to make sure we don't | 139 // flag is reset to false on a mouse pressed event, to make sure we don't |
140 // erroneously ignore the next drag. | 140 // erroneously ignore the next drag. |
141 bool ignore_mouse_drag_; | 141 bool ignore_mouse_drag_; |
142 | 142 |
143 // The popup sizes vertically using an animation when the popup is getting | 143 // The popup sizes vertically using an animation when the popup is getting |
144 // shorter (not larger, that makes it look "slow"). | 144 // shorter (not larger, that makes it look "slow"). |
145 SlideAnimation size_animation_; | 145 SlideAnimation size_animation_; |
146 gfx::Rect start_bounds_; | 146 gfx::Rect start_bounds_; |
147 gfx::Rect target_bounds_; | 147 gfx::Rect target_bounds_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); | 149 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupContentsView); |
150 }; | 150 }; |
151 | 151 |
152 #endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ | 152 #endif // CHROME_BROWSER_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ |
OLD | NEW |