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

Reland r786979, part 4: remove ButtonObserver.

The original CL was landed in one piece and reverted due to apparent
perf regressions.  Reland in sections to try and determine more
precisely whether there is any perf impact.

This CL removes ButtonObserver entirely, which should be unused.

If this causes perf regressions... something about cache alignment??

Bug: none
Change-Id: If9c0f40d50c9122d5830067eab0b2e2d63d00b2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346535
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796638}
parent 7206ce51
...@@ -109,7 +109,6 @@ component("views") { ...@@ -109,7 +109,6 @@ component("views") {
"controls/button/button.h", "controls/button/button.h",
"controls/button/button_controller.h", "controls/button/button_controller.h",
"controls/button/button_controller_delegate.h", "controls/button/button_controller_delegate.h",
"controls/button/button_observer.h",
"controls/button/checkbox.h", "controls/button/checkbox.h",
"controls/button/image_button.h", "controls/button/image_button.h",
"controls/button/image_button_factory.h", "controls/button/image_button_factory.h",
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "ui/views/animation/ink_drop_impl.h" #include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/controls/button/button_controller.h" #include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/button_controller_delegate.h" #include "ui/views/controls/button/button_controller_delegate.h"
#include "ui/views/controls/button/button_observer.h"
#include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button.h"
...@@ -238,16 +237,6 @@ void Button::SetHighlighted(bool bubble_visible) { ...@@ -238,16 +237,6 @@ void Button::SetHighlighted(bool bubble_visible) {
AnimateInkDrop(bubble_visible ? views::InkDropState::ACTIVATED AnimateInkDrop(bubble_visible ? views::InkDropState::ACTIVATED
: views::InkDropState::DEACTIVATED, : views::InkDropState::DEACTIVATED,
nullptr); nullptr);
for (ButtonObserver& observer : button_observers_)
observer.OnHighlightChanged(this, bubble_visible);
}
void Button::AddButtonObserver(ButtonObserver* observer) {
button_observers_.AddObserver(observer);
}
void Button::RemoveButtonObserver(ButtonObserver* observer) {
button_observers_.RemoveObserver(observer);
} }
PropertyChangedSubscription Button::AddStateChangedCallback( PropertyChangedSubscription Button::AddStateChangedCallback(
...@@ -533,10 +522,7 @@ void Button::OnClickCanceled(const ui::Event& event) { ...@@ -533,10 +522,7 @@ void Button::OnClickCanceled(const ui::Event& event) {
void Button::OnSetTooltipText(const base::string16& tooltip_text) {} void Button::OnSetTooltipText(const base::string16& tooltip_text) {}
void Button::StateChanged(ButtonState old_state) { void Button::StateChanged(ButtonState old_state) {}
for (ButtonObserver& observer : button_observers_)
observer.OnStateChanged(this, old_state);
}
bool Button::IsTriggerableEvent(const ui::Event& event) { bool Button::IsTriggerableEvent(const ui::Event& event) {
return button_controller_->IsTriggerableEvent(event); return button_controller_->IsTriggerableEvent(event);
......
...@@ -27,7 +27,6 @@ class ButtonTestApi; ...@@ -27,7 +27,6 @@ class ButtonTestApi;
class Button; class Button;
class ButtonController; class ButtonController;
class ButtonObserver;
class Event; class Event;
// An interface implemented by an object to let it know that a button was // An interface implemented by an object to let it know that a button was
...@@ -178,8 +177,6 @@ class VIEWS_EXPORT Button : public InkDropHostView, ...@@ -178,8 +177,6 @@ class VIEWS_EXPORT Button : public InkDropHostView,
// Highlights the ink drop for the button. // Highlights the ink drop for the button.
void SetHighlighted(bool bubble_visible); void SetHighlighted(bool bubble_visible);
void AddButtonObserver(ButtonObserver* observer);
void RemoveButtonObserver(ButtonObserver* observer);
PropertyChangedSubscription AddStateChangedCallback( PropertyChangedSubscription AddStateChangedCallback(
PropertyChangedCallback callback); PropertyChangedCallback callback);
...@@ -357,8 +354,6 @@ class VIEWS_EXPORT Button : public InkDropHostView, ...@@ -357,8 +354,6 @@ class VIEWS_EXPORT Button : public InkDropHostView,
AddEnabledChangedCallback(base::BindRepeating(&Button::OnEnabledChanged, AddEnabledChangedCallback(base::BindRepeating(&Button::OnEnabledChanged,
base::Unretained(this)))}; base::Unretained(this)))};
base::ObserverList<ButtonObserver> button_observers_;
DISALLOW_COPY_AND_ASSIGN(Button); DISALLOW_COPY_AND_ASSIGN(Button);
}; };
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_CONTROLS_BUTTON_BUTTON_OBSERVER_H_
#define UI_VIEWS_CONTROLS_BUTTON_BUTTON_OBSERVER_H_
#include "base/observer_list_types.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/views_export.h"
namespace views {
class VIEWS_EXPORT ButtonObserver : public base::CheckedObserver {
public:
virtual void OnHighlightChanged(views::Button* observed_button,
bool highlighted) {}
virtual void OnStateChanged(views::Button* observed_button,
views::Button::ButtonState old_state) {}
protected:
~ButtonObserver() override = default;
};
} // namespace views
#endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_OBSERVER_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