| 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_RESULT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 enum ColorKind { | 41 enum ColorKind { |
| 42 BACKGROUND = 0, | 42 BACKGROUND = 0, |
| 43 TEXT, | 43 TEXT, |
| 44 DIMMED_TEXT, | 44 DIMMED_TEXT, |
| 45 URL, | 45 URL, |
| 46 DIVIDER, | 46 DIVIDER, |
| 47 NUM_KINDS | 47 NUM_KINDS |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // The minimum distance between the top and bottom of the text and the |
| 51 // top or bottom of the row. |
| 52 static const int kMinimumTextVerticalPadding = 3; |
| 53 |
| 50 OmniboxResultView(OmniboxPopupContentsView* model, | 54 OmniboxResultView(OmniboxPopupContentsView* model, |
| 51 int model_index, | 55 int model_index, |
| 52 LocationBarView* location_bar_view, | 56 LocationBarView* location_bar_view, |
| 53 const gfx::FontList& font_list); | 57 const gfx::FontList& font_list); |
| 54 ~OmniboxResultView() override; | 58 ~OmniboxResultView() override; |
| 55 | 59 |
| 56 SkColor GetColor(ResultViewState state, ColorKind kind) const; | 60 SkColor GetColor(ResultViewState state, ColorKind kind) const; |
| 57 | 61 |
| 58 // Updates the match used to paint the contents of this result view. We copy | 62 // Updates the match used to paint the contents of this result view. We copy |
| 59 // the match so that we can continue to paint the last result even after the | 63 // the match so that we can continue to paint the last result even after the |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // |classifications| and |force_dim| are used to style the text. | 114 // |classifications| and |force_dim| are used to style the text. |
| 111 scoped_ptr<gfx::RenderText> CreateClassifiedRenderText( | 115 scoped_ptr<gfx::RenderText> CreateClassifiedRenderText( |
| 112 const base::string16& text, | 116 const base::string16& text, |
| 113 const ACMatchClassifications& classifications, | 117 const ACMatchClassifications& classifications, |
| 114 bool force_dim) const; | 118 bool force_dim) const; |
| 115 | 119 |
| 116 const gfx::Rect& text_bounds() const { return text_bounds_; } | 120 const gfx::Rect& text_bounds() const { return text_bounds_; } |
| 117 | 121 |
| 118 void set_edge_item_padding(int value) { edge_item_padding_ = value; } | 122 void set_edge_item_padding(int value) { edge_item_padding_ = value; } |
| 119 void set_item_padding(int value) { item_padding_ = value; } | 123 void set_item_padding(int value) { item_padding_ = value; } |
| 120 void set_minimum_text_vertical_padding(int value) { | |
| 121 minimum_text_vertical_padding_ = value; | |
| 122 } | |
| 123 | 124 |
| 124 private: | 125 private: |
| 125 // views::View: | 126 // views::View: |
| 126 const char* GetClassName() const override; | 127 const char* GetClassName() const override; |
| 127 | 128 |
| 128 gfx::ImageSkia GetIcon() const; | 129 gfx::ImageSkia GetIcon() const; |
| 129 const gfx::ImageSkia* GetKeywordIcon() const; | 130 const gfx::ImageSkia* GetKeywordIcon() const; |
| 130 | 131 |
| 131 // Whether to render only the keyword match. Returns true if |match_| has an | 132 // Whether to render only the keyword match. Returns true if |match_| has an |
| 132 // associated keyword match that has been animated so close to the start that | 133 // associated keyword match that has been animated so close to the start that |
| (...skipping 20 matching lines...) Expand all Loading... |
| 153 // to determine the offset relative to the correct edge. | 154 // to determine the offset relative to the correct edge. |
| 154 int GetDisplayOffset(const AutocompleteMatch& match, | 155 int GetDisplayOffset(const AutocompleteMatch& match, |
| 155 bool is_ui_rtl, | 156 bool is_ui_rtl, |
| 156 bool is_match_contents_rtl) const; | 157 bool is_match_contents_rtl) const; |
| 157 | 158 |
| 158 static int default_icon_size_; | 159 static int default_icon_size_; |
| 159 | 160 |
| 160 // Default values cached here, may be overridden using the setters above. | 161 // Default values cached here, may be overridden using the setters above. |
| 161 int edge_item_padding_; | 162 int edge_item_padding_; |
| 162 int item_padding_; | 163 int item_padding_; |
| 163 int minimum_text_vertical_padding_; | |
| 164 | 164 |
| 165 // This row's model and model index. | 165 // This row's model and model index. |
| 166 OmniboxPopupContentsView* model_; | 166 OmniboxPopupContentsView* model_; |
| 167 size_t model_index_; | 167 size_t model_index_; |
| 168 | 168 |
| 169 LocationBarView* location_bar_view_; | 169 LocationBarView* location_bar_view_; |
| 170 // Note: image_service_ may be null in some unit tests. | 170 // Note: image_service_ may be null in some unit tests. |
| 171 BitmapFetcherService* image_service_; | 171 BitmapFetcherService* image_service_; |
| 172 | 172 |
| 173 const gfx::FontList font_list_; | 173 const gfx::FontList font_list_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 201 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; | 201 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; |
| 202 | 202 |
| 203 mutable int separator_width_; | 203 mutable int separator_width_; |
| 204 | 204 |
| 205 base::WeakPtrFactory<OmniboxResultView> weak_ptr_factory_; | 205 base::WeakPtrFactory<OmniboxResultView> weak_ptr_factory_; |
| 206 | 206 |
| 207 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 207 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 210 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
| OLD | NEW |