Commit a9a66b6c authored by dcheng's avatar dcheng Committed by Commit bot

Standardize usage of virtual/override/final specifiers.

The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

BUG=417463
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/681753004

Cr-Commit-Position: refs/heads/master@{#301441}
parent 5bdeb6b3
......@@ -16,13 +16,13 @@ class VIEWS_EXPORT BlueButton : public LabelButton {
static const char kViewClassName[];
BlueButton(ButtonListener* listener, const base::string16& text);
virtual ~BlueButton();
~BlueButton() override;
private:
// Overridden from LabelButton:
virtual void ResetColorsFromNativeTheme() override;
virtual const char* GetClassName() const override;
virtual scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const override;
void ResetColorsFromNativeTheme() override;
const char* GetClassName() const override;
scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const override;
DISALLOW_COPY_AND_ASSIGN(BlueButton);
};
......
......@@ -18,7 +18,7 @@ namespace {
class TestBlueButton : public BlueButton {
public:
TestBlueButton() : BlueButton(NULL, base::ASCIIToUTF16("foo")) {}
virtual ~TestBlueButton() {}
~TestBlueButton() override {}
using BlueButton::OnNativeThemeChanged;
......
......@@ -27,7 +27,7 @@ class VIEWS_EXPORT ButtonListener {
// could be implemented by a native control or custom rendered.
class VIEWS_EXPORT Button : public View {
public:
virtual ~Button();
~Button() override;
// Button states for various button sub-types.
enum ButtonState {
......@@ -56,9 +56,9 @@ class VIEWS_EXPORT Button : public View {
void SetAccessibleName(const base::string16& name);
// Overridden from View:
virtual bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
virtual void GetAccessibleState(ui::AXViewState* state) override;
bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
void GetAccessibleState(ui::AXViewState* state) override;
protected:
// Construct the Button with a Listener. The listener can be NULL. This can be
......
......@@ -20,7 +20,7 @@ class VIEWS_EXPORT Checkbox : public LabelButton {
static const char kViewClassName[];
explicit Checkbox(const base::string16& label);
virtual ~Checkbox();
~Checkbox() override;
// Sets a listener for this checkbox. Checkboxes aren't required to have them
// since their state can be read independently of them being toggled.
......@@ -32,12 +32,12 @@ class VIEWS_EXPORT Checkbox : public LabelButton {
protected:
// Overridden from LabelButton:
virtual void Layout() override;
virtual const char* GetClassName() const override;
virtual void GetAccessibleState(ui::AXViewState* state) override;
virtual void OnFocus() override;
virtual void OnBlur() override;
virtual const gfx::ImageSkia& GetImage(ButtonState for_state) override;
void Layout() override;
const char* GetClassName() const override;
void GetAccessibleState(ui::AXViewState* state) override;
void OnFocus() override;
void OnBlur() override;
const gfx::ImageSkia& GetImage(ButtonState for_state) override;
// Set the image shown for each button state depending on whether it is
// [checked] or [focused].
......@@ -48,11 +48,10 @@ class VIEWS_EXPORT Checkbox : public LabelButton {
private:
// Overridden from Button:
virtual void NotifyClick(const ui::Event& event) override;
void NotifyClick(const ui::Event& event) override;
virtual ui::NativeTheme::Part GetThemePart() const override;
virtual void GetExtraParams(
ui::NativeTheme::ExtraParams* params) const override;
ui::NativeTheme::Part GetThemePart() const override;
void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override;
// True if the checkbox is checked.
bool checked_;
......
......@@ -31,7 +31,7 @@ class VIEWS_EXPORT CustomButton : public Button,
static const CustomButton* AsCustomButton(const views::View* view);
static CustomButton* AsCustomButton(views::View* view);
virtual ~CustomButton();
~CustomButton() override;
// Get/sets the current display state of the button.
ButtonState state() const { return state_; }
......@@ -67,27 +67,27 @@ class VIEWS_EXPORT CustomButton : public Button,
bool IsHotTracked() const;
// Overridden from View:
virtual void OnEnabledChanged() override;
virtual const char* GetClassName() const override;
virtual bool OnMousePressed(const ui::MouseEvent& event) override;
virtual bool OnMouseDragged(const ui::MouseEvent& event) override;
virtual void OnMouseReleased(const ui::MouseEvent& event) override;
virtual void OnMouseCaptureLost() override;
virtual void OnMouseEntered(const ui::MouseEvent& event) override;
virtual void OnMouseExited(const ui::MouseEvent& event) override;
virtual void OnMouseMoved(const ui::MouseEvent& event) override;
virtual bool OnKeyPressed(const ui::KeyEvent& event) override;
virtual bool OnKeyReleased(const ui::KeyEvent& event) override;
virtual void OnGestureEvent(ui::GestureEvent* event) override;
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
virtual void ShowContextMenu(const gfx::Point& p,
ui::MenuSourceType source_type) override;
virtual void OnDragDone() override;
virtual void GetAccessibleState(ui::AXViewState* state) override;
virtual void VisibilityChanged(View* starting_from, bool is_visible) override;
void OnEnabledChanged() override;
const char* GetClassName() const override;
bool OnMousePressed(const ui::MouseEvent& event) override;
bool OnMouseDragged(const ui::MouseEvent& event) override;
void OnMouseReleased(const ui::MouseEvent& event) override;
void OnMouseCaptureLost() override;
void OnMouseEntered(const ui::MouseEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override;
void OnMouseMoved(const ui::MouseEvent& event) override;
bool OnKeyPressed(const ui::KeyEvent& event) override;
bool OnKeyReleased(const ui::KeyEvent& event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
void ShowContextMenu(const gfx::Point& p,
ui::MenuSourceType source_type) override;
void OnDragDone() override;
void GetAccessibleState(ui::AXViewState* state) override;
void VisibilityChanged(View* starting_from, bool is_visible) override;
// Overridden from gfx::AnimationDelegate:
virtual void AnimationProgressed(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
// Takes ownership of the delegate.
void set_state_changed_delegate(CustomButtonStateChangedDelegate* delegate) {
......@@ -114,9 +114,9 @@ class VIEWS_EXPORT CustomButton : public Button,
virtual bool ShouldEnterPushedState(const ui::Event& event);
// Overridden from View:
virtual void ViewHierarchyChanged(
void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) override;
virtual void OnBlur() override;
void OnBlur() override;
// The button state (defined in implementation)
ButtonState state_;
......
......@@ -29,7 +29,7 @@ class TestCustomButton : public CustomButton {
: CustomButton(listener) {
}
virtual ~TestCustomButton() {}
~TestCustomButton() override {}
private:
DISALLOW_COPY_AND_ASSIGN(TestCustomButton);
......
......@@ -38,7 +38,7 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
};
explicit ImageButton(ButtonListener* listener);
virtual ~ImageButton();
~ImageButton() override;
// Returns the image for a given |state|.
virtual const gfx::ImageSkia& GetImage(ButtonState state) const;
......@@ -69,14 +69,14 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
}
// Overridden from View:
virtual gfx::Size GetPreferredSize() const override;
virtual const char* GetClassName() const override;
virtual void OnPaint(gfx::Canvas* canvas) override;
gfx::Size GetPreferredSize() const override;
const char* GetClassName() const override;
void OnPaint(gfx::Canvas* canvas) override;
protected:
// Overridden from View:
virtual void OnFocus() override;
virtual void OnBlur() override;
void OnFocus() override;
void OnBlur() override;
// Returns the image to paint. This is invoked from paint and returns a value
// from images.
......@@ -127,7 +127,7 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
class VIEWS_EXPORT ToggleImageButton : public ImageButton {
public:
explicit ToggleImageButton(ButtonListener* listener);
virtual ~ToggleImageButton();
~ToggleImageButton() override;
// Change the toggled state.
void SetToggled(bool toggled);
......@@ -141,14 +141,13 @@ class VIEWS_EXPORT ToggleImageButton : public ImageButton {
void SetToggledTooltipText(const base::string16& tooltip);
// Overridden from ImageButton:
virtual const gfx::ImageSkia& GetImage(ButtonState state) const override;
virtual void SetImage(ButtonState state,
const gfx::ImageSkia* image) override;
const gfx::ImageSkia& GetImage(ButtonState state) const override;
void SetImage(ButtonState state, const gfx::ImageSkia* image) override;
// Overridden from View:
virtual bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
virtual void GetAccessibleState(ui::AXViewState* state) override;
bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
void GetAccessibleState(ui::AXViewState* state) override;
private:
// The parent class's images_ member is used for the current images,
......
......@@ -29,7 +29,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
static const char kViewClassName[];
LabelButton(ButtonListener* listener, const base::string16& text);
virtual ~LabelButton();
~LabelButton() override;
// Get or set the image shown for the specified button state.
// GetImage returns the image for STATE_NORMAL if the state's image is empty.
......@@ -86,11 +86,11 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
Painter* focus_painter() { return focus_painter_.get(); }
// View:
virtual void SetBorder(scoped_ptr<Border> border) override;
virtual gfx::Size GetPreferredSize() const override;
virtual int GetHeightForWidth(int w) const override;
virtual void Layout() override;
virtual const char* GetClassName() const override;
void SetBorder(scoped_ptr<Border> border) override;
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int w) const override;
void Layout() override;
const char* GetClassName() const override;
protected:
ImageView* image() const { return image_; }
......@@ -101,10 +101,10 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
virtual gfx::Rect GetChildAreaBounds();
// View:
virtual void OnPaint(gfx::Canvas* canvas) override;
virtual void OnFocus() override;
virtual void OnBlur() override;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
void OnPaint(gfx::Canvas* canvas) override;
void OnFocus() override;
void OnBlur() override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// Fill |params| with information about the button.
virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
......@@ -124,7 +124,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
void UpdateThemedBorder();
// NativeThemeDelegate:
virtual gfx::Rect GetThemePaintRect() const override;
gfx::Rect GetThemePaintRect() const override;
private:
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init);
......@@ -134,19 +134,19 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList);
// CustomButton:
virtual void StateChanged() override;
void StateChanged() override;
// View:
virtual void ChildPreferredSizeChanged(View* child) override;
void ChildPreferredSizeChanged(View* child) override;
// NativeThemeDelegate:
virtual ui::NativeTheme::Part GetThemePart() const override;
virtual ui::NativeTheme::State GetThemeState(
ui::NativeTheme::Part GetThemePart() const override;
ui::NativeTheme::State GetThemeState(
ui::NativeTheme::ExtraParams* params) const override;
virtual const gfx::Animation* GetThemeAnimation() const override;
virtual ui::NativeTheme::State GetBackgroundThemeState(
const gfx::Animation* GetThemeAnimation() const override;
ui::NativeTheme::State GetBackgroundThemeState(
ui::NativeTheme::ExtraParams* params) const override;
virtual ui::NativeTheme::State GetForegroundThemeState(
ui::NativeTheme::State GetForegroundThemeState(
ui::NativeTheme::ExtraParams* params) const override;
// Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_|
......
......@@ -19,14 +19,14 @@ namespace views {
class VIEWS_EXPORT LabelButtonBorder : public Border {
public:
explicit LabelButtonBorder(Button::ButtonStyle style);
virtual ~LabelButtonBorder();
~LabelButtonBorder() override;
Button::ButtonStyle style() const { return style_; }
// Overridden from Border:
virtual void Paint(const View& view, gfx::Canvas* canvas) override;
virtual gfx::Insets GetInsets() const override;
virtual gfx::Size GetMinimumSize() const override;
void Paint(const View& view, gfx::Canvas* canvas) override;
gfx::Insets GetInsets() const override;
gfx::Size GetMinimumSize() const override;
void set_insets(const gfx::Insets& insets) { insets_ = insets; }
......
......@@ -50,7 +50,7 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
const base::string16& text,
MenuButtonListener* menu_button_listener,
bool show_menu_marker);
virtual ~MenuButton();
~MenuButton() override;
bool show_menu_marker() const { return show_menu_marker_; }
void set_menu_marker(const gfx::ImageSkia* menu_marker) {
......
......@@ -25,7 +25,7 @@ namespace views {
class MenuButtonTest : public ViewsTestBase {
public:
MenuButtonTest() : widget_(nullptr), button_(nullptr) {}
virtual ~MenuButtonTest() {}
~MenuButtonTest() override {}
void TearDown() override {
if (widget_ && !widget_->IsClosed())
......@@ -89,7 +89,7 @@ class TestButtonListener : public ButtonListener {
: last_sender_(nullptr),
last_sender_state_(Button::STATE_NORMAL),
last_event_type_(ui::ET_UNKNOWN) {}
virtual ~TestButtonListener() {}
~TestButtonListener() override {}
void ButtonPressed(Button* sender, const ui::Event& event) override {
last_sender_ = sender;
......@@ -115,7 +115,7 @@ class TestMenuButtonListener : public MenuButtonListener {
public:
TestMenuButtonListener()
: last_source_(nullptr), last_source_state_(Button::STATE_NORMAL) {}
virtual ~TestMenuButtonListener() {}
~TestMenuButtonListener() override {}
void OnMenuButtonClicked(View* source, const gfx::Point& /*point*/) override {
last_source_ = source;
......@@ -137,7 +137,7 @@ class TestMenuButtonListener : public MenuButtonListener {
class TestDragController : public DragController {
public:
TestDragController() {}
virtual ~TestDragController() {}
~TestDragController() override {}
void WriteDragDataForView(View* sender,
const gfx::Point& press_pt,
......@@ -165,7 +165,7 @@ class TestDragDropClient : public aura::client::DragDropClient,
public ui::EventHandler {
public:
TestDragDropClient();
virtual ~TestDragDropClient();
~TestDragDropClient() override;
// aura::client::DragDropClient:
int StartDragAndDrop(const ui::OSExchangeData& data,
......
......@@ -18,23 +18,23 @@ class VIEWS_EXPORT RadioButton : public Checkbox {
static const char kViewClassName[];
RadioButton(const base::string16& label, int group_id);
virtual ~RadioButton();
~RadioButton() override;
// Overridden from View:
virtual const char* GetClassName() const override;
virtual void GetAccessibleState(ui::AXViewState* state) override;
virtual View* GetSelectedViewForGroup(int group) override;
virtual bool IsGroupFocusTraversable() const override;
virtual void OnFocus() override;
const char* GetClassName() const override;
void GetAccessibleState(ui::AXViewState* state) override;
View* GetSelectedViewForGroup(int group) override;
bool IsGroupFocusTraversable() const override;
void OnFocus() override;
// Overridden from Button:
virtual void NotifyClick(const ui::Event& event) override;
void NotifyClick(const ui::Event& event) override;
// Overridden from LabelButton:
virtual ui::NativeTheme::Part GetThemePart() const override;
ui::NativeTheme::Part GetThemePart() const override;
// Overridden from Checkbox:
virtual void SetChecked(bool checked) override;
void SetChecked(bool checked) override;
private:
DISALLOW_COPY_AND_ASSIGN(RadioButton);
......
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