diff options
author | dcheng <dcheng@chromium.org> | 2014-10-27 15:10:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-27 22:10:27 +0000 |
commit | 10bc15543a3f53396149f7f391e6deeb3d296732 (patch) | |
tree | 21158e9428b7f643ce50c8dac3d2e75762927e46 /ui/views/window | |
parent | 5a3959f46686634e1c7b380bc65d41833b5d5b19 (diff) | |
download | chromium_src-10bc15543a3f53396149f7f391e6deeb3d296732.zip chromium_src-10bc15543a3f53396149f7f391e6deeb3d296732.tar.gz chromium_src-10bc15543a3f53396149f7f391e6deeb3d296732.tar.bz2 |
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/661033006
Cr-Commit-Position: refs/heads/master@{#301459}
Diffstat (limited to 'ui/views/window')
-rw-r--r-- | ui/views/window/client_view.h | 18 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.h | 31 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view_unittest.cc | 12 | ||||
-rw-r--r-- | ui/views/window/dialog_client_view.h | 32 | ||||
-rw-r--r-- | ui/views/window/dialog_client_view_unittest.cc | 16 | ||||
-rw-r--r-- | ui/views/window/dialog_delegate.h | 37 | ||||
-rw-r--r-- | ui/views/window/dialog_delegate_unittest.cc | 22 | ||||
-rw-r--r-- | ui/views/window/native_frame_view.h | 27 | ||||
-rw-r--r-- | ui/views/window/non_client_view.h | 33 |
9 files changed, 110 insertions, 118 deletions
diff --git a/ui/views/window/client_view.h b/ui/views/window/client_view.h index 53d393b..70dac75 100644 --- a/ui/views/window/client_view.h +++ b/ui/views/window/client_view.h @@ -30,7 +30,7 @@ class VIEWS_EXPORT ClientView : public View { // |widget|, |contents_view| must be valid if you want the initial size of // the widget to be based on |contents_view|'s preferred size. ClientView(Widget* widget, View* contents_view); - virtual ~ClientView() {} + ~ClientView() override {} // Manual RTTI ftw. virtual DialogClientView* AsDialogClientView(); @@ -57,17 +57,17 @@ class VIEWS_EXPORT ClientView : public View { virtual int NonClientHitTest(const gfx::Point& point); // Overridden from View: - virtual gfx::Size GetPreferredSize() const override; - virtual gfx::Size GetMinimumSize() const override; - virtual gfx::Size GetMaximumSize() const override; - virtual void Layout() override; - virtual const char* GetClassName() const override; + gfx::Size GetPreferredSize() const override; + gfx::Size GetMinimumSize() const override; + gfx::Size GetMaximumSize() const override; + void Layout() override; + const char* GetClassName() const override; protected: // Overridden from View: - virtual void GetAccessibleState(ui::AXViewState* state) override; - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; - virtual void ViewHierarchyChanged( + void GetAccessibleState(ui::AXViewState* state) override; + void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + void ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) override; // Accessors for private data members. diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h index a09dd33..b8fc5c4 100644 --- a/ui/views/window/custom_frame_view.h +++ b/ui/views/window/custom_frame_view.h @@ -34,31 +34,30 @@ class VIEWS_EXPORT CustomFrameView : public NonClientFrameView, public ButtonListener { public: CustomFrameView(); - virtual ~CustomFrameView(); + ~CustomFrameView() override; void Init(Widget* frame); // Overridden from NonClientFrameView: - virtual gfx::Rect GetBoundsForClientView() const override; - virtual gfx::Rect GetWindowBoundsForClientBounds( + gfx::Rect GetBoundsForClientView() const override; + gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; - virtual int NonClientHitTest(const gfx::Point& point) override; - virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) override; - virtual void ResetWindowControls() override; - virtual void UpdateWindowIcon() override; - virtual void UpdateWindowTitle() override; - virtual void SizeConstraintsChanged() override; + int NonClientHitTest(const gfx::Point& point) override; + void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; + void ResetWindowControls() override; + void UpdateWindowIcon() override; + void UpdateWindowTitle() override; + void SizeConstraintsChanged() override; // Overridden from View: - virtual void OnPaint(gfx::Canvas* canvas) override; - virtual void Layout() override; - virtual gfx::Size GetPreferredSize() const override; - virtual gfx::Size GetMinimumSize() const override; - virtual gfx::Size GetMaximumSize() const override; + void OnPaint(gfx::Canvas* canvas) override; + void Layout() override; + gfx::Size GetPreferredSize() const override; + gfx::Size GetMinimumSize() const override; + gfx::Size GetMaximumSize() const override; // Overridden from ButtonListener: - virtual void ButtonPressed(Button* sender, const ui::Event& event) override; + void ButtonPressed(Button* sender, const ui::Event& event) override; private: friend class CustomFrameViewTest; diff --git a/ui/views/window/custom_frame_view_unittest.cc b/ui/views/window/custom_frame_view_unittest.cc index 68c79e8..fe20bf9 100644 --- a/ui/views/window/custom_frame_view_unittest.cc +++ b/ui/views/window/custom_frame_view_unittest.cc @@ -24,7 +24,7 @@ class MinimizeAndMaximizeStateControlDelegate : public WidgetDelegateView { MinimizeAndMaximizeStateControlDelegate() : can_maximize_(true), can_minimize_(true) {} - virtual ~MinimizeAndMaximizeStateControlDelegate() {} + ~MinimizeAndMaximizeStateControlDelegate() override {} void set_can_maximize(bool can_maximize) { can_maximize_ = can_maximize; @@ -35,8 +35,8 @@ class MinimizeAndMaximizeStateControlDelegate : public WidgetDelegateView { } // WidgetDelegate: - virtual bool CanMaximize() const override { return can_maximize_; } - virtual bool CanMinimize() const override { return can_minimize_; } + bool CanMaximize() const override { return can_maximize_; } + bool CanMinimize() const override { return can_minimize_; } private: bool can_maximize_; @@ -50,7 +50,7 @@ class MinimizeAndMaximizeStateControlDelegate : public WidgetDelegateView { class CustomFrameViewTest : public ViewsTestBase { public: CustomFrameViewTest() {} - virtual ~CustomFrameViewTest() {} + ~CustomFrameViewTest() override {} CustomFrameView* custom_frame_view() { return custom_frame_view_; @@ -66,8 +66,8 @@ class CustomFrameViewTest : public ViewsTestBase { } // ViewsTestBase: - virtual void SetUp() override; - virtual void TearDown() override; + void SetUp() override; + void TearDown() override; protected: const std::vector<views::FrameButton>& leading_buttons() { diff --git a/ui/views/window/dialog_client_view.h b/ui/views/window/dialog_client_view.h index bf38f25..a04dd46 100644 --- a/ui/views/window/dialog_client_view.h +++ b/ui/views/window/dialog_client_view.h @@ -32,7 +32,7 @@ class VIEWS_EXPORT DialogClientView : public ClientView, public FocusChangeListener { public: DialogClientView(Widget* widget, View* contents_view); - virtual ~DialogClientView(); + ~DialogClientView() override; // Accept or Cancel the dialog. void AcceptWindow(); @@ -46,27 +46,25 @@ class VIEWS_EXPORT DialogClientView : public ClientView, void UpdateDialogButtons(); // ClientView implementation: - virtual bool CanClose() override; - virtual DialogClientView* AsDialogClientView() override; - virtual const DialogClientView* AsDialogClientView() const override; + bool CanClose() override; + DialogClientView* AsDialogClientView() override; + const DialogClientView* AsDialogClientView() const override; // FocusChangeListener implementation: - virtual void OnWillChangeFocus(View* focused_before, - View* focused_now) override; - virtual void OnDidChangeFocus(View* focused_before, - View* focused_now) override; + void OnWillChangeFocus(View* focused_before, View* focused_now) override; + void OnDidChangeFocus(View* focused_before, View* focused_now) override; // View implementation: - virtual gfx::Size GetPreferredSize() const override; - virtual void Layout() override; - virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; - virtual void ViewHierarchyChanged( + gfx::Size GetPreferredSize() const override; + void Layout() override; + bool AcceleratorPressed(const ui::Accelerator& accelerator) override; + void ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) override; - virtual void NativeViewHierarchyChanged() override; - virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; + void NativeViewHierarchyChanged() override; + void OnNativeThemeChanged(const ui::NativeTheme* theme) override; // ButtonListener implementation: - virtual void ButtonPressed(Button* sender, const ui::Event& event) override; + void ButtonPressed(Button* sender, const ui::Event& event) override; protected: // For testing. @@ -82,8 +80,8 @@ class VIEWS_EXPORT DialogClientView : public ClientView, void CreateFootnoteView(); // View implementation. - virtual void ChildPreferredSizeChanged(View* child) override; - virtual void ChildVisibilityChanged(View* child) override; + void ChildPreferredSizeChanged(View* child) override; + void ChildVisibilityChanged(View* child) override; private: FRIEND_TEST_ALL_PREFIXES(DialogClientViewTest, FocusManager); diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index 6f4812cb..17c3b2f 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc @@ -20,10 +20,10 @@ class TestDialogClientView : public DialogClientView { DialogDelegate* dialog_delegate) : DialogClientView(contents_view), dialog_(dialog_delegate) {} - virtual ~TestDialogClientView() {} + ~TestDialogClientView() override {} // DialogClientView implementation. - virtual DialogDelegate* GetDialogDelegate() const override { return dialog_; } + DialogDelegate* GetDialogDelegate() const override { return dialog_; } View* GetContentsView() { return contents_view(); } @@ -45,10 +45,10 @@ class DialogClientViewTest : public ViewsTestBase, : dialog_buttons_(ui::DIALOG_BUTTON_NONE), extra_view_(NULL), footnote_view_(NULL) {} - virtual ~DialogClientViewTest() {} + ~DialogClientViewTest() override {} // testing::Test implementation. - virtual void SetUp() override { + void SetUp() override { dialog_buttons_ = ui::DIALOG_BUTTON_NONE; contents_.reset(new StaticSizedView(gfx::Size(100, 200))); client_view_.reset(new TestDialogClientView(contents_.get(), this)); @@ -57,10 +57,10 @@ class DialogClientViewTest : public ViewsTestBase, } // DialogDelegateView implementation. - virtual View* GetContentsView() override { return contents_.get(); } - virtual View* CreateExtraView() override { return extra_view_; } - virtual View* CreateFootnoteView() override { return footnote_view_; } - virtual int GetDialogButtons() const override { return dialog_buttons_; } + View* GetContentsView() override { return contents_.get(); } + View* CreateExtraView() override { return extra_view_; } + View* CreateFootnoteView() override { return footnote_view_; } + int GetDialogButtons() const override { return dialog_buttons_; } protected: gfx::Rect GetUpdatedClientBounds() { diff --git a/ui/views/window/dialog_delegate.h b/ui/views/window/dialog_delegate.h index d2294c2..dae317e 100644 --- a/ui/views/window/dialog_delegate.h +++ b/ui/views/window/dialog_delegate.h @@ -30,7 +30,7 @@ class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, public WidgetDelegate { public: DialogDelegate(); - virtual ~DialogDelegate(); + ~DialogDelegate() override; // Same as CreateDialogWidgetWithBounds() with an empty |bounds|. static Widget* CreateDialogWidget(WidgetDelegate* delegate, @@ -83,20 +83,19 @@ class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, virtual bool Close(); // Overridden from ui::DialogModel: - virtual base::string16 GetDialogLabel() const override; - virtual base::string16 GetDialogTitle() const override; - virtual int GetDialogButtons() const override; - virtual int GetDefaultDialogButton() const override; - virtual bool ShouldDefaultButtonBeBlue() const override; - virtual base::string16 GetDialogButtonLabel( - ui::DialogButton button) const override; - virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; + base::string16 GetDialogLabel() const override; + base::string16 GetDialogTitle() const override; + int GetDialogButtons() const override; + int GetDefaultDialogButton() const override; + bool ShouldDefaultButtonBeBlue() const override; + base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; + bool IsDialogButtonEnabled(ui::DialogButton button) const override; // Overridden from WidgetDelegate: - virtual View* GetInitiallyFocusedView() override; - virtual DialogDelegate* AsDialogDelegate() override; - virtual ClientView* CreateClientView(Widget* widget) override; - virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; + View* GetInitiallyFocusedView() override; + DialogDelegate* AsDialogDelegate() override; + ClientView* CreateClientView(Widget* widget) override; + NonClientFrameView* CreateNonClientFrameView(Widget* widget) override; // Create a frame view using the new dialog style. static NonClientFrameView* CreateDialogFrameView(Widget* widget); @@ -114,7 +113,7 @@ class VIEWS_EXPORT DialogDelegate : public ui::DialogModel, protected: // Overridden from WidgetDelegate: - virtual ui::AXRole GetAccessibleWindowRole() const override; + ui::AXRole GetAccessibleWindowRole() const override; private: // A flag indicating whether this dialog supports the new style. @@ -129,13 +128,13 @@ class VIEWS_EXPORT DialogDelegateView : public DialogDelegate, public View { public: DialogDelegateView(); - virtual ~DialogDelegateView(); + ~DialogDelegateView() override; // Overridden from DialogDelegate: - virtual void DeleteDelegate() override; - virtual Widget* GetWidget() override; - virtual const Widget* GetWidget() const override; - virtual View* GetContentsView() override; + void DeleteDelegate() override; + Widget* GetWidget() override; + const Widget* GetWidget() const override; + View* GetContentsView() override; private: DISALLOW_COPY_AND_ASSIGN(DialogDelegateView); diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc index 7bbf191..7f91490 100644 --- a/ui/views/window/dialog_delegate_unittest.cc +++ b/ui/views/window/dialog_delegate_unittest.cc @@ -24,27 +24,25 @@ class TestDialog : public DialogDelegateView, public ButtonListener { accepted_(false), closeable_(false), last_pressed_button_(NULL) {} - virtual ~TestDialog() {} + ~TestDialog() override {} // DialogDelegateView overrides: - virtual bool Cancel() override { + bool Cancel() override { canceled_ = true; return closeable_; } - virtual bool Accept() override { + bool Accept() override { accepted_ = true; return closeable_; } // DialogDelegateView overrides: - virtual gfx::Size GetPreferredSize() const override { - return gfx::Size(200, 200); - } - virtual base::string16 GetWindowTitle() const override { return title_; } - virtual bool UseNewStyleForThisDialog() const override { return true; } + gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } + base::string16 GetWindowTitle() const override { return title_; } + bool UseNewStyleForThisDialog() const override { return true; } // ButtonListener override: - virtual void ButtonPressed(Button* sender, const ui::Event& event) override { + void ButtonPressed(Button* sender, const ui::Event& event) override { last_pressed_button_ = sender; } @@ -92,15 +90,15 @@ class TestDialog : public DialogDelegateView, public ButtonListener { class DialogTest : public ViewsTestBase { public: DialogTest() : dialog_(NULL) {} - virtual ~DialogTest() {} + ~DialogTest() override {} - virtual void SetUp() override { + void SetUp() override { ViewsTestBase::SetUp(); dialog_ = new TestDialog(); DialogDelegate::CreateDialogWidget(dialog_, GetContext(), NULL)->Show(); } - virtual void TearDown() override { + void TearDown() override { dialog_->TearDown(); ViewsTestBase::TearDown(); } diff --git a/ui/views/window/native_frame_view.h b/ui/views/window/native_frame_view.h index 3f4d09a..4e38979 100644 --- a/ui/views/window/native_frame_view.h +++ b/ui/views/window/native_frame_view.h @@ -16,25 +16,24 @@ class VIEWS_EXPORT NativeFrameView : public NonClientFrameView { static const char kViewClassName[]; explicit NativeFrameView(Widget* frame); - virtual ~NativeFrameView(); + ~NativeFrameView() override; // NonClientFrameView overrides: - virtual gfx::Rect GetBoundsForClientView() const override; - virtual gfx::Rect GetWindowBoundsForClientBounds( + gfx::Rect GetBoundsForClientView() const override; + gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; - virtual int NonClientHitTest(const gfx::Point& point) override; - virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) override; - virtual void ResetWindowControls() override; - virtual void UpdateWindowIcon() override; - virtual void UpdateWindowTitle() override; - virtual void SizeConstraintsChanged() override; + int NonClientHitTest(const gfx::Point& point) override; + void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; + void ResetWindowControls() override; + void UpdateWindowIcon() override; + void UpdateWindowTitle() override; + void SizeConstraintsChanged() override; // View overrides: - virtual gfx::Size GetPreferredSize() const override; - virtual gfx::Size GetMinimumSize() const override; - virtual gfx::Size GetMaximumSize() const override; - virtual const char* GetClassName() const override; + gfx::Size GetPreferredSize() const override; + gfx::Size GetMinimumSize() const override; + gfx::Size GetMaximumSize() const override; + const char* GetClassName() const override; private: // Our containing frame. diff --git a/ui/views/window/non_client_view.h b/ui/views/window/non_client_view.h index 99a6880..762ccf1 100644 --- a/ui/views/window/non_client_view.h +++ b/ui/views/window/non_client_view.h @@ -39,7 +39,7 @@ class VIEWS_EXPORT NonClientFrameView : public View, kClientEdgeThickness = 1, }; - virtual ~NonClientFrameView(); + ~NonClientFrameView() override; // Sets whether the window should be rendered as active regardless of the // actual active state. Used when bubbles become active to make their parent @@ -82,18 +82,18 @@ class VIEWS_EXPORT NonClientFrameView : public View, virtual void SizeConstraintsChanged() = 0; // View: - virtual void GetAccessibleState(ui::AXViewState* state) override; - virtual const char* GetClassName() const override; + void GetAccessibleState(ui::AXViewState* state) override; + const char* GetClassName() const override; protected: NonClientFrameView(); // ViewTargeterDelegate: - virtual bool DoesIntersectRect(const View* target, - const gfx::Rect& rect) const override; + bool DoesIntersectRect(const View* target, + const gfx::Rect& rect) const override; // View: - virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + void OnBoundsChanged(const gfx::Rect& previous_bounds) override; private: // Prevents the non-client frame view from being rendered as inactive when @@ -143,7 +143,7 @@ class VIEWS_EXPORT NonClientView : public View, public ViewTargeterDelegate { static const char kViewClassName[]; NonClientView(); - virtual ~NonClientView(); + ~NonClientView() override; // Returns the current NonClientFrameView instance, or NULL if // it does not exist. @@ -215,24 +215,23 @@ class VIEWS_EXPORT NonClientView : public View, public ViewTargeterDelegate { void SetAccessibleName(const base::string16& name); // NonClientView, View overrides: - virtual gfx::Size GetPreferredSize() const override; - virtual gfx::Size GetMinimumSize() const override; - virtual gfx::Size GetMaximumSize() const override; - virtual void Layout() override; - virtual void GetAccessibleState(ui::AXViewState* state) override; - virtual const char* GetClassName() const override; + gfx::Size GetPreferredSize() const override; + gfx::Size GetMinimumSize() const override; + gfx::Size GetMaximumSize() const override; + void Layout() override; + void GetAccessibleState(ui::AXViewState* state) override; + const char* GetClassName() const override; - virtual views::View* GetTooltipHandlerForPoint( - const gfx::Point& point) override; + views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; protected: // NonClientView, View overrides: - virtual void ViewHierarchyChanged( + void ViewHierarchyChanged( const ViewHierarchyChangedDetails& details) override; private: // ViewTargeterDelegate: - virtual View* TargetForRect(View* root, const gfx::Rect& rect) override; + View* TargetForRect(View* root, const gfx::Rect& rect) override; // A ClientView object or subclass, responsible for sizing the contents view // of the window, hit testing and perhaps other tasks depending on the |