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 "chrome/browser/autocomplete/autocomplete_match.h" | 8 #include "chrome/browser/autocomplete/autocomplete_match.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 DIVIDER, | 40 DIVIDER, |
41 NUM_KINDS | 41 NUM_KINDS |
42 }; | 42 }; |
43 | 43 |
44 OmniboxResultView(OmniboxResultViewModel* model, | 44 OmniboxResultView(OmniboxResultViewModel* model, |
45 int model_index, | 45 int model_index, |
46 const gfx::Font& font, | 46 const gfx::Font& font, |
47 const gfx::Font& bold_font); | 47 const gfx::Font& bold_font); |
48 virtual ~OmniboxResultView(); | 48 virtual ~OmniboxResultView(); |
49 | 49 |
50 static SkColor GetColor(ResultViewState state, ColorKind kind); | 50 SkColor GetColor(ResultViewState state, ColorKind kind) const; |
51 | 51 |
52 // Updates the match used to paint the contents of this result view. We copy | 52 // Updates the match used to paint the contents of this result view. We copy |
53 // the match so that we can continue to paint the last result even after the | 53 // the match so that we can continue to paint the last result even after the |
54 // model has changed. | 54 // model has changed. |
55 void SetMatch(const AutocompleteMatch& match); | 55 void SetMatch(const AutocompleteMatch& match); |
56 | 56 |
57 void ShowKeyword(bool show_keyword); | 57 void ShowKeyword(bool show_keyword); |
58 | 58 |
59 void Invalidate(); | 59 void Invalidate(); |
60 | 60 |
(...skipping 30 matching lines...) Expand all Loading... |
91 minimum_text_vertical_padding_ = value; | 91 minimum_text_vertical_padding_ = value; |
92 } | 92 } |
93 | 93 |
94 private: | 94 private: |
95 struct ClassificationData; | 95 struct ClassificationData; |
96 typedef std::vector<ClassificationData> Classifications; | 96 typedef std::vector<ClassificationData> Classifications; |
97 | 97 |
98 struct RunData; | 98 struct RunData; |
99 typedef std::vector<RunData> Runs; | 99 typedef std::vector<RunData> Runs; |
100 | 100 |
| 101 // Common initialization code of the colors returned by GetColors(). |
| 102 static void CommonInitColors(const ui::NativeTheme* theme, |
| 103 SkColor colors[][NUM_KINDS]); |
| 104 |
101 // Predicate functions for use when sorting the runs. | 105 // Predicate functions for use when sorting the runs. |
102 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); | 106 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); |
103 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); | 107 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); |
104 | 108 |
105 gfx::ImageSkia GetIcon() const; | 109 gfx::ImageSkia GetIcon() const; |
106 const gfx::ImageSkia* GetKeywordIcon() const; | 110 const gfx::ImageSkia* GetKeywordIcon() const; |
107 | 111 |
108 // Elides |runs| to fit in |remaining_width|. The runs in |runs| should be in | 112 // Elides |runs| to fit in |remaining_width|. The runs in |runs| should be in |
109 // logical order. | 113 // logical order. |
110 // | 114 // |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 161 |
158 gfx::Rect keyword_text_bounds_; | 162 gfx::Rect keyword_text_bounds_; |
159 scoped_ptr<views::ImageView> keyword_icon_; | 163 scoped_ptr<views::ImageView> keyword_icon_; |
160 | 164 |
161 scoped_ptr<ui::SlideAnimation> animation_; | 165 scoped_ptr<ui::SlideAnimation> animation_; |
162 | 166 |
163 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 167 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
164 }; | 168 }; |
165 | 169 |
166 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 170 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
OLD | NEW |