blob: 78e36d30f0252a4c8aec4a7484bab28fe96887f7 [file] [log] [blame]
// Copyright (c) 2011 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.
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/controls/button/button.h"
class Profile;
enum class OmniboxTint;
namespace views {
class Label;
// KeywordHintView is used by the location bar view to display a hint to the
// user that pressing Tab will enter tab to search mode. The view is also
// clickable, which has the same effect as pressing tab.
// 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::Button {
KeywordHintView(LocationBarView* parent, Profile* profile);
~KeywordHintView() override;
void SetKeyword(const base::string16& keyword);
// views::View:
gfx::Insets GetInsets() const override;
// The minimum size is just big enough to show the tab.
gfx::Size GetMinimumSize() const override;
const char* GetClassName() const override;
void Layout() override;
gfx::Size CalculatePreferredSize() const override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnThemeChanged() override;
// Creates a label for non-chip text.
views::Label* CreateLabel(SkColor text_color, SkColor background_color);
int GetCornerRadius() const;
LocationBarView* location_bar_view_ = nullptr;
Profile* profile_ = nullptr;
views::Label* leading_label_ = nullptr;
views::View* chip_container_ = nullptr;
views::Label* chip_label_ = nullptr;
views::Label* trailing_label_ = nullptr;
base::string16 keyword_;