Chromium Code Reviews| 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 "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/controls/button/custom_button.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class FontList; | 18 class FontList; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class Label; | 22 class Label; |
| 23 } | 23 } |
| 24 | 24 |
| 25 // 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 |
| 26 // user when the selected url has a corresponding keyword. | 26 // user when the selected url has a corresponding keyword. |
|
Peter Kasting
2017/04/05 23:09:43
Nit: Maybe add: "The hint is clickable to enter ke
Evan Stade
2017/04/06 00:05:41
updated comment
| |
| 27 // | 27 // |
| 28 // Internally KeywordHintView uses two labels to render the text, and draws | 28 // Internally KeywordHintView uses two labels to render the text, and draws |
| 29 // the tab image itself. | 29 // the tab image itself. |
| 30 // | 30 // |
| 31 // NOTE: This should really be called LocationBarKeywordHintView, but I | 31 // NOTE: This should really be called LocationBarKeywordHintView, but I |
| 32 // couldn't bring myself to use such a long name. | 32 // couldn't bring myself to use such a long name. |
| 33 class KeywordHintView : public views::View { | 33 class KeywordHintView : public views::CustomButton { |
| 34 public: | 34 public: |
| 35 KeywordHintView(Profile* profile, | 35 KeywordHintView(views::ButtonListener* listener, |
| 36 Profile* profile, | |
| 36 const gfx::FontList& font_list, | 37 const gfx::FontList& font_list, |
| 37 const gfx::FontList& bubble_font_list, | 38 const gfx::FontList& bubble_font_list, |
| 38 int tab_key_height, | 39 int tab_key_height, |
| 39 SkColor text_color, | 40 SkColor text_color, |
| 40 SkColor background_color); | 41 SkColor background_color); |
| 41 ~KeywordHintView() override; | 42 ~KeywordHintView() override; |
| 42 | 43 |
| 43 void SetKeyword(const base::string16& keyword); | 44 void SetKeyword(const base::string16& keyword); |
| 44 base::string16 keyword() const { return keyword_; } | 45 base::string16 keyword() const { return keyword_; } |
| 45 | 46 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 63 | 64 |
| 64 // Height of the tab key view. | 65 // Height of the tab key view. |
| 65 int tab_key_height_; | 66 int tab_key_height_; |
| 66 | 67 |
| 67 base::string16 keyword_; | 68 base::string16 keyword_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); | 70 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ |
| OLD | NEW |