Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "ui/gfx/size.h" | |
| 10 #include "ui/views/view.h" | |
| 11 | |
| 12 class LocationBarView; | |
| 13 namespace gfx { | |
| 14 class Font; | |
| 15 } | |
| 16 namespace views { | |
| 17 class Label; | |
| 18 } | |
| 19 | |
| 20 // SearchTokenView is used by the location bar view to display a search token to | |
| 21 // the user when the omnibox replaces the url with its query terms. | |
| 22 // Internally SearchTokenView uses a label to render the text, and draws the | |
| 23 // right border that serves as a divider between itself and the icons to its | |
| 24 // right. | |
| 25 class SearchTokenView : public views::View { | |
| 26 public: | |
| 27 explicit SearchTokenView(const LocationBarView* location_bar_view); | |
| 28 virtual ~SearchTokenView(); | |
| 29 | |
| 30 void SetFont(const gfx::Font& font); | |
| 31 | |
| 32 void SetBackgroundColor(SkColor color); | |
| 33 | |
| 34 void SetForegroundColor(SkColor color); | |
| 35 | |
| 36 void SetSearchProvider(const string16& search_provider); | |
|
beaudoin
2013/01/07 17:27:53
Comment that setting an empty string will remove t
kuan
2013/01/09 19:52:58
Done.
| |
| 37 | |
| 38 bool has_search_provider() const { | |
| 39 return !search_provider_.empty(); | |
| 40 } | |
| 41 | |
| 42 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 43 virtual void Layout() OVERRIDE; | |
| 44 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 views::Label* label_; | |
| 48 string16 search_provider_; | |
| 49 SkColor border_color_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(SearchTokenView); | |
| 52 }; | |
| 53 | |
| 54 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SEARCH_TOKEN_VIEW_H_ | |
| OLD | NEW |