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 "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 static void CommonInitColors(const ui::NativeTheme* theme, | 104 static void CommonInitColors(const ui::NativeTheme* theme, |
105 SkColor colors[][NUM_KINDS]); | 105 SkColor colors[][NUM_KINDS]); |
106 | 106 |
107 // Predicate functions for use when sorting the runs. | 107 // Predicate functions for use when sorting the runs. |
108 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); | 108 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); |
109 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); | 109 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); |
110 | 110 |
111 gfx::ImageSkia GetIcon() const; | 111 gfx::ImageSkia GetIcon() const; |
112 const gfx::ImageSkia* GetKeywordIcon() const; | 112 const gfx::ImageSkia* GetKeywordIcon() const; |
113 | 113 |
| 114 // Elides |runs| to fit in |remaining_width|. The runs in |runs| should be in |
| 115 // logical order. |
| 116 // |
| 117 // When we need to elide a run, the ellipsis will be placed at the end of that |
| 118 // run. This means that if we elide a run whose visual direction is opposite |
| 119 // that of the drawing context, the ellipsis will not be at the "end" of the |
| 120 // drawn string. For example, if in an LTR context we have the LTR run |
| 121 // "LTR_STRING" and the RTL run "RTL_STRING", the unelided text would be drawn |
| 122 // like: |
| 123 // LTR_STRING GNIRTS_LTR |
| 124 // If we need to elide the RTL run, then it will be drawn like: |
| 125 // LTR_STRING ...RTS_LTR |
| 126 // Instead of: |
| 127 // LTR_STRING RTS_LTR... |
| 128 void Elide(Runs* runs, int remaining_width) const; |
| 129 |
114 // views::View: | 130 // views::View: |
115 virtual void Layout() OVERRIDE; | 131 virtual void Layout() OVERRIDE; |
116 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 132 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
117 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 133 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
118 | 134 |
119 // gfx::AnimationDelegate: | 135 // gfx::AnimationDelegate: |
120 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 136 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
121 | 137 |
122 static int default_icon_size_; | 138 static int default_icon_size_; |
123 | 139 |
(...skipping 25 matching lines...) Expand all Loading... |
149 | 165 |
150 gfx::Rect keyword_text_bounds_; | 166 gfx::Rect keyword_text_bounds_; |
151 scoped_ptr<views::ImageView> keyword_icon_; | 167 scoped_ptr<views::ImageView> keyword_icon_; |
152 | 168 |
153 scoped_ptr<gfx::SlideAnimation> animation_; | 169 scoped_ptr<gfx::SlideAnimation> animation_; |
154 | 170 |
155 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 171 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
156 }; | 172 }; |
157 | 173 |
158 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 174 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
OLD | NEW |