OLD | NEW |
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_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
13 | 13 |
| 14 class LocationBarView; |
| 15 |
14 namespace gfx { | 16 namespace gfx { |
15 class Font; | 17 class Font; |
16 } | 18 } |
| 19 |
17 class Profile; | 20 class Profile; |
18 namespace views { | 21 namespace views { |
19 class Label; | 22 class Label; |
20 } | 23 } |
21 | 24 |
22 // KeywordHintView is used by the location bar view to display a hint to the | 25 // KeywordHintView is used by the location bar view to display a hint to the |
23 // user when the selected url has a corresponding keyword. | 26 // user when the selected url has a corresponding keyword. |
24 // | 27 // |
25 // Internally KeywordHintView uses two labels to render the text, and draws | 28 // Internally KeywordHintView uses two labels to render the text, and draws |
26 // the tab image itself. | 29 // the tab image itself. |
27 // | 30 // |
28 // NOTE: This should really be called LocationBarKeywordHintView, but I | 31 // NOTE: This should really be called LocationBarKeywordHintView, but I |
29 // couldn't bring myself to use such a long name. | 32 // couldn't bring myself to use such a long name. |
30 class KeywordHintView : public views::View { | 33 class KeywordHintView : public views::View { |
31 public: | 34 public: |
32 explicit KeywordHintView(Profile* profile); | 35 KeywordHintView(Profile* profile, const LocationBarView* location_bar_view); |
33 virtual ~KeywordHintView(); | 36 virtual ~KeywordHintView(); |
34 | 37 |
35 void SetFont(const gfx::Font& font); | 38 void SetFont(const gfx::Font& font); |
36 | 39 |
37 void SetKeyword(const string16& keyword); | 40 void SetKeyword(const string16& keyword); |
38 string16 keyword() const { return keyword_; } | 41 string16 keyword() const { return keyword_; } |
39 | 42 |
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 43 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
41 virtual gfx::Size GetPreferredSize() OVERRIDE; | 44 virtual gfx::Size GetPreferredSize() OVERRIDE; |
42 // The minimum size is just big enough to show the tab. | 45 // The minimum size is just big enough to show the tab. |
43 virtual gfx::Size GetMinimumSize() OVERRIDE; | 46 virtual gfx::Size GetMinimumSize() OVERRIDE; |
44 virtual void Layout() OVERRIDE; | 47 virtual void Layout() OVERRIDE; |
45 | 48 |
46 private: | 49 private: |
47 views::Label* CreateLabel(); | 50 views::Label* CreateLabel(const LocationBarView* location_bar_view); |
48 | 51 |
49 views::Label* leading_label_; | 52 views::Label* leading_label_; |
50 views::Label* trailing_label_; | 53 views::Label* trailing_label_; |
51 | 54 |
52 // The keyword. | 55 // The keyword. |
53 string16 keyword_; | 56 string16 keyword_; |
54 | 57 |
55 Profile* profile_; | 58 Profile* profile_; |
56 | 59 |
57 DISALLOW_IMPLICIT_CONSTRUCTORS(KeywordHintView); | 60 DISALLOW_IMPLICIT_CONSTRUCTORS(KeywordHintView); |
58 }; | 61 }; |
59 | 62 |
60 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ | 63 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ |
OLD | NEW |