Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.h

Issue 15745031: Restyle omnibox popup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove code from toolbar. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/base/animation/animation_delegate.h" 12 #include "ui/base/animation/animation_delegate.h"
13 #include "ui/base/animation/slide_animation.h" 13 #include "ui/base/animation/slide_animation.h"
14 #include "ui/gfx/font.h" 14 #include "ui/gfx/font.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
17 #include "ui/views/view.h" 17 #include "ui/views/view.h"
18 18
19 class LocationBarView;
19 class OmniboxResultViewModel; 20 class OmniboxResultViewModel;
20 21
21 namespace gfx { 22 namespace gfx {
22 class Canvas; 23 class Canvas;
23 class RenderText; 24 class RenderText;
24 } 25 }
25 26
26 class OmniboxResultView : public views::View, 27 class OmniboxResultView : public views::View,
27 private ui::AnimationDelegate { 28 private ui::AnimationDelegate {
28 public: 29 public:
(...skipping 10 matching lines...) Expand all
39 BACKGROUND = 0, 40 BACKGROUND = 0,
40 TEXT, 41 TEXT,
41 DIMMED_TEXT, 42 DIMMED_TEXT,
42 URL, 43 URL,
43 DIVIDER, 44 DIVIDER,
44 NUM_KINDS 45 NUM_KINDS
45 }; 46 };
46 47
47 OmniboxResultView(OmniboxResultViewModel* model, 48 OmniboxResultView(OmniboxResultViewModel* model,
48 int model_index, 49 int model_index,
49 views::View* location_bar, 50 LocationBarView* location_bar_view,
50 const gfx::Font& font); 51 const gfx::Font& font);
51 virtual ~OmniboxResultView(); 52 virtual ~OmniboxResultView();
52 53
53 SkColor GetColor(ResultViewState state, ColorKind kind) const; 54 SkColor GetColor(ResultViewState state, ColorKind kind) const;
54 55
55 // Updates the match used to paint the contents of this result view. We copy 56 // Updates the match used to paint the contents of this result view. We copy
56 // the match so that we can continue to paint the last result even after the 57 // the match so that we can continue to paint the last result even after the
57 // model has changed. 58 // model has changed.
58 void SetMatch(const AutocompleteMatch& match); 59 void SetMatch(const AutocompleteMatch& match);
59 60
60 void ShowKeyword(bool show_keyword); 61 void ShowKeyword(bool show_keyword);
61 62
62 void Invalidate(); 63 void Invalidate();
63 64
64 // views::View: 65 // views::View:
65 virtual gfx::Size GetPreferredSize() OVERRIDE; 66 virtual gfx::Size GetPreferredSize() OVERRIDE;
66 67
67 ResultViewState GetState() const; 68 ResultViewState GetState() const;
68 69
70 // Returns the height of the text portion of the result view. In the base
71 // class, this is the height of one line of text.
72 virtual int GetTextHeight() const;
73
69 protected: 74 protected:
70 virtual void PaintMatch(gfx::Canvas* canvas, 75 virtual void PaintMatch(gfx::Canvas* canvas,
71 const AutocompleteMatch& match, 76 const AutocompleteMatch& match,
72 int x); 77 int x);
73 78
74 // Returns the height of the text portion of the result view. In the base
75 // class, this is the height of one line of text.
76 virtual int GetTextHeight() const;
77
78 // Draws the specified |text| into the canvas, using highlighting provided by 79 // Draws the specified |text| into the canvas, using highlighting provided by
79 // |classifications|. If |force_dim| is true, ACMatchClassification::DIM is 80 // |classifications|. If |force_dim| is true, ACMatchClassification::DIM is
80 // added to all of the classifications. Returns the x position to the right 81 // added to all of the classifications. Returns the x position to the right
81 // of the string. 82 // of the string.
82 int DrawString(gfx::Canvas* canvas, 83 int DrawString(gfx::Canvas* canvas,
83 const string16& text, 84 const string16& text,
84 const ACMatchClassifications& classifications, 85 const ACMatchClassifications& classifications,
85 bool force_dim, 86 bool force_dim,
86 int x, 87 int x,
87 int y); 88 int y);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 139
139 // Default values cached here, may be overridden using the setters above. 140 // Default values cached here, may be overridden using the setters above.
140 int edge_item_padding_; 141 int edge_item_padding_;
141 int item_padding_; 142 int item_padding_;
142 int minimum_text_vertical_padding_; 143 int minimum_text_vertical_padding_;
143 144
144 // This row's model and model index. 145 // This row's model and model index.
145 OmniboxResultViewModel* model_; 146 OmniboxResultViewModel* model_;
146 size_t model_index_; 147 size_t model_index_;
147 148
148 views::View* location_bar_; 149 LocationBarView* location_bar_view_;
149 150
150 const gfx::Font font_; 151 const gfx::Font font_;
151 int font_height_; 152 int font_height_;
152 153
153 // Width of the ellipsis in the normal font. 154 // Width of the ellipsis in the normal font.
154 int ellipsis_width_; 155 int ellipsis_width_;
155 156
156 // A context used for mirroring regions. 157 // A context used for mirroring regions.
157 class MirroringContext; 158 class MirroringContext;
158 scoped_ptr<MirroringContext> mirroring_context_; 159 scoped_ptr<MirroringContext> mirroring_context_;
159 160
160 AutocompleteMatch match_; 161 AutocompleteMatch match_;
161 162
162 gfx::Rect text_bounds_; 163 gfx::Rect text_bounds_;
163 gfx::Rect icon_bounds_; 164 gfx::Rect icon_bounds_;
164 165
165 gfx::Rect keyword_text_bounds_; 166 gfx::Rect keyword_text_bounds_;
166 scoped_ptr<views::ImageView> keyword_icon_; 167 scoped_ptr<views::ImageView> keyword_icon_;
167 168
168 scoped_ptr<ui::SlideAnimation> animation_; 169 scoped_ptr<ui::SlideAnimation> animation_;
169 170
170 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); 171 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
171 }; 172 };
172 173
173 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 174 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698