Commit bf20fdb2 authored by Shengsong Tan's avatar Shengsong Tan Committed by Chromium LUCI CQ

Adding metadata to FrameCaptionButtonContainerView

This is part of the "Views Posse" effort. See this document:
https://docs.google.com/document/d/1Rst3792TjXtVA8k8GXaPD8MnuB1JAneSOpIILdA4268/edit?usp=sharing

Bug: 1159562
Test: build
Change-Id: I74f7cb48974ea3abff4c919867f1b9c16bc5ba6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2599570Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Shengsong Tan <sstan@google.com>
Cr-Commit-Position: refs/heads/master@{#840524}
parent d672f7b5
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "ui/gfx/vector_icon_types.h" #include "ui/gfx/vector_icon_types.h"
#include "ui/strings/grit/ui_strings.h" // Accessibility names #include "ui/strings/grit/ui_strings.h" // Accessibility names
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/frame_caption_button.h" #include "ui/views/window/frame_caption_button.h"
...@@ -116,6 +117,9 @@ std::unique_ptr<views::BoxLayout> MakeBoxLayoutManager( ...@@ -116,6 +117,9 @@ std::unique_ptr<views::BoxLayout> MakeBoxLayoutManager(
class DefaultCaptionButtonModel : public CaptionButtonModel { class DefaultCaptionButtonModel : public CaptionButtonModel {
public: public:
explicit DefaultCaptionButtonModel(views::Widget* frame) : frame_(frame) {} explicit DefaultCaptionButtonModel(views::Widget* frame) : frame_(frame) {}
DefaultCaptionButtonModel(const DefaultCaptionButtonModel&) = delete;
DefaultCaptionButtonModel& operator=(const DefaultCaptionButtonModel&) =
delete;
~DefaultCaptionButtonModel() override {} ~DefaultCaptionButtonModel() override {}
// CaptionButtonModel: // CaptionButtonModel:
...@@ -151,15 +155,10 @@ class DefaultCaptionButtonModel : public CaptionButtonModel { ...@@ -151,15 +155,10 @@ class DefaultCaptionButtonModel : public CaptionButtonModel {
private: private:
views::Widget* frame_; views::Widget* frame_;
DISALLOW_COPY_AND_ASSIGN(DefaultCaptionButtonModel);
}; };
} // namespace } // namespace
// static
const char FrameCaptionButtonContainerView::kViewClassName[] =
"FrameCaptionButtonContainerView";
FrameCaptionButtonContainerView::FrameCaptionButtonContainerView( FrameCaptionButtonContainerView::FrameCaptionButtonContainerView(
views::Widget* frame) views::Widget* frame)
: views::AnimationDelegateViews(frame->GetRootView()), : views::AnimationDelegateViews(frame->GetRootView()),
...@@ -321,10 +320,6 @@ void FrameCaptionButtonContainerView::Layout() { ...@@ -321,10 +320,6 @@ void FrameCaptionButtonContainerView::Layout() {
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
} }
const char* FrameCaptionButtonContainerView::GetClassName() const {
return kViewClassName;
}
void FrameCaptionButtonContainerView::ChildPreferredSizeChanged(View* child) { void FrameCaptionButtonContainerView::ChildPreferredSizeChanged(View* child) {
PreferredSizeChanged(); PreferredSizeChanged();
} }
...@@ -540,4 +535,7 @@ void FrameCaptionButtonContainerView::CommitSnap(SnapDirection snap) { ...@@ -540,4 +535,7 @@ void FrameCaptionButtonContainerView::CommitSnap(SnapDirection snap) {
SnapController::Get()->CommitSnap(frame_->GetNativeWindow(), snap); SnapController::Get()->CommitSnap(frame_->GetNativeWindow(), snap);
} }
BEGIN_METADATA(FrameCaptionButtonContainerView, views::View)
END_METADATA
} // namespace chromeos } // namespace chromeos
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "chromeos/ui/frame/caption_buttons/frame_size_button_delegate.h" #include "chromeos/ui/frame/caption_buttons/frame_size_button_delegate.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "ui/views/animation/animation_delegate_views.h" #include "ui/views/animation/animation_delegate_views.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
#include "ui/views/window/frame_caption_button.h" #include "ui/views/window/frame_caption_button.h"
...@@ -38,10 +39,14 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView ...@@ -38,10 +39,14 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView
public FrameSizeButtonDelegate, public FrameSizeButtonDelegate,
public views::AnimationDelegateViews { public views::AnimationDelegateViews {
public: public:
static const char kViewClassName[]; METADATA_HEADER(FrameCaptionButtonContainerView);
// |frame| is the views::Widget that the caption buttons act on. // |frame| is the views::Widget that the caption buttons act on.
explicit FrameCaptionButtonContainerView(views::Widget* frame); explicit FrameCaptionButtonContainerView(views::Widget* frame);
FrameCaptionButtonContainerView(const FrameCaptionButtonContainerView&) =
delete;
FrameCaptionButtonContainerView& operator=(
const FrameCaptionButtonContainerView&) = delete;
~FrameCaptionButtonContainerView() override; ~FrameCaptionButtonContainerView() override;
// For testing. // For testing.
...@@ -49,6 +54,8 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView ...@@ -49,6 +54,8 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView
public: public:
explicit TestApi(FrameCaptionButtonContainerView* container_view) explicit TestApi(FrameCaptionButtonContainerView* container_view)
: container_view_(container_view) {} : container_view_(container_view) {}
TestApi(const TestApi&) = delete;
TestApi& operator=(const TestApi&) = delete;
void EndAnimations(); void EndAnimations();
...@@ -70,8 +77,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView ...@@ -70,8 +77,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView
private: private:
FrameCaptionButtonContainerView* container_view_; FrameCaptionButtonContainerView* container_view_;
DISALLOW_COPY_AND_ASSIGN(TestApi);
}; };
// Sets the id of the vector image to paint the button for |icon|. The // Sets the id of the vector image to paint the button for |icon|. The
...@@ -107,7 +112,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView ...@@ -107,7 +112,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView
// views::View: // views::View:
void Layout() override; void Layout() override;
const char* GetClassName() const override;
void ChildPreferredSizeChanged(View* child) override; void ChildPreferredSizeChanged(View* child) override;
void ChildVisibilityChanged(View* child) override; void ChildVisibilityChanged(View* child) override;
...@@ -166,8 +170,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView ...@@ -166,8 +170,6 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameCaptionButtonContainerView
std::unique_ptr<gfx::SlideAnimation> tablet_mode_animation_; std::unique_ptr<gfx::SlideAnimation> tablet_mode_animation_;
std::unique_ptr<CaptionButtonModel> model_; std::unique_ptr<CaptionButtonModel> model_;
DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView);
}; };
} // namespace chromeos } // namespace chromeos
......
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