| 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 that pressing Tab will enter tab to search mode. The view is also |
| 27 // clickable, which has the same effect as pressing tab. |
| 27 // | 28 // |
| 28 // Internally KeywordHintView uses two labels to render the text, and draws | 29 // Internally KeywordHintView uses two labels to render the text, and draws |
| 29 // the tab image itself. | 30 // the tab image itself. |
| 30 // | 31 // |
| 31 // NOTE: This should really be called LocationBarKeywordHintView, but I | 32 // NOTE: This should really be called LocationBarKeywordHintView, but I |
| 32 // couldn't bring myself to use such a long name. | 33 // couldn't bring myself to use such a long name. |
| 33 class KeywordHintView : public views::View { | 34 class KeywordHintView : public views::CustomButton { |
| 34 public: | 35 public: |
| 35 KeywordHintView(Profile* profile, | 36 KeywordHintView(views::ButtonListener* listener, |
| 37 Profile* profile, |
| 36 const gfx::FontList& font_list, | 38 const gfx::FontList& font_list, |
| 37 const gfx::FontList& bubble_font_list, | 39 const gfx::FontList& bubble_font_list, |
| 38 int tab_key_height, | 40 int tab_key_height, |
| 39 SkColor text_color, | 41 SkColor text_color, |
| 40 SkColor background_color); | 42 SkColor background_color); |
| 41 ~KeywordHintView() override; | 43 ~KeywordHintView() override; |
| 42 | 44 |
| 43 void SetKeyword(const base::string16& keyword); | 45 void SetKeyword(const base::string16& keyword); |
| 44 base::string16 keyword() const { return keyword_; } | 46 base::string16 keyword() const { return keyword_; } |
| 45 | 47 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 | 65 |
| 64 // Height of the tab key view. | 66 // Height of the tab key view. |
| 65 int tab_key_height_; | 67 int tab_key_height_; |
| 66 | 68 |
| 67 base::string16 keyword_; | 69 base::string16 keyword_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); | 71 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ | 74 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_ |
| OLD | NEW |