| OLD | NEW |
| 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_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_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 "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" | 12 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" |
| 13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class FontList; | 17 class FontList; |
| 18 class Size; | 18 class Size; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // SelectedKeywordView displays the tab-to-search UI in the location bar view. | 21 // SelectedKeywordView displays the tab-to-search UI in the location bar view. |
| 22 class SelectedKeywordView : public IconLabelBubbleView { | 22 class SelectedKeywordView : public IconLabelBubbleView { |
| 23 public: | 23 public: |
| 24 SelectedKeywordView(const gfx::FontList& font_list, | 24 SelectedKeywordView(const gfx::FontList& font_list, |
| 25 SkColor text_color, | |
| 26 SkColor parent_background_color, | |
| 27 Profile* profile); | 25 Profile* profile); |
| 28 ~SelectedKeywordView() override; | 26 ~SelectedKeywordView() override; |
| 29 | 27 |
| 30 // Resets the icon for this chip to its default (it may have been changed | 28 // Resets the icon for this chip to its default (it may have been changed |
| 31 // for an extension). | 29 // for an extension). |
| 32 void ResetImage(); | 30 void ResetImage(); |
| 33 | 31 |
| 34 // IconLabelBubbleView: | 32 // IconLabelBubbleView: |
| 35 SkColor GetTextColor() const override; | 33 SkColor GetTextColor() const override; |
| 36 SkColor GetBorderColor() const override; | |
| 37 | 34 |
| 38 // views::View: | 35 // views::View: |
| 39 gfx::Size GetPreferredSize() const override; | 36 gfx::Size GetPreferredSize() const override; |
| 40 gfx::Size GetMinimumSize() const override; | 37 gfx::Size GetMinimumSize() const override; |
| 41 void Layout() override; | 38 void Layout() override; |
| 42 | 39 |
| 43 // The current keyword, or an empty string if no keyword is displayed. | 40 // The current keyword, or an empty string if no keyword is displayed. |
| 44 void SetKeyword(const base::string16& keyword); | 41 void SetKeyword(const base::string16& keyword); |
| 45 const base::string16& keyword() const { return keyword_; } | 42 const base::string16& keyword() const { return keyword_; } |
| 46 | 43 |
| 47 private: | 44 private: |
| 48 // IconLabelBubbleView: | 45 // IconLabelBubbleView: |
| 49 const char* GetClassName() const override; | 46 const char* GetClassName() const override; |
| 50 | 47 |
| 51 SkColor text_color_; | |
| 52 | |
| 53 // The keyword we're showing. If empty, no keyword is selected. | 48 // The keyword we're showing. If empty, no keyword is selected. |
| 54 // NOTE: we don't cache the TemplateURL as it is possible for it to get | 49 // NOTE: we don't cache the TemplateURL as it is possible for it to get |
| 55 // deleted out from under us. | 50 // deleted out from under us. |
| 56 base::string16 keyword_; | 51 base::string16 keyword_; |
| 57 | 52 |
| 58 // These labels are never visible. They are used to size the view. One | 53 // These labels are never visible. They are used to size the view. One |
| 59 // label contains the complete description of the keyword, the second | 54 // label contains the complete description of the keyword, the second |
| 60 // contains a truncated version of the description, for if there is not | 55 // contains a truncated version of the description, for if there is not |
| 61 // enough room to display the complete description. | 56 // enough room to display the complete description. |
| 62 views::Label full_label_; | 57 views::Label full_label_; |
| 63 views::Label partial_label_; | 58 views::Label partial_label_; |
| 64 | 59 |
| 65 Profile* profile_; | 60 Profile* profile_; |
| 66 | 61 |
| 67 DISALLOW_COPY_AND_ASSIGN(SelectedKeywordView); | 62 DISALLOW_COPY_AND_ASSIGN(SelectedKeywordView); |
| 68 }; | 63 }; |
| 69 | 64 |
| 70 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SELECTED_KEYWORD_VIEW_H_ |
| OLD | NEW |