Commit 528fa718 authored by Elaine Chien's avatar Elaine Chien Committed by Chromium LUCI CQ

Add metadata to TableHeader

Bug: 1159562
Change-Id: Idda5f9cf46d48e128eab05bae1c14febb2979422
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638675
Commit-Queue: Wei Li <weili@chromium.org>
Reviewed-by: default avatarWei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845182}
parent 5eb89080
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/table/table_utils.h" #include "ui/views/controls/table/table_utils.h"
#include "ui/views/controls/table/table_view.h" #include "ui/views/controls/table/table_view.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/native_cursor.h" #include "ui/views/native_cursor.h"
namespace views { namespace views {
...@@ -45,8 +46,6 @@ constexpr int kSortIndicatorSize = 8; ...@@ -45,8 +46,6 @@ constexpr int kSortIndicatorSize = 8;
} // namespace } // namespace
// static
const char TableHeader::kViewClassName[] = "TableHeader";
// static // static
const int TableHeader::kHorizontalPadding = 7; const int TableHeader::kHorizontalPadding = 7;
// static // static
...@@ -164,10 +163,6 @@ void TableHeader::OnPaint(gfx::Canvas* canvas) { ...@@ -164,10 +163,6 @@ void TableHeader::OnPaint(gfx::Canvas* canvas) {
} }
} }
const char* TableHeader::GetClassName() const {
return kViewClassName;
}
gfx::Size TableHeader::CalculatePreferredSize() const { gfx::Size TableHeader::CalculatePreferredSize() const {
return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight()); return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight());
} }
...@@ -335,5 +330,7 @@ int TableHeader::GetResizeColumn(int x) const { ...@@ -335,5 +330,7 @@ int TableHeader::GetResizeColumn(int x) const {
return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? index return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? index
: -1; : -1;
} }
BEGIN_METADATA(TableHeader, View)
END_METADATA
} // namespace views } // namespace views
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/views/controls/table/table_view.h" #include "ui/views/controls/table/table_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
...@@ -18,8 +19,7 @@ namespace views { ...@@ -18,8 +19,7 @@ namespace views {
// Views used to render the header for the table. // Views used to render the header for the table.
class VIEWS_EXPORT TableHeader : public views::View { class VIEWS_EXPORT TableHeader : public views::View {
public: public:
// Internal class name. METADATA_HEADER(TableHeader);
static const char kViewClassName[];
// Amount the text is padded on the left/right side. // Amount the text is padded on the left/right side.
static const int kHorizontalPadding; static const int kHorizontalPadding;
...@@ -28,6 +28,8 @@ class VIEWS_EXPORT TableHeader : public views::View { ...@@ -28,6 +28,8 @@ class VIEWS_EXPORT TableHeader : public views::View {
static const int kSortIndicatorWidth; static const int kSortIndicatorWidth;
explicit TableHeader(TableView* table); explicit TableHeader(TableView* table);
TableHeader(const TableHeader&) = delete;
TableHeader& operator=(const TableHeader&) = delete;
~TableHeader() override; ~TableHeader() override;
const gfx::FontList& font_list() const { return font_list_; } const gfx::FontList& font_list() const { return font_list_; }
...@@ -37,7 +39,6 @@ class VIEWS_EXPORT TableHeader : public views::View { ...@@ -37,7 +39,6 @@ class VIEWS_EXPORT TableHeader : public views::View {
// views::View overrides. // views::View overrides.
void OnPaint(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override;
const char* GetClassName() const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
bool GetNeedsNotificationWhenVisibleBoundsChange() const override; bool GetNeedsNotificationWhenVisibleBoundsChange() const override;
void OnVisibleBoundsChanged() override; void OnVisibleBoundsChanged() override;
...@@ -88,8 +89,6 @@ class VIEWS_EXPORT TableHeader : public views::View { ...@@ -88,8 +89,6 @@ class VIEWS_EXPORT TableHeader : public views::View {
// If non-null a resize is in progress. // If non-null a resize is in progress.
std::unique_ptr<ColumnResizeDetails> resize_details_; std::unique_ptr<ColumnResizeDetails> resize_details_;
DISALLOW_COPY_AND_ASSIGN(TableHeader);
}; };
} // namespace views } // namespace views
......
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