[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / location_bar / keyword_hint_view.h
blobc3ace05de0dbd1fe2c672a607e40972f7157031d
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "ui/gfx/size.h"
12 #include "ui/views/view.h"
14 class Profile;
16 namespace gfx {
17 class FontList;
20 namespace views {
21 class ImageView;
22 class Label;
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.
28 // Internally KeywordHintView uses two labels to render the text, and draws
29 // the tab image itself.
31 // NOTE: This should really be called LocationBarKeywordHintView, but I
32 // couldn't bring myself to use such a long name.
33 class KeywordHintView : public views::View {
34 public:
35 KeywordHintView(Profile* profile,
36 const gfx::FontList& font_list,
37 SkColor text_color,
38 SkColor background_color);
39 virtual ~KeywordHintView();
41 void SetKeyword(const base::string16& keyword);
42 base::string16 keyword() const { return keyword_; }
44 virtual gfx::Size GetPreferredSize() const OVERRIDE;
45 // The minimum size is just big enough to show the tab.
46 virtual gfx::Size GetMinimumSize() const OVERRIDE;
47 virtual void Layout() OVERRIDE;
49 private:
50 views::Label* CreateLabel(const gfx::FontList& font_list,
51 SkColor text_color,
52 SkColor background_color);
54 Profile* profile_;
55 views::Label* leading_label_;
56 views::ImageView* tab_image_;
57 views::Label* trailing_label_;
58 base::string16 keyword_;
60 DISALLOW_COPY_AND_ASSIGN(KeywordHintView);
63 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_