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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
12 #include "ui/base/animation/slide_animation.h"
11 #include "ui/gfx/font.h" 13 #include "ui/gfx/font.h"
12 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
13 #include "views/view.h" 15 #include "views/view.h"
14 16
15 class AutocompleteResultViewModel; 17 class AutocompleteResultViewModel;
16 namespace gfx { 18 namespace gfx {
17 class Canvas; 19 class Canvas;
18 } 20 }
19 21
20 class AutocompleteResultView : public views::View { 22 class AutocompleteResultView : public views::View,
23 private ui::AnimationDelegate {
21 public: 24 public:
22 enum ResultViewState { 25 enum ResultViewState {
23 NORMAL = 0, 26 NORMAL = 0,
24 SELECTED, 27 SELECTED,
25 HOVERED, 28 HOVERED,
26 NUM_STATES 29 NUM_STATES
27 }; 30 };
28 31
29 enum ColorKind { 32 enum ColorKind {
30 BACKGROUND = 0, 33 BACKGROUND = 0,
31 TEXT, 34 TEXT,
32 DIMMED_TEXT, 35 DIMMED_TEXT,
33 URL, 36 URL,
34 NUM_KINDS 37 NUM_KINDS
35 }; 38 };
36 39
37 AutocompleteResultView(AutocompleteResultViewModel* model, 40 AutocompleteResultView(AutocompleteResultViewModel* model,
38 int model_index, 41 int model_index,
39 const gfx::Font& font, 42 const gfx::Font& font,
40 const gfx::Font& bold_font); 43 const gfx::Font& bold_font);
41 virtual ~AutocompleteResultView(); 44 virtual ~AutocompleteResultView();
42 45
43 // Updates the match used to paint the contents of this result view. We copy 46 // Updates the match used to paint the contents of this result view. We copy
44 // the match so that we can continue to paint the last result even after the 47 // the match so that we can continue to paint the last result even after the
45 // model has changed. 48 // model has changed.
46 void set_match(const AutocompleteMatch& match) { match_ = match; } 49 void SetMatch(const AutocompleteMatch& match);
47 const gfx::Font& normal_font() const { return normal_font_; } 50 const gfx::Font& normal_font() const { return normal_font_; }
48 const gfx::Font& bold_font() const { return bold_font_; } 51 const gfx::Font& bold_font() const { return bold_font_; }
49 const gfx::Rect& text_bounds() const { return text_bounds_; } 52 const gfx::Rect& text_bounds() const { return text_bounds_; }
50 void set_text_bounds(const gfx::Rect& tb) { text_bounds_ = tb; } 53 void set_text_bounds(const gfx::Rect& tb) { text_bounds_ = tb; }
51 54
52 // Overridden from views::View: 55 // Overridden from views::View:
53 virtual void OnPaint(gfx::Canvas* canvas); 56 virtual void OnPaint(gfx::Canvas* canvas);
54 virtual void Layout(); 57 virtual void Layout();
55 virtual gfx::Size GetPreferredSize(); 58 virtual gfx::Size GetPreferredSize();
56 59
(...skipping 15 matching lines...) Expand all
72 int DrawString(gfx::Canvas* canvas, 75 int DrawString(gfx::Canvas* canvas,
73 const string16& text, 76 const string16& text,
74 const ACMatchClassifications& classifications, 77 const ACMatchClassifications& classifications,
75 bool force_dim, 78 bool force_dim,
76 int x, 79 int x,
77 int y); 80 int y);
78 81
79 int icon_vertical_padding_; 82 int icon_vertical_padding_;
80 int text_vertical_padding_; 83 int text_vertical_padding_;
81 84
85 // ui::AnimationDelegate:
86 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
87
82 private: 88 private:
83 struct ClassificationData; 89 struct ClassificationData;
84 typedef std::vector<ClassificationData> Classifications; 90 typedef std::vector<ClassificationData> Classifications;
85 91
86 struct RunData; 92 struct RunData;
87 typedef std::vector<RunData> Runs; 93 typedef std::vector<RunData> Runs;
88 94
89 // Predicate functions for use when sorting the runs. 95 // Predicate functions for use when sorting the runs.
90 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); 96 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs);
91 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); 97 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 int ellipsis_width_; 129 int ellipsis_width_;
124 130
125 // A context used for mirroring regions. 131 // A context used for mirroring regions.
126 class MirroringContext; 132 class MirroringContext;
127 scoped_ptr<MirroringContext> mirroring_context_; 133 scoped_ptr<MirroringContext> mirroring_context_;
128 134
129 // Layout rects for various sub-components of the view. 135 // Layout rects for various sub-components of the view.
130 gfx::Rect icon_bounds_; 136 gfx::Rect icon_bounds_;
131 gfx::Rect text_bounds_; 137 gfx::Rect text_bounds_;
132 138
139 class IconLabelView;
140 scoped_ptr<IconLabelView> search_view_;
141
133 AutocompleteMatch match_; 142 AutocompleteMatch match_;
134 143
144 scoped_ptr<ui::SlideAnimation> animation_;
145
135 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); 146 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView);
136 }; 147 };
137 148
138 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ 149 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698