Commit bca7a2e3 authored by mgiuca's avatar mgiuca Committed by Commit bot

Tab, TabStrip: Added GetClassName override.

This helps with debugging a TabbedPane views hierarchy as you can print
the proper class names of Tabs and TabStrips inside.

Review URL: https://codereview.chromium.org/889453004

Cr-Commit-Position: refs/heads/master@{#313672}
parent c5a78b27
......@@ -34,6 +34,9 @@ const char TabbedPane::kViewClassName[] = "TabbedPane";
// The tab view shown in the tab strip.
class Tab : public View {
public:
// Internal class name.
static const char kViewClassName[];
Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents);
~Tab() override;
......@@ -49,6 +52,7 @@ class Tab : public View {
void OnGestureEvent(ui::GestureEvent* event) override;
gfx::Size GetPreferredSize() const override;
void Layout() override;
const char* GetClassName() const override;
private:
enum TabState {
......@@ -72,12 +76,16 @@ class Tab : public View {
// The tab strip shown above the tab contents.
class TabStrip : public View {
public:
// Internal class name.
static const char kViewClassName[];
explicit TabStrip(TabbedPane* tabbed_pane);
~TabStrip() override;
// Overridden from View:
gfx::Size GetPreferredSize() const override;
void Layout() override;
const char* GetClassName() const override;
void OnPaint(gfx::Canvas* canvas) override;
private:
......@@ -86,6 +94,9 @@ class TabStrip : public View {
DISALLOW_COPY_AND_ASSIGN(TabStrip);
};
// static
const char Tab::kViewClassName[] = "Tab";
Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents)
: tabbed_pane_(tabbed_pane),
title_(new Label(title,
......@@ -155,6 +166,10 @@ void Tab::Layout() {
title_->SetBoundsRect(bounds);
}
const char* Tab::GetClassName() const {
return kViewClassName;
}
void Tab::SetState(TabState tab_state) {
if (tab_state == tab_state_)
return;
......@@ -178,6 +193,9 @@ void Tab::SetState(TabState tab_state) {
SchedulePaint();
}
// static
const char TabStrip::kViewClassName[] = "TabStrip";
TabStrip::TabStrip(TabbedPane* tabbed_pane) : tabbed_pane_(tabbed_pane) {}
TabStrip::~TabStrip() {}
......@@ -202,6 +220,10 @@ void TabStrip::Layout() {
}
}
const char* TabStrip::GetClassName() const {
return kViewClassName;
}
void TabStrip::OnPaint(gfx::Canvas* canvas) {
OnPaintBackground(canvas);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment