| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 10 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 OmniboxPopupContentsView(const gfx::Font& font, | 78 OmniboxPopupContentsView(const gfx::Font& font, |
| 79 OmniboxView* omnibox_view, | 79 OmniboxView* omnibox_view, |
| 80 OmniboxEditModel* edit_model, | 80 OmniboxEditModel* edit_model, |
| 81 views::View* location_bar); | 81 views::View* location_bar); |
| 82 virtual ~OmniboxPopupContentsView(); | 82 virtual ~OmniboxPopupContentsView(); |
| 83 | 83 |
| 84 virtual void PaintResultViews(gfx::Canvas* canvas); | 84 virtual void PaintResultViews(gfx::Canvas* canvas); |
| 85 | 85 |
| 86 // Calculates the height needed to show all the results in the model. | 86 // Calculates the height needed to show all the results in the model. |
| 87 virtual int CalculatePopupHeight(); | 87 virtual int CalculatePopupHeight(); |
| 88 virtual OmniboxResultView* CreateResultView( | 88 virtual OmniboxResultView* CreateResultView(OmniboxResultViewModel* model, |
| 89 OmniboxResultViewModel* model, | 89 int model_index, |
| 90 int model_index, | 90 const gfx::Font& font); |
| 91 const gfx::Font& font, | |
| 92 const gfx::Font& bold_font); | |
| 93 | 91 |
| 94 // Overridden from views::View: | 92 // Overridden from views::View: |
| 95 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 93 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 96 // This method should not be triggered directly as we paint our children | 94 // This method should not be triggered directly as we paint our children |
| 97 // in an un-conventional way inside OnPaint. We use a separate canvas to | 95 // in an un-conventional way inside OnPaint. We use a separate canvas to |
| 98 // paint the children. Hence we override this method to a no-op so that | 96 // paint the children. Hence we override this method to a no-op so that |
| 99 // the view hierarchy does not "accidentally" trigger this. | 97 // the view hierarchy does not "accidentally" trigger this. |
| 100 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 98 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 101 | 99 |
| 102 scoped_ptr<OmniboxPopupModel> model_; | 100 scoped_ptr<OmniboxPopupModel> model_; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 OmniboxView* omnibox_view_; | 155 OmniboxView* omnibox_view_; |
| 158 | 156 |
| 159 Profile* profile_; | 157 Profile* profile_; |
| 160 | 158 |
| 161 // An object that the popup positions itself against. | 159 // An object that the popup positions itself against. |
| 162 views::View* location_bar_; | 160 views::View* location_bar_; |
| 163 | 161 |
| 164 // Our border, which can compute our desired bounds. | 162 // Our border, which can compute our desired bounds. |
| 165 const views::BubbleBorder* bubble_border_; | 163 const views::BubbleBorder* bubble_border_; |
| 166 | 164 |
| 167 // The font that we should use for result rows. This is based on the font used | 165 // The font used for result rows, based on the omnibox font. |
| 168 // by the edit that created us. | 166 gfx::Font font_; |
| 169 gfx::Font result_font_; | |
| 170 | |
| 171 // The font used for portions that match the input. | |
| 172 gfx::Font result_bold_font_; | |
| 173 | 167 |
| 174 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have | 168 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have |
| 175 // a convenient way to release mouse capture. Instead we use this flag to | 169 // a convenient way to release mouse capture. Instead we use this flag to |
| 176 // simply ignore all remaining drag events, and the eventual mouse release | 170 // simply ignore all remaining drag events, and the eventual mouse release |
| 177 // event. Since OnDragCanceled() can be called when we're not dragging, this | 171 // event. Since OnDragCanceled() can be called when we're not dragging, this |
| 178 // flag is reset to false on a mouse pressed event, to make sure we don't | 172 // flag is reset to false on a mouse pressed event, to make sure we don't |
| 179 // erroneously ignore the next drag. | 173 // erroneously ignore the next drag. |
| 180 bool ignore_mouse_drag_; | 174 bool ignore_mouse_drag_; |
| 181 | 175 |
| 182 // The popup sizes vertically using an animation when the popup is getting | 176 // The popup sizes vertically using an animation when the popup is getting |
| 183 // shorter (not larger, that makes it look "slow"). | 177 // shorter (not larger, that makes it look "slow"). |
| 184 ui::SlideAnimation size_animation_; | 178 ui::SlideAnimation size_animation_; |
| 185 gfx::Rect start_bounds_; | 179 gfx::Rect start_bounds_; |
| 186 gfx::Rect target_bounds_; | 180 gfx::Rect target_bounds_; |
| 187 | 181 |
| 188 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupContentsView); | 182 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupContentsView); |
| 189 }; | 183 }; |
| 190 | 184 |
| 191 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ | 185 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_POPUP_CONTENTS_VIEW_H_ |
| OLD | NEW |