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