Commit 0a5ed8fe 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=msw@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#301456}
parent 9ab9844c
...@@ -52,7 +52,7 @@ class VIEWS_EXPORT Textfield : public View, ...@@ -52,7 +52,7 @@ class VIEWS_EXPORT Textfield : public View,
static size_t GetCaretBlinkMs(); static size_t GetCaretBlinkMs();
Textfield(); Textfield();
virtual ~Textfield(); ~Textfield() override;
// Set the controller for this textfield. // Set the controller for this textfield.
void set_controller(TextfieldController* controller) { void set_controller(TextfieldController* controller) {
...@@ -205,111 +205,106 @@ class VIEWS_EXPORT Textfield : public View, ...@@ -205,111 +205,106 @@ class VIEWS_EXPORT Textfield : public View,
bool HasTextBeingDragged(); bool HasTextBeingDragged();
// View overrides: // View overrides:
virtual gfx::Insets GetInsets() const override; gfx::Insets GetInsets() const override;
virtual int GetBaseline() const override; int GetBaseline() const override;
virtual gfx::Size GetPreferredSize() const override; gfx::Size GetPreferredSize() const override;
virtual const char* GetClassName() const override; const char* GetClassName() const override;
virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
virtual bool OnMousePressed(const ui::MouseEvent& event) override; bool OnMousePressed(const ui::MouseEvent& event) override;
virtual bool OnMouseDragged(const ui::MouseEvent& event) override; bool OnMouseDragged(const ui::MouseEvent& event) override;
virtual void OnMouseReleased(const ui::MouseEvent& event) override; void OnMouseReleased(const ui::MouseEvent& event) override;
virtual bool OnKeyPressed(const ui::KeyEvent& event) override; bool OnKeyPressed(const ui::KeyEvent& event) override;
virtual ui::TextInputClient* GetTextInputClient() override; ui::TextInputClient* GetTextInputClient() override;
virtual void OnGestureEvent(ui::GestureEvent* event) override; void OnGestureEvent(ui::GestureEvent* event) override;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) override; void AboutToRequestFocusFromTabTraversal(bool reverse) override;
virtual bool SkipDefaultKeyEventProcessing( bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override;
const ui::KeyEvent& event) override; bool GetDropFormats(
virtual bool GetDropFormats(
int* formats, int* formats,
std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override; std::set<ui::OSExchangeData::CustomFormat>* custom_formats) override;
virtual bool CanDrop(const ui::OSExchangeData& data) override; bool CanDrop(const ui::OSExchangeData& data) override;
virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; int OnDragUpdated(const ui::DropTargetEvent& event) override;
virtual void OnDragExited() override; void OnDragExited() override;
virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; int OnPerformDrop(const ui::DropTargetEvent& event) override;
virtual void OnDragDone() override; void OnDragDone() override;
virtual void GetAccessibleState(ui::AXViewState* state) override; void GetAccessibleState(ui::AXViewState* state) override;
virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
virtual bool GetNeedsNotificationWhenVisibleBoundsChange() const override; bool GetNeedsNotificationWhenVisibleBoundsChange() const override;
virtual void OnVisibleBoundsChanged() override; void OnVisibleBoundsChanged() override;
virtual void OnEnabledChanged() override; void OnEnabledChanged() override;
virtual void OnPaint(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override;
virtual void OnFocus() override; void OnFocus() override;
virtual void OnBlur() override; void OnBlur() override;
virtual gfx::Point GetKeyboardContextMenuLocation() override; gfx::Point GetKeyboardContextMenuLocation() override;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
// TextfieldModel::Delegate overrides: // TextfieldModel::Delegate overrides:
virtual void OnCompositionTextConfirmedOrCleared() override; void OnCompositionTextConfirmedOrCleared() override;
// ContextMenuController overrides: // ContextMenuController overrides:
virtual void ShowContextMenuForView(View* source, void ShowContextMenuForView(View* source,
const gfx::Point& point, const gfx::Point& point,
ui::MenuSourceType source_type) override; ui::MenuSourceType source_type) override;
// DragController overrides: // DragController overrides:
virtual void WriteDragDataForView(View* sender, void WriteDragDataForView(View* sender,
const gfx::Point& press_pt, const gfx::Point& press_pt,
ui::OSExchangeData* data) override; ui::OSExchangeData* data) override;
virtual int GetDragOperationsForView(View* sender, int GetDragOperationsForView(View* sender, const gfx::Point& p) override;
const gfx::Point& p) override; bool CanStartDragForView(View* sender,
virtual bool CanStartDragForView(View* sender, const gfx::Point& press_pt,
const gfx::Point& press_pt, const gfx::Point& p) override;
const gfx::Point& p) override;
// ui::TouchEditable overrides: // ui::TouchEditable overrides:
virtual void SelectRect(const gfx::Point& start, void SelectRect(const gfx::Point& start, const gfx::Point& end) override;
const gfx::Point& end) override; void MoveCaretTo(const gfx::Point& point) override;
virtual void MoveCaretTo(const gfx::Point& point) override; void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) override;
virtual void GetSelectionEndPoints(gfx::Rect* p1, gfx::Rect* p2) override; gfx::Rect GetBounds() override;
virtual gfx::Rect GetBounds() override; gfx::NativeView GetNativeView() const override;
virtual gfx::NativeView GetNativeView() const override; void ConvertPointToScreen(gfx::Point* point) override;
virtual void ConvertPointToScreen(gfx::Point* point) override; void ConvertPointFromScreen(gfx::Point* point) override;
virtual void ConvertPointFromScreen(gfx::Point* point) override; bool DrawsHandles() override;
virtual bool DrawsHandles() override; void OpenContextMenu(const gfx::Point& anchor) override;
virtual void OpenContextMenu(const gfx::Point& anchor) override; void DestroyTouchSelection() override;
virtual void DestroyTouchSelection() override;
// ui::SimpleMenuModel::Delegate overrides: // ui::SimpleMenuModel::Delegate overrides:
virtual bool IsCommandIdChecked(int command_id) const override; bool IsCommandIdChecked(int command_id) const override;
virtual bool IsCommandIdEnabled(int command_id) const override; bool IsCommandIdEnabled(int command_id) const override;
virtual bool GetAcceleratorForCommandId( bool GetAcceleratorForCommandId(int command_id,
int command_id, ui::Accelerator* accelerator) override;
ui::Accelerator* accelerator) override; void ExecuteCommand(int command_id, int event_flags) override;
virtual void ExecuteCommand(int command_id, int event_flags) override;
// ui::TextInputClient overrides: // ui::TextInputClient overrides:
virtual void SetCompositionText( void SetCompositionText(const ui::CompositionText& composition) override;
const ui::CompositionText& composition) override; void ConfirmCompositionText() override;
virtual void ConfirmCompositionText() override; void ClearCompositionText() override;
virtual void ClearCompositionText() override; void InsertText(const base::string16& text) override;
virtual void InsertText(const base::string16& text) override; void InsertChar(base::char16 ch, int flags) override;
virtual void InsertChar(base::char16 ch, int flags) override; gfx::NativeWindow GetAttachedWindow() const override;
virtual gfx::NativeWindow GetAttachedWindow() const override; ui::TextInputType GetTextInputType() const override;
virtual ui::TextInputType GetTextInputType() const override; ui::TextInputMode GetTextInputMode() const override;
virtual ui::TextInputMode GetTextInputMode() const override; int GetTextInputFlags() const override;
virtual int GetTextInputFlags() const override; bool CanComposeInline() const override;
virtual bool CanComposeInline() const override; gfx::Rect GetCaretBounds() const override;
virtual gfx::Rect GetCaretBounds() const override; bool GetCompositionCharacterBounds(uint32 index,
virtual bool GetCompositionCharacterBounds(uint32 index, gfx::Rect* rect) const override;
gfx::Rect* rect) const override; bool HasCompositionText() const override;
virtual bool HasCompositionText() const override; bool GetTextRange(gfx::Range* range) const override;
virtual bool GetTextRange(gfx::Range* range) const override; bool GetCompositionTextRange(gfx::Range* range) const override;
virtual bool GetCompositionTextRange(gfx::Range* range) const override; bool GetSelectionRange(gfx::Range* range) const override;
virtual bool GetSelectionRange(gfx::Range* range) const override; bool SetSelectionRange(const gfx::Range& range) override;
virtual bool SetSelectionRange(const gfx::Range& range) override; bool DeleteRange(const gfx::Range& range) override;
virtual bool DeleteRange(const gfx::Range& range) override; bool GetTextFromRange(const gfx::Range& range,
virtual bool GetTextFromRange(const gfx::Range& range, base::string16* text) const override;
base::string16* text) const override; void OnInputMethodChanged() override;
virtual void OnInputMethodChanged() override; bool ChangeTextDirectionAndLayoutAlignment(
virtual bool ChangeTextDirectionAndLayoutAlignment(
base::i18n::TextDirection direction) override; base::i18n::TextDirection direction) override;
virtual void ExtendSelectionAndDelete(size_t before, size_t after) override; void ExtendSelectionAndDelete(size_t before, size_t after) override;
virtual void EnsureCaretInRect(const gfx::Rect& rect) override; void EnsureCaretInRect(const gfx::Rect& rect) override;
virtual void OnCandidateWindowShown() override; void OnCandidateWindowShown() override;
virtual void OnCandidateWindowUpdated() override; void OnCandidateWindowUpdated() override;
virtual void OnCandidateWindowHidden() override; void OnCandidateWindowHidden() override;
virtual bool IsEditingCommandEnabled(int command_id) override; bool IsEditingCommandEnabled(int command_id) override;
virtual void ExecuteEditingCommand(int command_id) override; void ExecuteEditingCommand(int command_id) override;
protected: protected:
// Returns the TextfieldModel's text/cursor/selection rendering model. // Returns the TextfieldModel's text/cursor/selection rendering model.
......
...@@ -160,7 +160,7 @@ class InsertEdit : public Edit { ...@@ -160,7 +160,7 @@ class InsertEdit : public Edit {
} }
// Edit implementation. // Edit implementation.
virtual bool DoMerge(const Edit* edit) override { bool DoMerge(const Edit* edit) override {
if (edit->type() != INSERT_EDIT || new_text_end() != edit->new_text_start_) if (edit->type() != INSERT_EDIT || new_text_end() != edit->new_text_start_)
return false; return false;
// If continuous edit, merge it. // If continuous edit, merge it.
...@@ -193,7 +193,7 @@ class ReplaceEdit : public Edit { ...@@ -193,7 +193,7 @@ class ReplaceEdit : public Edit {
} }
// Edit implementation. // Edit implementation.
virtual bool DoMerge(const Edit* edit) override { bool DoMerge(const Edit* edit) override {
if (edit->type() == DELETE_EDIT || if (edit->type() == DELETE_EDIT ||
new_text_end() != edit->old_text_start_ || new_text_end() != edit->old_text_start_ ||
edit->old_text_start_ != edit->new_text_start_) edit->old_text_start_ != edit->new_text_start_)
...@@ -223,7 +223,7 @@ class DeleteEdit : public Edit { ...@@ -223,7 +223,7 @@ class DeleteEdit : public Edit {
} }
// Edit implementation. // Edit implementation.
virtual bool DoMerge(const Edit* edit) override { bool DoMerge(const Edit* edit) override {
if (edit->type() != DELETE_EDIT) if (edit->type() != DELETE_EDIT)
return false; return false;
......
...@@ -50,7 +50,7 @@ class TextfieldModelTest : public ViewsTestBase, ...@@ -50,7 +50,7 @@ class TextfieldModelTest : public ViewsTestBase,
composition_text_confirmed_or_cleared_(false) { composition_text_confirmed_or_cleared_(false) {
} }
virtual void OnCompositionTextConfirmedOrCleared() override { void OnCompositionTextConfirmedOrCleared() override {
composition_text_confirmed_or_cleared_ = true; composition_text_confirmed_or_cleared_ = true;
} }
......
...@@ -64,7 +64,7 @@ class TestTextfield : public views::Textfield { ...@@ -64,7 +64,7 @@ class TestTextfield : public views::Textfield {
key_received_(false), key_received_(false),
weak_ptr_factory_(this) {} weak_ptr_factory_(this) {}
virtual bool OnKeyPressed(const ui::KeyEvent& e) override { bool OnKeyPressed(const ui::KeyEvent& e) override {
key_received_ = true; key_received_ = true;
// Since OnKeyPressed() might destroy |this|, get a weak pointer and // Since OnKeyPressed() might destroy |this|, get a weak pointer and
...@@ -80,7 +80,7 @@ class TestTextfield : public views::Textfield { ...@@ -80,7 +80,7 @@ class TestTextfield : public views::Textfield {
return key_handled_; return key_handled_;
} }
virtual bool OnKeyReleased(const ui::KeyEvent& e) override { bool OnKeyReleased(const ui::KeyEvent& e) override {
key_received_ = true; key_received_ = true;
key_handled_ = views::Textfield::OnKeyReleased(e); key_handled_ = views::Textfield::OnKeyReleased(e);
return key_handled_; return key_handled_;
...@@ -122,8 +122,8 @@ class TextfieldDestroyerController : public views::TextfieldController { ...@@ -122,8 +122,8 @@ class TextfieldDestroyerController : public views::TextfieldController {
views::Textfield* target() { return target_.get(); } views::Textfield* target() { return target_.get(); }
// views::TextfieldController: // views::TextfieldController:
virtual bool HandleKeyEvent(views::Textfield* sender, bool HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) override { const ui::KeyEvent& key_event) override {
target_.reset(); target_.reset();
return false; return false;
} }
...@@ -159,11 +159,9 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController { ...@@ -159,11 +159,9 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
} }
// ::testing::Test: // ::testing::Test:
virtual void SetUp() { void SetUp() override { ViewsTestBase::SetUp(); }
ViewsTestBase::SetUp();
}
virtual void TearDown() { void TearDown() override {
if (widget_) if (widget_)
widget_->Close(); widget_->Close();
ViewsTestBase::TearDown(); ViewsTestBase::TearDown();
...@@ -176,23 +174,23 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController { ...@@ -176,23 +174,23 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
} }
// TextfieldController: // TextfieldController:
virtual void ContentsChanged(Textfield* sender, void ContentsChanged(Textfield* sender,
const base::string16& new_contents) override { const base::string16& new_contents) override {
// Paste calls TextfieldController::ContentsChanged() explicitly even if the // Paste calls TextfieldController::ContentsChanged() explicitly even if the
// paste action did not change the content. So |new_contents| may match // paste action did not change the content. So |new_contents| may match
// |last_contents_|. For more info, see http://crbug.com/79002 // |last_contents_|. For more info, see http://crbug.com/79002
last_contents_ = new_contents; last_contents_ = new_contents;
} }
virtual void OnBeforeUserAction(Textfield* sender) override { void OnBeforeUserAction(Textfield* sender) override {
++on_before_user_action_; ++on_before_user_action_;
} }
virtual void OnAfterUserAction(Textfield* sender) override { void OnAfterUserAction(Textfield* sender) override {
++on_after_user_action_; ++on_after_user_action_;
} }
virtual void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override { void OnAfterCutOrCopy(ui::ClipboardType clipboard_type) override {
copied_to_clipboard_ = clipboard_type; copied_to_clipboard_ = clipboard_type;
} }
...@@ -628,9 +626,9 @@ TEST_F(TextfieldTest, OnKeyPressBinding) { ...@@ -628,9 +626,9 @@ TEST_F(TextfieldTest, OnKeyPressBinding) {
class TestDelegate : public ui::TextEditKeyBindingsDelegateAuraLinux { class TestDelegate : public ui::TextEditKeyBindingsDelegateAuraLinux {
public: public:
TestDelegate() {} TestDelegate() {}
virtual ~TestDelegate() {} ~TestDelegate() override {}
virtual bool MatchEvent( bool MatchEvent(
const ui::Event& event, const ui::Event& event,
std::vector<ui::TextEditCommandAuraLinux>* commands) override { std::vector<ui::TextEditCommandAuraLinux>* commands) override {
return false; return false;
......
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