Commit a0dee61a 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=avi@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#301442}
parent a9a66b6c
...@@ -109,7 +109,7 @@ class VIEWS_EXPORT BubbleBorder : public Border { ...@@ -109,7 +109,7 @@ class VIEWS_EXPORT BubbleBorder : public Border {
}; };
BubbleBorder(Arrow arrow, Shadow shadow, SkColor color); BubbleBorder(Arrow arrow, Shadow shadow, SkColor color);
virtual ~BubbleBorder(); ~BubbleBorder() override;
// Returns the radius of the corner of the border. // Returns the radius of the corner of the border.
// TODO(xiyuan): Get rid of this since it's part of BorderImages now? // TODO(xiyuan): Get rid of this since it's part of BorderImages now?
...@@ -196,9 +196,9 @@ class VIEWS_EXPORT BubbleBorder : public Border { ...@@ -196,9 +196,9 @@ class VIEWS_EXPORT BubbleBorder : public Border {
int GetArrowOffset(const gfx::Size& border_size) const; int GetArrowOffset(const gfx::Size& border_size) const;
// Overridden from Border: // Overridden from Border:
virtual void Paint(const View& view, gfx::Canvas* canvas) override; void Paint(const View& view, gfx::Canvas* canvas) override;
virtual gfx::Insets GetInsets() const override; gfx::Insets GetInsets() const override;
virtual gfx::Size GetMinimumSize() const override; gfx::Size GetMinimumSize() const override;
private: private:
FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetSizeForContentsSizeTest); FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetSizeForContentsSizeTest);
...@@ -233,7 +233,7 @@ class VIEWS_EXPORT BubbleBackground : public Background { ...@@ -233,7 +233,7 @@ class VIEWS_EXPORT BubbleBackground : public Background {
explicit BubbleBackground(BubbleBorder* border) : border_(border) {} explicit BubbleBackground(BubbleBorder* border) : border_(border) {}
// Overridden from Background: // Overridden from Background:
virtual void Paint(gfx::Canvas* canvas, View* view) const override; void Paint(gfx::Canvas* canvas, View* view) const override;
private: private:
BubbleBorder* border_; BubbleBorder* border_;
......
...@@ -27,27 +27,25 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, ...@@ -27,27 +27,25 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
public: public:
BubbleDelegateView(); BubbleDelegateView();
BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow);
virtual ~BubbleDelegateView(); ~BubbleDelegateView() override;
// Create and initialize the bubble Widget(s) with proper bounds. // Create and initialize the bubble Widget(s) with proper bounds.
static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
// WidgetDelegateView overrides: // WidgetDelegateView overrides:
virtual BubbleDelegateView* AsBubbleDelegate() override; BubbleDelegateView* AsBubbleDelegate() override;
virtual bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
virtual View* GetContentsView() override; View* GetContentsView() override;
virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; NonClientFrameView* CreateNonClientFrameView(Widget* widget) override;
virtual void GetAccessibleState(ui::AXViewState* state) override; void GetAccessibleState(ui::AXViewState* state) override;
// WidgetObserver overrides: // WidgetObserver overrides:
virtual void OnWidgetDestroying(Widget* widget) override; void OnWidgetDestroying(Widget* widget) override;
virtual void OnWidgetVisibilityChanging(Widget* widget, bool visible) void OnWidgetVisibilityChanging(Widget* widget, bool visible) override;
override; void OnWidgetVisibilityChanged(Widget* widget, bool visible) override;
virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) void OnWidgetActivationChanged(Widget* widget, bool active) override;
override; void OnWidgetBoundsChanged(Widget* widget,
virtual void OnWidgetActivationChanged(Widget* widget, bool active) override; const gfx::Rect& new_bounds) override;
virtual void OnWidgetBoundsChanged(Widget* widget,
const gfx::Rect& new_bounds) override;
bool close_on_esc() const { return close_on_esc_; } bool close_on_esc() const { return close_on_esc_; }
void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
...@@ -119,8 +117,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, ...@@ -119,8 +117,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
virtual const gfx::FontList& GetTitleFontList() const; virtual const gfx::FontList& GetTitleFontList() const;
// View overrides: // View overrides:
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// Perform view initialization on the contents for bubble sizing. // Perform view initialization on the contents for bubble sizing.
virtual void Init(); virtual void Init();
......
...@@ -22,7 +22,7 @@ class TestBubbleDelegateView : public BubbleDelegateView { ...@@ -22,7 +22,7 @@ class TestBubbleDelegateView : public BubbleDelegateView {
view_->SetFocusable(true); view_->SetFocusable(true);
AddChildView(view_); AddChildView(view_);
} }
virtual ~TestBubbleDelegateView() {} ~TestBubbleDelegateView() override {}
void SetAnchorRectForTest(gfx::Rect rect) { void SetAnchorRectForTest(gfx::Rect rect) {
SetAnchorRect(rect); SetAnchorRect(rect);
...@@ -33,10 +33,8 @@ class TestBubbleDelegateView : public BubbleDelegateView { ...@@ -33,10 +33,8 @@ class TestBubbleDelegateView : public BubbleDelegateView {
} }
// BubbleDelegateView overrides: // BubbleDelegateView overrides:
virtual View* GetInitiallyFocusedView() override { return view_; } View* GetInitiallyFocusedView() override { return view_; }
virtual gfx::Size GetPreferredSize() const override { gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
return gfx::Size(200, 200);
}
private: private:
View* view_; View* view_;
...@@ -47,7 +45,7 @@ class TestBubbleDelegateView : public BubbleDelegateView { ...@@ -47,7 +45,7 @@ class TestBubbleDelegateView : public BubbleDelegateView {
class BubbleDelegateTest : public ViewsTestBase { class BubbleDelegateTest : public ViewsTestBase {
public: public:
BubbleDelegateTest() {} BubbleDelegateTest() {}
virtual ~BubbleDelegateTest() {} ~BubbleDelegateTest() override {}
// Creates a test widget that owns its native widget. // Creates a test widget that owns its native widget.
Widget* CreateTestWidget() { Widget* CreateTestWidget() {
......
...@@ -30,7 +30,7 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, ...@@ -30,7 +30,7 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView,
static const char kViewClassName[]; static const char kViewClassName[];
explicit BubbleFrameView(const gfx::Insets& content_margins); explicit BubbleFrameView(const gfx::Insets& content_margins);
virtual ~BubbleFrameView(); ~BubbleFrameView() override;
// Insets to make bubble contents align horizontal with the bubble title. // Insets to make bubble contents align horizontal with the bubble title.
// NOTE: this does not take into account whether a title actually exists. // NOTE: this does not take into account whether a title actually exists.
...@@ -40,33 +40,32 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, ...@@ -40,33 +40,32 @@ class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView,
static LabelButton* CreateCloseButton(ButtonListener* listener); static LabelButton* CreateCloseButton(ButtonListener* listener);
// NonClientFrameView overrides: // NonClientFrameView overrides:
virtual gfx::Rect GetBoundsForClientView() const override; gfx::Rect GetBoundsForClientView() const override;
virtual gfx::Rect GetWindowBoundsForClientBounds( gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override; const gfx::Rect& client_bounds) const override;
virtual int NonClientHitTest(const gfx::Point& point) override; int NonClientHitTest(const gfx::Point& point) override;
virtual void GetWindowMask(const gfx::Size& size, void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
gfx::Path* window_mask) override; void ResetWindowControls() override;
virtual void ResetWindowControls() override; void UpdateWindowIcon() override;
virtual void UpdateWindowIcon() override; void UpdateWindowTitle() override;
virtual void UpdateWindowTitle() override; void SizeConstraintsChanged() override;
virtual void SizeConstraintsChanged() override;
// Set the FontList to be used for the title of the bubble. // Set the FontList to be used for the title of the bubble.
// Caller must arrange to update the layout to have the call take effect. // Caller must arrange to update the layout to have the call take effect.
void SetTitleFontList(const gfx::FontList& font_list); void SetTitleFontList(const gfx::FontList& font_list);
// View overrides: // View overrides:
virtual gfx::Insets GetInsets() const override; gfx::Insets GetInsets() const override;
virtual gfx::Size GetPreferredSize() const override; gfx::Size GetPreferredSize() const override;
virtual gfx::Size GetMinimumSize() const override; gfx::Size GetMinimumSize() const override;
virtual void Layout() override; void Layout() override;
virtual const char* GetClassName() const override; const char* GetClassName() const override;
virtual void ChildPreferredSizeChanged(View* child) override; void ChildPreferredSizeChanged(View* child) override;
virtual void OnThemeChanged() override; void OnThemeChanged() override;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// Overridden from ButtonListener: // Overridden from ButtonListener:
virtual void ButtonPressed(Button* sender, const ui::Event& event) override; void ButtonPressed(Button* sender, const ui::Event& event) override;
// Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder().
BubbleBorder* bubble_border() const { return bubble_border_; } BubbleBorder* bubble_border() const { return bubble_border_; }
......
...@@ -26,10 +26,10 @@ class TestBubbleFrameView : public BubbleFrameView { ...@@ -26,10 +26,10 @@ class TestBubbleFrameView : public BubbleFrameView {
SetBubbleBorder(scoped_ptr<views::BubbleBorder>( SetBubbleBorder(scoped_ptr<views::BubbleBorder>(
new BubbleBorder(kArrow, BubbleBorder::NO_SHADOW, kColor))); new BubbleBorder(kArrow, BubbleBorder::NO_SHADOW, kColor)));
} }
virtual ~TestBubbleFrameView() {} ~TestBubbleFrameView() override {}
// BubbleFrameView overrides: // BubbleFrameView overrides:
virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) override { gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) override {
return available_bounds_; return available_bounds_;
} }
......
...@@ -18,12 +18,11 @@ class VIEWS_EXPORT BubbleWindowTargeter ...@@ -18,12 +18,11 @@ class VIEWS_EXPORT BubbleWindowTargeter
: public NON_EXPORTED_BASE(wm::MaskedWindowTargeter) { : public NON_EXPORTED_BASE(wm::MaskedWindowTargeter) {
public: public:
explicit BubbleWindowTargeter(BubbleDelegateView* bubble); explicit BubbleWindowTargeter(BubbleDelegateView* bubble);
virtual ~BubbleWindowTargeter(); ~BubbleWindowTargeter() override;
private: private:
// wm::MaskedWindowTargeter: // wm::MaskedWindowTargeter:
virtual bool GetHitTestMask(aura::Window* window, bool GetHitTestMask(aura::Window* window, gfx::Path* mask) const override;
gfx::Path* mask) const override;
views::BubbleDelegateView* bubble_; views::BubbleDelegateView* bubble_;
......
...@@ -21,12 +21,12 @@ class WidgetOwnsNativeBubble : public BubbleDelegateView { ...@@ -21,12 +21,12 @@ class WidgetOwnsNativeBubble : public BubbleDelegateView {
: BubbleDelegateView(content, arrow) { : BubbleDelegateView(content, arrow) {
} }
virtual ~WidgetOwnsNativeBubble() {} ~WidgetOwnsNativeBubble() override {}
private: private:
// BubbleDelegateView: // BubbleDelegateView:
virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params, void OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* widget) const override { Widget* widget) const override {
params->ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params->ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
} }
...@@ -40,9 +40,9 @@ class BubbleWindowTargeterTest : public ViewsTestBase { ...@@ -40,9 +40,9 @@ class BubbleWindowTargeterTest : public ViewsTestBase {
BubbleWindowTargeterTest() BubbleWindowTargeterTest()
: bubble_delegate_(NULL) { : bubble_delegate_(NULL) {
} }
virtual ~BubbleWindowTargeterTest() {} ~BubbleWindowTargeterTest() override {}
virtual void SetUp() override { void SetUp() override {
ViewsTestBase::SetUp(); ViewsTestBase::SetUp();
CreateAnchorWidget(); CreateAnchorWidget();
CreateBubbleWidget(); CreateBubbleWidget();
...@@ -51,7 +51,7 @@ class BubbleWindowTargeterTest : public ViewsTestBase { ...@@ -51,7 +51,7 @@ class BubbleWindowTargeterTest : public ViewsTestBase {
bubble_widget()->Show(); bubble_widget()->Show();
} }
virtual void TearDown() override { void TearDown() override {
bubble_delegate_ = NULL; bubble_delegate_ = NULL;
bubble_widget_.reset(); bubble_widget_.reset();
anchor_.reset(); anchor_.reset();
......
...@@ -53,10 +53,10 @@ namespace internal { ...@@ -53,10 +53,10 @@ namespace internal {
class MouseMoveDetectorHost : public MouseWatcherHost { class MouseMoveDetectorHost : public MouseWatcherHost {
public: public:
MouseMoveDetectorHost(); MouseMoveDetectorHost();
virtual ~MouseMoveDetectorHost(); ~MouseMoveDetectorHost() override;
bool Contains(const gfx::Point& screen_point, MouseEventType type) override;
virtual bool Contains(const gfx::Point& screen_point,
MouseEventType type) override;
private: private:
DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost);
}; };
...@@ -89,12 +89,12 @@ class TrayBubbleBorder : public BubbleBorder { ...@@ -89,12 +89,12 @@ class TrayBubbleBorder : public BubbleBorder {
set_paint_arrow(params.arrow_paint_type); set_paint_arrow(params.arrow_paint_type);
} }
virtual ~TrayBubbleBorder() {} ~TrayBubbleBorder() override {}
// Overridden from BubbleBorder. // Overridden from BubbleBorder.
// Sets the bubble on top of the anchor when it has no arrow. // Sets the bubble on top of the anchor when it has no arrow.
virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to, gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
const gfx::Size& contents_size) const override { const gfx::Size& contents_size) const override {
if (has_arrow(arrow())) { if (has_arrow(arrow())) {
gfx::Rect rect = gfx::Rect rect =
BubbleBorder::GetBounds(position_relative_to, contents_size); BubbleBorder::GetBounds(position_relative_to, contents_size);
...@@ -177,16 +177,15 @@ class TrayBubbleBorder : public BubbleBorder { ...@@ -177,16 +177,15 @@ class TrayBubbleBorder : public BubbleBorder {
class TrayBubbleContentMask : public ui::LayerDelegate { class TrayBubbleContentMask : public ui::LayerDelegate {
public: public:
explicit TrayBubbleContentMask(int corner_radius); explicit TrayBubbleContentMask(int corner_radius);
virtual ~TrayBubbleContentMask(); ~TrayBubbleContentMask() override;
ui::Layer* layer() { return &layer_; } ui::Layer* layer() { return &layer_; }
// Overridden from LayerDelegate. // Overridden from LayerDelegate.
virtual void OnPaintLayer(gfx::Canvas* canvas) override; void OnPaintLayer(gfx::Canvas* canvas) override;
virtual void OnDelegatedFrameDamage( void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {}
const gfx::Rect& damage_rect_in_dip) override {} void OnDeviceScaleFactorChanged(float device_scale_factor) override;
virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; base::Closure PrepareForLayerBoundsChange() override;
virtual base::Closure PrepareForLayerBoundsChange() override;
private: private:
ui::Layer layer_; ui::Layer layer_;
...@@ -231,10 +230,10 @@ class BottomAlignedBoxLayout : public BoxLayout { ...@@ -231,10 +230,10 @@ class BottomAlignedBoxLayout : public BoxLayout {
bubble_view_(bubble_view) { bubble_view_(bubble_view) {
} }
virtual ~BottomAlignedBoxLayout() {} ~BottomAlignedBoxLayout() override {}
private: private:
virtual void Layout(View* host) override { void Layout(View* host) override {
if (host->height() >= host->GetPreferredSize().height() || if (host->height() >= host->GetPreferredSize().height() ||
!bubble_view_->is_gesture_dragging()) { !bubble_view_->is_gesture_dragging()) {
BoxLayout::Layout(host); BoxLayout::Layout(host);
......
...@@ -117,7 +117,7 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView, ...@@ -117,7 +117,7 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView,
Delegate* delegate, Delegate* delegate,
InitParams* init_params); InitParams* init_params);
virtual ~TrayBubbleView(); ~TrayBubbleView() override;
// Sets up animations, and show the bubble. Must occur after CreateBubble() // Sets up animations, and show the bubble. Must occur after CreateBubble()
// is called. // is called.
...@@ -147,25 +147,25 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView, ...@@ -147,25 +147,25 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView,
bool is_gesture_dragging() const { return is_gesture_dragging_; } bool is_gesture_dragging() const { return is_gesture_dragging_; }
// Overridden from views::WidgetDelegate. // Overridden from views::WidgetDelegate.
virtual bool CanActivate() const override; bool CanActivate() const override;
virtual views::NonClientFrameView* CreateNonClientFrameView( views::NonClientFrameView* CreateNonClientFrameView(
views::Widget* widget) override; views::Widget* widget) override;
virtual bool WidgetHasHitTestMask() const override; bool WidgetHasHitTestMask() const override;
virtual void GetWidgetHitTestMask(gfx::Path* mask) const override; void GetWidgetHitTestMask(gfx::Path* mask) const override;
// Overridden from views::BubbleDelegateView. // Overridden from views::BubbleDelegateView.
virtual gfx::Rect GetAnchorRect() const override; gfx::Rect GetAnchorRect() const override;
// Overridden from views::View. // Overridden from views::View.
virtual gfx::Size GetPreferredSize() const override; gfx::Size GetPreferredSize() const override;
virtual gfx::Size GetMaximumSize() const override; gfx::Size GetMaximumSize() const override;
virtual int GetHeightForWidth(int width) const override; int GetHeightForWidth(int width) const override;
virtual void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseEntered(const ui::MouseEvent& event) override;
virtual void OnMouseExited(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override;
virtual void GetAccessibleState(ui::AXViewState* state) override; void GetAccessibleState(ui::AXViewState* state) override;
// Overridden from MouseWatcherListener // Overridden from MouseWatcherListener
virtual void MouseMovedOutOfHost() override; void MouseMovedOutOfHost() override;
protected: protected:
TrayBubbleView(gfx::NativeView parent_window, TrayBubbleView(gfx::NativeView parent_window,
...@@ -174,11 +174,11 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView, ...@@ -174,11 +174,11 @@ class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView,
const InitParams& init_params); const InitParams& init_params);
// Overridden from views::BubbleDelegateView. // Overridden from views::BubbleDelegateView.
virtual void Init() override; void Init() override;
// Overridden from views::View. // Overridden from views::View.
virtual void ChildPreferredSizeChanged(View* child) override; void ChildPreferredSizeChanged(View* child) override;
virtual void ViewHierarchyChanged( void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) override; const ViewHierarchyChangedDetails& details) override;
private: private:
......
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