| 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 "components/omnibox/browser/autocomplete_match.h" | 10 #include "components/omnibox/browser/autocomplete_match.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // class, this is the height of one line of text. | 76 // class, this is the height of one line of text. |
| 77 virtual int GetTextHeight() const; | 77 virtual int GetTextHeight() const; |
| 78 | 78 |
| 79 // Returns the display width required for the match contents. | 79 // Returns the display width required for the match contents. |
| 80 int GetMatchContentsWidth() const; | 80 int GetMatchContentsWidth() const; |
| 81 | 81 |
| 82 // Stores the image in a local data member and schedules a repaint. | 82 // Stores the image in a local data member and schedules a repaint. |
| 83 void SetAnswerImage(const gfx::ImageSkia& image); | 83 void SetAnswerImage(const gfx::ImageSkia& image); |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 enum RenderTextType { |
| 87 CONTENTS = 0, |
| 88 SEPARATOR, |
| 89 DESCRIPTION, |
| 90 NUM_TYPES |
| 91 }; |
| 92 |
| 86 // Paints the given |match| using the RenderText instances |contents| and | 93 // Paints the given |match| using the RenderText instances |contents| and |
| 87 // |description| at offset |x| in the bounds of this view. | 94 // |description| at offset |x| in the bounds of this view. |
| 88 virtual void PaintMatch(const AutocompleteMatch& match, | 95 virtual void PaintMatch(const AutocompleteMatch& match, |
| 89 gfx::RenderText* contents, | 96 gfx::RenderText* contents, |
| 90 gfx::RenderText* description, | 97 gfx::RenderText* description, |
| 91 gfx::Canvas* canvas, | 98 gfx::Canvas* canvas, |
| 92 int x) const; | 99 int x) const; |
| 93 | 100 |
| 94 // Draws given |render_text| on |canvas| at given location (|x|, |y|). | 101 // Draws given |render_text| on |canvas| at given location (|x|, |y|). |
| 95 // |contents| indicates whether the |render_text| is for the match contents | 102 // |contents| indicates if the |render_text| is for the match contents, |
| 96 // (rather than the separator or the description). Additional properties from | 103 // separator, or description. Additional properties from |match| are used to |
| 97 // |match| are used to render Infinite suggestions correctly. If |max_width| | 104 // render Infinite suggestions correctly. If |max_width| is a non-negative |
| 98 // is a non-negative number, the text will be elided to fit within | 105 // number, the text will be elided to fit within |max_width|. Returns the x |
| 99 // |max_width|. Returns the x position to the right of the string. | 106 // position to the right of the string. |
| 100 int DrawRenderText(const AutocompleteMatch& match, | 107 int DrawRenderText(const AutocompleteMatch& match, |
| 101 gfx::RenderText* render_text, | 108 gfx::RenderText* render_text, |
| 102 bool contents, | 109 RenderTextType render_text_type, |
| 103 gfx::Canvas* canvas, | 110 gfx::Canvas* canvas, |
| 104 int x, | 111 int x, |
| 105 int y, | 112 int y, |
| 106 int max_width) const; | 113 int max_width) const; |
| 107 | 114 |
| 108 // Creates a RenderText with given |text| and rendering defaults. | 115 // Creates a RenderText with given |text| and rendering defaults. |
| 109 scoped_ptr<gfx::RenderText> CreateRenderText( | 116 scoped_ptr<gfx::RenderText> CreateRenderText( |
| 110 const base::string16& text) const; | 117 const base::string16& text) const; |
| 111 | 118 |
| 112 // Creates a RenderText with default rendering for the given |text|. The | 119 // Creates a RenderText with default rendering for the given |text|. The |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; | 224 mutable scoped_ptr<gfx::RenderText> separator_rendertext_; |
| 218 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; | 225 mutable scoped_ptr<gfx::RenderText> keyword_contents_rendertext_; |
| 219 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; | 226 mutable scoped_ptr<gfx::RenderText> keyword_description_rendertext_; |
| 220 | 227 |
| 221 mutable int separator_width_; | 228 mutable int separator_width_; |
| 222 | 229 |
| 223 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); | 230 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); |
| 224 }; | 231 }; |
| 225 | 232 |
| 226 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ | 233 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ |
| OLD | NEW |