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

Side by Side Diff: chrome/browser/ui/views/autocomplete/autocomplete_result_view.h

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/autocomplete/autocomplete_match.h" 9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/base/animation/animation_delegate.h" 11 #include "ui/base/animation/animation_delegate.h"
12 #include "ui/base/animation/slide_animation.h" 12 #include "ui/base/animation/slide_animation.h"
13 #include "ui/gfx/font.h" 13 #include "ui/gfx/font.h"
14 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
15 #include "ui/views/controls/image_view.h" 15 #include "ui/views/controls/image_view.h"
16 #include "ui/views/view.h" 16 #include "ui/views/view.h"
17 17
18 class AutocompleteResultViewModel; 18 class AutocompleteResultViewModel;
19 19
20 namespace gfx { 20 namespace gfx {
21 class Canvas; 21 class CanvasSkia;
22 } 22 }
23 23
24 class AutocompleteResultView : public views::View, 24 class AutocompleteResultView : public views::View,
25 private ui::AnimationDelegate { 25 private ui::AnimationDelegate {
26 public: 26 public:
27 enum ResultViewState { 27 enum ResultViewState {
28 NORMAL = 0, 28 NORMAL = 0,
29 SELECTED, 29 SELECTED,
30 HOVERED, 30 HOVERED,
31 NUM_STATES 31 NUM_STATES
(...skipping 21 matching lines...) Expand all
53 void SetMatch(const AutocompleteMatch& match); 53 void SetMatch(const AutocompleteMatch& match);
54 54
55 void ShowKeyword(bool show_keyword); 55 void ShowKeyword(bool show_keyword);
56 56
57 void Invalidate(); 57 void Invalidate();
58 58
59 // views::View: 59 // views::View:
60 virtual gfx::Size GetPreferredSize() OVERRIDE; 60 virtual gfx::Size GetPreferredSize() OVERRIDE;
61 61
62 protected: 62 protected:
63 virtual void PaintMatch(gfx::Canvas* canvas, 63 virtual void PaintMatch(gfx::CanvasSkia* canvas,
64 const AutocompleteMatch& match, 64 const AutocompleteMatch& match,
65 int x); 65 int x);
66 66
67 // Returns the height of the text portion of the result view. In the base 67 // Returns the height of the text portion of the result view. In the base
68 // class, this is the height of one line of text. 68 // class, this is the height of one line of text.
69 virtual int GetTextHeight() const; 69 virtual int GetTextHeight() const;
70 70
71 // Draws the specified |text| into the canvas, using highlighting provided by 71 // Draws the specified |text| into the canvas, using highlighting provided by
72 // |classifications|. If |force_dim| is true, ACMatchClassification::DIM is 72 // |classifications|. If |force_dim| is true, ACMatchClassification::DIM is
73 // added to all of the classifications. Returns the x position to the right 73 // added to all of the classifications. Returns the x position to the right
74 // of the string. 74 // of the string.
75 int DrawString(gfx::Canvas* canvas, 75 int DrawString(gfx::CanvasSkia* canvas,
76 const string16& text, 76 const string16& text,
77 const ACMatchClassifications& classifications, 77 const ACMatchClassifications& classifications,
78 bool force_dim, 78 bool force_dim,
79 int x, 79 int x,
80 int y); 80 int y);
81 81
82 const gfx::Rect& text_bounds() const { return text_bounds_; } 82 const gfx::Rect& text_bounds() const { return text_bounds_; }
83 83
84 private: 84 private:
85 struct ClassificationData; 85 struct ClassificationData;
(...skipping 22 matching lines...) Expand all
108 // LTR_STRING GNIRTS_LTR 108 // LTR_STRING GNIRTS_LTR
109 // If we need to elide the RTL run, then it will be drawn like: 109 // If we need to elide the RTL run, then it will be drawn like:
110 // LTR_STRING ...RTS_LTR 110 // LTR_STRING ...RTS_LTR
111 // Instead of: 111 // Instead of:
112 // LTR_STRING RTS_LTR... 112 // LTR_STRING RTS_LTR...
113 void Elide(Runs* runs, int remaining_width) const; 113 void Elide(Runs* runs, int remaining_width) const;
114 114
115 // views::View: 115 // views::View:
116 virtual void Layout() OVERRIDE; 116 virtual void Layout() OVERRIDE;
117 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 117 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
118 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 118 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE;
119 119
120 // ui::AnimationDelegate: 120 // ui::AnimationDelegate:
121 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 121 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
122 122
123 static int default_icon_size_; 123 static int default_icon_size_;
124 124
125 // This row's model and model index. 125 // This row's model and model index.
126 AutocompleteResultViewModel* model_; 126 AutocompleteResultViewModel* model_;
127 size_t model_index_; 127 size_t model_index_;
128 128
(...skipping 14 matching lines...) Expand all
143 143
144 gfx::Rect keyword_text_bounds_; 144 gfx::Rect keyword_text_bounds_;
145 scoped_ptr<views::ImageView> keyword_icon_; 145 scoped_ptr<views::ImageView> keyword_icon_;
146 146
147 scoped_ptr<ui::SlideAnimation> animation_; 147 scoped_ptr<ui::SlideAnimation> animation_;
148 148
149 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); 149 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView);
150 }; 150 };
151 151
152 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ 152 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698