Commit fd8a4170 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Use callbacks instead of ButtonPressed overrides: c/b/ui/views/frame/

Bug: 772945
Change-Id: I466d0232ccdc0a621d7075bebbcb7adaca6bd767
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2437610
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811787}
parent ba7f06eb
......@@ -102,10 +102,6 @@ enum ViewID {
// Plus button on location bar.
VIEW_ID_ACTION_BOX_BUTTON,
// IDs for the WebUI-based tab strip. See https://crbug.com/989131.
VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER,
VIEW_ID_WEBUI_TAB_STRIP_NEW_TAB_BUTTON,
};
#endif // CHROME_BROWSER_UI_VIEW_IDS_H_
......@@ -111,7 +111,7 @@ void BrowserNonClientFrameViewAsh::Init() {
// Initializing the TabIconView is expensive, so only do it if we need to.
if (browser_view()->ShouldShowWindowIcon()) {
window_icon_ = new TabIconView(this, nullptr);
window_icon_ = new TabIconView(this, views::Button::PressedCallback());
window_icon_->set_is_light(true);
AddChildView(window_icon_);
window_icon_->Update();
......
......@@ -16,11 +16,12 @@
namespace {
std::unique_ptr<Windows10CaptionButton> CreateCaptionButton(
views::Button::PressedCallback callback,
GlassBrowserFrameView* frame_view,
ViewID button_type,
int accessible_name_resource_id) {
return std::make_unique<Windows10CaptionButton>(
frame_view, button_type,
std::move(callback), frame_view, button_type,
l10n_util::GetStringUTF16(accessible_name_resource_id));
}
......@@ -34,21 +35,31 @@ bool HitTestCaptionButton(Windows10CaptionButton* button,
GlassBrowserCaptionButtonContainer::GlassBrowserCaptionButtonContainer(
GlassBrowserFrameView* frame_view)
: frame_view_(frame_view),
minimize_button_(
AddChildView(CreateCaptionButton(frame_view,
VIEW_ID_MINIMIZE_BUTTON,
IDS_APP_ACCNAME_MINIMIZE))),
maximize_button_(
AddChildView(CreateCaptionButton(frame_view,
VIEW_ID_MAXIMIZE_BUTTON,
IDS_APP_ACCNAME_MAXIMIZE))),
restore_button_(
AddChildView(CreateCaptionButton(frame_view,
VIEW_ID_RESTORE_BUTTON,
IDS_APP_ACCNAME_RESTORE))),
close_button_(AddChildView(CreateCaptionButton(frame_view,
VIEW_ID_CLOSE_BUTTON,
IDS_APP_ACCNAME_CLOSE))) {
minimize_button_(AddChildView(CreateCaptionButton(
base::BindRepeating(&BrowserFrame::Minimize,
base::Unretained(frame_view_->frame())),
frame_view_,
VIEW_ID_MINIMIZE_BUTTON,
IDS_APP_ACCNAME_MINIMIZE))),
maximize_button_(AddChildView(CreateCaptionButton(
base::BindRepeating(&BrowserFrame::Maximize,
base::Unretained(frame_view_->frame())),
frame_view_,
VIEW_ID_MAXIMIZE_BUTTON,
IDS_APP_ACCNAME_MAXIMIZE))),
restore_button_(AddChildView(CreateCaptionButton(
base::BindRepeating(&BrowserFrame::Restore,
base::Unretained(frame_view_->frame())),
frame_view_,
VIEW_ID_RESTORE_BUTTON,
IDS_APP_ACCNAME_RESTORE))),
close_button_(AddChildView(CreateCaptionButton(
base::BindRepeating(&BrowserFrame::CloseWithReason,
base::Unretained(frame_view_->frame()),
views::Widget::ClosedReason::kCloseButtonClicked),
frame_view_,
VIEW_ID_CLOSE_BUTTON,
IDS_APP_ACCNAME_CLOSE))) {
// Layout is horizontal, with buttons placed at the trailing end of the view.
// This allows the container to expand to become a faux titlebar/drag handle.
auto* const layout = SetLayoutManager(std::make_unique<views::FlexLayout>());
......@@ -89,18 +100,6 @@ void GlassBrowserCaptionButtonContainer::ResetWindowControls() {
InvalidateLayout();
}
void GlassBrowserCaptionButtonContainer::ButtonPressed(views::Button* sender) {
if (sender == minimize_button_)
frame_view_->frame()->Minimize();
else if (sender == maximize_button_)
frame_view_->frame()->Maximize();
else if (sender == restore_button_)
frame_view_->frame()->Restore();
else if (sender == close_button_)
frame_view_->frame()->CloseWithReason(
views::Widget::ClosedReason::kCloseButtonClicked);
}
void GlassBrowserCaptionButtonContainer::AddedToWidget() {
views::Widget* const widget = GetWidget();
if (!widget_observer_.IsObserving(widget))
......
......@@ -44,7 +44,6 @@ class GlassBrowserCaptionButtonContainer : public views::View,
const gfx::Rect& new_bounds) override;
void ResetWindowControls();
void ButtonPressed(views::Button* sender);
// Sets caption button visibility and enabled state based on window state.
// Only one of maximize or restore button should ever be visible at the same
......
......@@ -96,7 +96,7 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
if (browser_view->CanShowWindowIcon()) {
InitThrobberIcons();
window_icon_ = new TabIconView(this, nullptr);
window_icon_ = new TabIconView(this, views::Button::PressedCallback());
window_icon_->set_is_light(true);
window_icon_->SetID(VIEW_ID_WINDOW_ICON);
// Stop the icon from intercepting clicks intended for the HTSYSMENU region
......@@ -368,12 +368,6 @@ void GlassBrowserFrameView::ResetWindowControls() {
caption_button_container_->ResetWindowControls();
}
void GlassBrowserFrameView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (caption_button_container_)
caption_button_container_->ButtonPressed(sender);
}
bool GlassBrowserFrameView::ShouldTabIconViewAnimate() const {
DCHECK(ShouldShowWindowIcon(TitlebarType::kCustom));
content::WebContents* current_tab = browser_view()->GetActiveWebContents();
......
......@@ -12,13 +12,11 @@
#include "chrome/browser/ui/views/frame/windows_10_caption_button.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tab_icon_view_model.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/window/non_client_view.h"
class BrowserView;
class GlassBrowserFrameView : public BrowserNonClientFrameView,
public views::ButtonListener,
public TabIconViewModel {
public:
// Alpha to use for features in the titlebar (the window title and caption
......@@ -59,9 +57,6 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
void ResetWindowControls() override;
void SizeConstraintsChanged() override {}
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// TabIconViewModel:
bool ShouldTabIconViewAnimate() const override;
gfx::ImageSkia GetFaviconForTabIconView() override;
......
......@@ -157,18 +157,30 @@ void OpaqueBrowserFrameView::InitViews() {
CreateImageButton(IDR_CLOSE, IDR_CLOSE_H, IDR_CLOSE_P,
IDR_CLOSE_BUTTON_MASK, VIEW_ID_CLOSE_BUTTON);
}
InitWindowCaptionButton(minimize_button_, IDS_ACCNAME_MINIMIZE,
VIEW_ID_MINIMIZE_BUTTON);
InitWindowCaptionButton(maximize_button_, IDS_ACCNAME_MAXIMIZE,
VIEW_ID_MAXIMIZE_BUTTON);
InitWindowCaptionButton(restore_button_, IDS_ACCNAME_RESTORE,
VIEW_ID_RESTORE_BUTTON);
InitWindowCaptionButton(close_button_, IDS_ACCNAME_CLOSE,
VIEW_ID_CLOSE_BUTTON);
InitWindowCaptionButton(
minimize_button_,
base::BindRepeating(&BrowserFrame::Minimize, base::Unretained(frame())),
IDS_ACCNAME_MINIMIZE, VIEW_ID_MINIMIZE_BUTTON);
InitWindowCaptionButton(
maximize_button_,
base::BindRepeating(&BrowserFrame::Maximize, base::Unretained(frame())),
IDS_ACCNAME_MAXIMIZE, VIEW_ID_MAXIMIZE_BUTTON);
InitWindowCaptionButton(
restore_button_,
base::BindRepeating(&BrowserFrame::Restore, base::Unretained(frame())),
IDS_ACCNAME_RESTORE, VIEW_ID_RESTORE_BUTTON);
InitWindowCaptionButton(
close_button_,
base::BindRepeating(&BrowserFrame::CloseWithReason,
base::Unretained(frame()),
views::Widget::ClosedReason::kCloseButtonClicked),
IDS_ACCNAME_CLOSE, VIEW_ID_CLOSE_BUTTON);
// Initializing the TabIconView is expensive, so only do it if we need to.
if (browser_view()->ShouldShowWindowIcon()) {
window_icon_ = new TabIconView(this, this);
window_icon_ = new TabIconView(
this, base::BindRepeating(&OpaqueBrowserFrameView::WindowIconPressed,
base::Unretained(this)));
window_icon_->set_is_light(true);
window_icon_->SetID(VIEW_ID_WINDOW_ICON);
AddChildView(window_icon_);
......@@ -332,33 +344,6 @@ void OpaqueBrowserFrameView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kTitleBar;
}
///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, views::ButtonListener implementation:
void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (sender == minimize_button_) {
frame()->Minimize();
} else if (sender == maximize_button_) {
frame()->Maximize();
} else if (sender == restore_button_) {
frame()->Restore();
} else if (sender == close_button_) {
frame()->CloseWithReason(views::Widget::ClosedReason::kCloseButtonClicked);
} else if (sender == window_icon_) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// TODO(pbos): Figure out / document why this is Linux only. This needs a
// comment.
views::MenuRunner menu_runner(frame()->GetSystemMenuModel(),
views::MenuRunner::HAS_MNEMONICS);
menu_runner.RunMenuAt(
browser_view()->GetWidget(), window_icon_->button_controller(),
window_icon_->GetBoundsInScreen(), views::MenuAnchorPosition::kTopLeft,
ui::MENU_SOURCE_MOUSE);
#endif
}
}
///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, TabIconView::TabContentsProvider implementation:
......@@ -552,7 +537,7 @@ views::Button* OpaqueBrowserFrameView::CreateFrameCaptionButton(
int ht_component,
const gfx::VectorIcon& icon_image) {
views::FrameCaptionButton* button =
new views::FrameCaptionButton(this, icon_type, ht_component);
new views::FrameCaptionButton(nullptr, icon_type, ht_component);
button->SetImage(button->icon(), views::FrameCaptionButton::ANIMATE_NO,
icon_image);
return button;
......@@ -563,7 +548,7 @@ views::Button* OpaqueBrowserFrameView::CreateImageButton(int normal_image_id,
int pushed_image_id,
int mask_image_id,
ViewID view_id) {
views::ImageButton* button = new views::ImageButton(this);
views::ImageButton* button = new views::ImageButton(nullptr);
const ui::ThemeProvider* tp = frame()->GetThemeProvider();
button->SetImage(views::Button::STATE_NORMAL,
tp->GetImageSkiaNamed(normal_image_id));
......@@ -592,8 +577,10 @@ views::Button* OpaqueBrowserFrameView::CreateImageButton(int normal_image_id,
void OpaqueBrowserFrameView::InitWindowCaptionButton(
views::Button* button,
views::Button::PressedCallback callback,
int accessibility_string_id,
ViewID view_id) {
button->set_callback(std::move(callback));
button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id));
button->SetID(view_id);
AddChildView(button);
......@@ -669,6 +656,19 @@ gfx::Rect OpaqueBrowserFrameView::IconBounds() const {
return layout_->IconBounds();
}
void OpaqueBrowserFrameView::WindowIconPressed() {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// TODO(pbos): Figure out / document why this is Linux only. This needs a
// comment.
views::MenuRunner menu_runner(frame()->GetSystemMenuModel(),
views::MenuRunner::HAS_MNEMONICS);
menu_runner.RunMenuAt(
browser_view()->GetWidget(), window_icon_->button_controller(),
window_icon_->GetBoundsInScreen(), views::MenuAnchorPosition::kTopLeft,
ui::MENU_SOURCE_MOUSE);
#endif
}
bool OpaqueBrowserFrameView::ShouldShowWindowTitleBar() const {
// Do not show the custom title bar if the system title bar option is enabled.
if (!frame()->UseCustomFrame())
......
......@@ -8,6 +8,7 @@
#include <memory>
#include "base/macros.h"
#include "build/build_config.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
......@@ -38,7 +39,6 @@ class Label;
}
class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
public views::ButtonListener,
public TabIconViewModel,
public OpaqueBrowserFrameViewLayoutDelegate {
public:
......@@ -78,9 +78,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
const char* GetClassName() const override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// TabIconViewModel:
bool ShouldTabIconViewAnimate() const override;
gfx::ImageSkia GetFaviconForTabIconView() override;
......@@ -137,6 +134,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
// Initializes state on |button| common to both FrameCaptionButtons and
// ImageButtons.
void InitWindowCaptionButton(views::Button* button,
views::Button::PressedCallback callback,
int accessibility_string_id,
ViewID view_id);
......@@ -173,6 +171,8 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
// there was one).
gfx::Rect IconBounds() const;
void WindowIconPressed();
// Returns true if the view should draw its own custom title bar.
bool ShouldShowWindowTitleBar() const;
......
......@@ -151,7 +151,7 @@ class OpaqueBrowserFrameViewLayoutTest
}
void AddWindowTitleIcons() {
tab_icon_view_ = new TabIconView(nullptr, nullptr);
tab_icon_view_ = new TabIconView(nullptr, views::Button::PressedCallback());
tab_icon_view_->set_is_light(true);
tab_icon_view_->SetID(VIEW_ID_WINDOW_ICON);
root_view_->AddChildView(tab_icon_view_);
......
......@@ -33,7 +33,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/chrome_view_class_properties.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
......@@ -560,7 +559,10 @@ views::NativeViewHost* WebUITabStripContainerView::GetNativeViewHost() {
std::unique_ptr<views::View> WebUITabStripContainerView::CreateTabCounter() {
DCHECK_EQ(nullptr, tab_counter_);
auto tab_counter = CreateWebUITabCounterButton(this, browser_view_);
auto tab_counter = CreateWebUITabCounterButton(
base::BindRepeating(&WebUITabStripContainerView::TabCounterPressed,
base::Unretained(this)),
browser_view_);
tab_counter_ = tab_counter.get();
view_observer_.Add(tab_counter_);
......@@ -657,6 +659,30 @@ void WebUITabStripContainerView::EndDragToOpen(
: WebUITabStripOpenCloseReason::kDragRelease);
}
void WebUITabStripContainerView::TabCounterPressed() {
const bool new_visibility = !GetVisible();
if (new_visibility) {
RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter);
browser_view_->feature_promo_controller()
->feature_engagement_tracker()
->NotifyEvent(feature_engagement::events::kWebUITabStripOpened);
} else {
RecordTabStripUICloseHistogram(TabStripUICloseAction::kTapOnTabCounter);
browser_view_->feature_promo_controller()
->feature_engagement_tracker()
->NotifyEvent(feature_engagement::events::kWebUITabStripClosed);
}
SetContainerTargetVisibility(new_visibility,
WebUITabStripOpenCloseReason::kOther);
if (GetVisible() && tab_counter_->HasFocus()) {
// Automatically move focus to the tab strip WebUI if the focus is
// currently on the toggle button.
SetPaneFocusAndFocusDefault();
}
}
void WebUITabStripContainerView::SetContainerTargetVisibility(
bool target_visible,
WebUITabStripOpenCloseReason reason) {
......@@ -795,32 +821,6 @@ gfx::Size WebUITabStripContainerView::FlexRule(
return gfx::Size(width, height);
}
void WebUITabStripContainerView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK_EQ(sender->GetID(), VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER);
const bool new_visibility = !GetVisible();
if (new_visibility) {
RecordTabStripUIOpenHistogram(TabStripUIOpenAction::kTapOnTabCounter);
browser_view_->feature_promo_controller()
->feature_engagement_tracker()
->NotifyEvent(feature_engagement::events::kWebUITabStripOpened);
} else {
RecordTabStripUICloseHistogram(TabStripUICloseAction::kTapOnTabCounter);
browser_view_->feature_promo_controller()
->feature_engagement_tracker()
->NotifyEvent(feature_engagement::events::kWebUITabStripClosed);
}
SetContainerTargetVisibility(new_visibility,
WebUITabStripOpenCloseReason::kOther);
if (GetVisible() && sender->HasFocus()) {
// Automatically move focus to the tab strip WebUI if the focus is
// currently on the toggle button.
SetPaneFocusAndFocusDefault();
}
}
void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) {
if (observed_view == top_container_) {
if (old_top_container_width_ != top_container_->width()) {
......
......@@ -11,13 +11,13 @@
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_embedder.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h"
#include "chrome/common/buildflags.h"
#include "components/tab_groups/tab_group_id.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/accessible_pane_view.h"
#include "ui/views/view.h"
......@@ -46,7 +46,6 @@ class ImmersiveRevealedLock;
class WebUITabStripContainerView : public TabStripUIEmbedder,
public gfx::AnimationDelegate,
public views::AccessiblePaneView,
public views::ButtonListener,
public views::ViewObserver {
public:
WebUITabStripContainerView(BrowserView* browser_view,
......@@ -97,6 +96,8 @@ class WebUITabStripContainerView : public TabStripUIEmbedder,
void EndDragToOpen(base::Optional<WebUITabStripDragDirection>
fling_direction = base::nullopt);
void TabCounterPressed();
void SetContainerTargetVisibility(bool target_visible,
WebUITabStripOpenCloseReason reason);
......@@ -125,9 +126,6 @@ class WebUITabStripContainerView : public TabStripUIEmbedder,
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::ViewObserver:
void OnViewBoundsChanged(View* observed_view) override;
void OnViewIsDeleting(View* observed_view) override;
......
......@@ -17,10 +17,11 @@
#include "ui/gfx/scoped_canvas.h"
Windows10CaptionButton::Windows10CaptionButton(
PressedCallback callback,
GlassBrowserFrameView* frame_view,
ViewID button_type,
const base::string16& accessible_name)
: views::Button(frame_view),
: views::Button(std::move(callback)),
frame_view_(frame_view),
button_type_(button_type) {
SetAnimateOnStateChange(true);
......
......@@ -13,7 +13,8 @@ class GlassBrowserFrameView;
class Windows10CaptionButton : public views::Button {
public:
Windows10CaptionButton(GlassBrowserFrameView* frame_view,
Windows10CaptionButton(PressedCallback callback,
GlassBrowserFrameView* frame_view,
ViewID button_type,
const base::string16& accessible_name);
......
......@@ -68,8 +68,8 @@ class DefaultFavicon {
} // namespace
TabIconView::TabIconView(TabIconViewModel* model,
views::ButtonListener* listener)
: views::MenuButton(listener), model_(model), is_light_(false) {
views::Button::PressedCallback callback)
: views::MenuButton(std::move(callback)), model_(model), is_light_(false) {
// Inheriting from Button causes this View to be focusable, but it us
// purely decorative and should not be exposed as focusable in accessibility.
SetFocusBehavior(FocusBehavior::NEVER);
......
......@@ -18,7 +18,7 @@ class ImageSkia;
// A view to display a tab favicon or a throbber.
class TabIconView : public views::MenuButton {
public:
TabIconView(TabIconViewModel* model, views::ButtonListener* button_listener);
TabIconView(TabIconViewModel* model, views::Button::PressedCallback callback);
~TabIconView() override;
// Invoke whenever the tab state changes or the throbber should update.
......
......@@ -18,7 +18,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/chrome_view_class_properties.h"
......@@ -441,7 +440,7 @@ class WebUITabCounterButton : public views::Button,
static constexpr int WEBUI_TAB_COUNTER_CXMENU_CLOSE_TAB = 13;
static constexpr int WEBUI_TAB_COUNTER_CXMENU_NEW_TAB = 14;
WebUITabCounterButton(views::ButtonListener* listener,
WebUITabCounterButton(PressedCallback pressed_callback,
BrowserView* browser_view);
~WebUITabCounterButton() override;
......@@ -491,9 +490,9 @@ class WebUITabCounterButton : public views::Button,
link_opened_from_gesture_subscription_;
};
WebUITabCounterButton::WebUITabCounterButton(views::ButtonListener* listener,
WebUITabCounterButton::WebUITabCounterButton(PressedCallback pressed_callback,
BrowserView* browser_view)
: Button(listener),
: Button(std::move(pressed_callback)),
tab_strip_model_(browser_view->browser()->tab_strip_model()),
browser_view_(browser_view) {}
......@@ -532,8 +531,6 @@ void WebUITabCounterButton::UpdateColors() {
}
void WebUITabCounterButton::Init() {
SetID(VIEW_ID_WEBUI_TAB_STRIP_TAB_COUNTER);
SetProperty(
views::kFlexBehaviorKey,
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToMinimum,
......@@ -687,10 +684,10 @@ void WebUITabCounterButton::ExecuteCommand(int command_id, int event_flags) {
} // namespace
std::unique_ptr<views::View> CreateWebUITabCounterButton(
views::ButtonListener* listener,
views::Button::PressedCallback pressed_callback,
BrowserView* browser_view) {
auto tab_counter =
std::make_unique<WebUITabCounterButton>(listener, browser_view);
auto tab_counter = std::make_unique<WebUITabCounterButton>(
std::move(pressed_callback), browser_view);
tab_counter->Init();
......
......@@ -7,15 +7,16 @@
#include <memory>
#include "ui/views/controls/button/button.h"
namespace views {
class ButtonListener;
class View;
} // namespace views
class BrowserView;
std::unique_ptr<views::View> CreateWebUITabCounterButton(
views::ButtonListener* listener,
views::Button::PressedCallback pressed_callback,
BrowserView* browser_view);
#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_WEBUI_TAB_COUNTER_BUTTON_H_
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