blob: af11a845c50810f3fff1b815ca54c8b74645b3c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
#define CHROME_BROWSER_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
#pragma once
#include <string>
#include "gfx/size.h"
#include "views/view.h"
namespace gfx {
class Font;
}
class Profile;
namespace views {
class Label;
}
// KeywordHintView is used by the location bar view to display a hint to the
// user when the selected url has a corresponding keyword.
//
// Internally KeywordHintView uses two labels to render the text, and draws
// the tab image itself.
//
// NOTE: This should really be called LocationBarKeywordHintView, but I
// couldn't bring myself to use such a long name.
class KeywordHintView : public views::View {
public:
explicit KeywordHintView(Profile* profile);
virtual ~KeywordHintView();
void SetFont(const gfx::Font& font);
void SetColor(const SkColor& color);
void SetKeyword(const std::wstring& keyword);
std::wstring keyword() const { return keyword_; }
virtual void Paint(gfx::Canvas* canvas);
virtual gfx::Size GetPreferredSize();
// The minimum size is just big enough to show the tab.
virtual gfx::Size GetMinimumSize();
virtual void Layout();
void set_profile(Profile* profile) { profile_ = profile; }
private:
views::Label* leading_label_;
views::Label* trailing_label_;
// The keyword.
std::wstring keyword_;
Profile* profile_;
DISALLOW_IMPLICIT_CONSTRUCTORS(KeywordHintView);
};
#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_KEYWORD_HINT_VIEW_H_
|