Commit 03f48941 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Migrate LinkExample to the Builder and Add Builder Support for Link

BUG=1130078

Change-Id: I41b8a046ed0a392d8df41a747286e346d57cb385
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454095
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814697}
parent 11b93aa9
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/metadata/view_factory.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
namespace views { namespace views {
...@@ -104,6 +105,9 @@ class VIEWS_EXPORT Link : public Label { ...@@ -104,6 +105,9 @@ class VIEWS_EXPORT Link : public Label {
DISALLOW_COPY_AND_ASSIGN(Link); DISALLOW_COPY_AND_ASSIGN(Link);
}; };
BEGIN_VIEW_BUILDER(VIEWS_EXPORT, Link, Label)
END_VIEW_BUILDER(VIEWS_EXPORT, Link)
} // namespace views } // namespace views
#endif // UI_VIEWS_CONTROLS_LINK_H_ #endif // UI_VIEWS_CONTROLS_LINK_H_
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ui/views/examples/examples_window.h" #include "ui/views/examples/examples_window.h"
#include "ui/views/examples/grit/views_examples_resources.h" #include "ui/views/examples/grit/views_examples_resources.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/metadata/view_factory.h"
#include "ui/views/view.h" #include "ui/views/view.h"
using l10n_util::GetStringUTF16; using l10n_util::GetStringUTF16;
...@@ -27,8 +28,9 @@ LinkExample::LinkExample() ...@@ -27,8 +28,9 @@ LinkExample::LinkExample()
LinkExample::~LinkExample() = default; LinkExample::~LinkExample() = default;
void LinkExample::CreateExampleView(View* container) { void LinkExample::CreateExampleView(View* container) {
auto link = auto link = views::Builder<Link>()
std::make_unique<Link>(GetStringUTF16(IDS_LINK_CLICK_PROMPT_LABEL)); .SetText(GetStringUTF16(IDS_LINK_CLICK_PROMPT_LABEL))
.Build();
link->set_callback(base::BindRepeating( link->set_callback(base::BindRepeating(
&LogStatus, GetStringUTF8(IDS_LINK_CLICK_CONFIRMED_LABEL))); &LogStatus, GetStringUTF8(IDS_LINK_CLICK_CONFIRMED_LABEL)));
......
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