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

Adding metadata to ImeModeIndicatorView

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: I776e58dc007726678b1a4d05ee0be8c91c2b6cf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601022
Commit-Queue: Shengsong Tan <sstan@google.com>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842392}
parent f98a7c2b
......@@ -14,6 +14,7 @@
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/wm/core/window_animations.h"
namespace ash {
......@@ -29,8 +30,12 @@ const int kShowingDuration = 500;
class ModeIndicatorFrameView : public views::BubbleFrameView {
public:
METADATA_HEADER(ModeIndicatorFrameView);
explicit ModeIndicatorFrameView()
: views::BubbleFrameView(gfx::Insets(), gfx::Insets()) {}
ModeIndicatorFrameView(const ModeIndicatorFrameView&) = delete;
ModeIndicatorFrameView& operator=(const ModeIndicatorFrameView&) = delete;
~ModeIndicatorFrameView() override {}
private:
......@@ -40,10 +45,11 @@ class ModeIndicatorFrameView : public views::BubbleFrameView {
->GetDisplayNearestPoint(rect.CenterPoint())
.bounds();
}
DISALLOW_COPY_AND_ASSIGN(ModeIndicatorFrameView);
};
BEGIN_METADATA(ModeIndicatorFrameView, views::BubbleFrameView)
END_METADATA
} // namespace
ImeModeIndicatorView::ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
......@@ -84,10 +90,6 @@ gfx::Size ImeModeIndicatorView::CalculatePreferredSize() const {
return size;
}
const char* ImeModeIndicatorView::GetClassName() const {
return "ImeModeIndicatorView";
}
void ImeModeIndicatorView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(label_view_);
......@@ -105,4 +107,7 @@ ImeModeIndicatorView::CreateNonClientFrameView(views::Widget* widget) {
return frame;
}
BEGIN_METADATA(ImeModeIndicatorView, views::BubbleDialogDelegateView)
END_METADATA
} // namespace ash
......@@ -11,6 +11,7 @@
#include "base/timer/timer.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/widget/widget.h"
namespace views {
......@@ -23,9 +24,13 @@ namespace ash {
// Dvorak) after switching IMEs with an accelerator (e.g. Ctrl-Space).
class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
public:
METADATA_HEADER(ImeModeIndicatorView);
// The cursor bounds is in the universal screen coordinates in DIP.
ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
const base::string16& label);
ImeModeIndicatorView(const ImeModeIndicatorView&) = delete;
ImeModeIndicatorView& operator=(const ImeModeIndicatorView&) = delete;
~ImeModeIndicatorView() override;
// Show the mode indicator then hide with fading animation.
......@@ -35,7 +40,6 @@ class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override;
gfx::Size CalculatePreferredSize() const override;
const char* GetClassName() const override;
void Init() override;
protected:
......@@ -47,8 +51,6 @@ class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
gfx::Rect cursor_bounds_;
views::Label* label_view_;
base::OneShotTimer timer_;
DISALLOW_COPY_AND_ASSIGN(ImeModeIndicatorView);
};
} // namespace ash
......
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