Commit 5b68c67d 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=mdm@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#301507}
parent 131bb7e6
...@@ -86,29 +86,28 @@ class NativeBackendGnome : public PasswordStoreX::NativeBackend, ...@@ -86,29 +86,28 @@ class NativeBackendGnome : public PasswordStoreX::NativeBackend,
public: public:
explicit NativeBackendGnome(LocalProfileId id); explicit NativeBackendGnome(LocalProfileId id);
virtual ~NativeBackendGnome(); ~NativeBackendGnome() override;
virtual bool Init() override; bool Init() override;
// Implements NativeBackend interface. // Implements NativeBackend interface.
virtual password_manager::PasswordStoreChangeList AddLogin( password_manager::PasswordStoreChangeList AddLogin(
const autofill::PasswordForm& form) override; const autofill::PasswordForm& form) override;
virtual bool UpdateLogin( bool UpdateLogin(const autofill::PasswordForm& form,
const autofill::PasswordForm& form,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool RemoveLogin(const autofill::PasswordForm& form) override; bool RemoveLogin(const autofill::PasswordForm& form) override;
virtual bool RemoveLoginsCreatedBetween( bool RemoveLoginsCreatedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool RemoveLoginsSyncedBetween( bool RemoveLoginsSyncedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool GetLogins(const autofill::PasswordForm& form, bool GetLogins(const autofill::PasswordForm& form,
PasswordFormList* forms) override; PasswordFormList* forms) override;
virtual bool GetAutofillableLogins(PasswordFormList* forms) override; bool GetAutofillableLogins(PasswordFormList* forms) override;
virtual bool GetBlacklistLogins(PasswordFormList* forms) override; bool GetBlacklistLogins(PasswordFormList* forms) override;
private: private:
enum TimestampToCompare { enum TimestampToCompare {
......
...@@ -338,7 +338,7 @@ class NativeBackendGnomeTest : public testing::Test { ...@@ -338,7 +338,7 @@ class NativeBackendGnomeTest : public testing::Test {
db_thread_(BrowserThread::DB) { db_thread_(BrowserThread::DB) {
} }
virtual void SetUp() { void SetUp() override {
ASSERT_TRUE(db_thread_.Start()); ASSERT_TRUE(db_thread_.Start());
ASSERT_TRUE(MockGnomeKeyringLoader::LoadMockGnomeKeyring()); ASSERT_TRUE(MockGnomeKeyringLoader::LoadMockGnomeKeyring());
...@@ -393,7 +393,7 @@ class NativeBackendGnomeTest : public testing::Test { ...@@ -393,7 +393,7 @@ class NativeBackendGnomeTest : public testing::Test {
other_auth_.date_synced = base::Time::Now(); other_auth_.date_synced = base::Time::Now();
} }
virtual void TearDown() { void TearDown() override {
base::MessageLoop::current()->PostTask(FROM_HERE, base::MessageLoop::current()->PostTask(FROM_HERE,
base::MessageLoop::QuitClosure()); base::MessageLoop::QuitClosure());
base::MessageLoop::current()->Run(); base::MessageLoop::current()->Run();
......
...@@ -35,29 +35,28 @@ class NativeBackendKWallet : public PasswordStoreX::NativeBackend { ...@@ -35,29 +35,28 @@ class NativeBackendKWallet : public PasswordStoreX::NativeBackend {
public: public:
explicit NativeBackendKWallet(LocalProfileId id); explicit NativeBackendKWallet(LocalProfileId id);
virtual ~NativeBackendKWallet(); ~NativeBackendKWallet() override;
virtual bool Init() override; bool Init() override;
// Implements NativeBackend interface. // Implements NativeBackend interface.
virtual password_manager::PasswordStoreChangeList AddLogin( password_manager::PasswordStoreChangeList AddLogin(
const autofill::PasswordForm& form) override; const autofill::PasswordForm& form) override;
virtual bool UpdateLogin( bool UpdateLogin(const autofill::PasswordForm& form,
const autofill::PasswordForm& form,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool RemoveLogin(const autofill::PasswordForm& form) override; bool RemoveLogin(const autofill::PasswordForm& form) override;
virtual bool RemoveLoginsCreatedBetween( bool RemoveLoginsCreatedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool RemoveLoginsSyncedBetween( bool RemoveLoginsSyncedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override; password_manager::PasswordStoreChangeList* changes) override;
virtual bool GetLogins(const autofill::PasswordForm& form, bool GetLogins(const autofill::PasswordForm& form,
PasswordFormList* forms) override; PasswordFormList* forms) override;
virtual bool GetAutofillableLogins(PasswordFormList* forms) override; bool GetAutofillableLogins(PasswordFormList* forms) override;
virtual bool GetBlacklistLogins(PasswordFormList* forms) override; bool GetBlacklistLogins(PasswordFormList* forms) override;
protected: protected:
// Invalid handle returned by WalletHandle(). // Invalid handle returned by WalletHandle().
......
...@@ -239,8 +239,8 @@ class NativeBackendKWalletTest : public NativeBackendKWalletTestBase { ...@@ -239,8 +239,8 @@ class NativeBackendKWalletTest : public NativeBackendKWalletTestBase {
kwallet_running_(true), kwallet_enabled_(true) { kwallet_running_(true), kwallet_enabled_(true) {
} }
virtual void SetUp(); void SetUp() override;
virtual void TearDown(); void TearDown() override;
// Let the DB thread run to completion of all current tasks. // Let the DB thread run to completion of all current tasks.
void RunDBThread() { void RunDBThread() {
......
...@@ -257,7 +257,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleTestAuthRequest( ...@@ -257,7 +257,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleTestAuthRequest(
class PasswordManagerBrowserTest : public InProcessBrowserTest { class PasswordManagerBrowserTest : public InProcessBrowserTest {
public: public:
PasswordManagerBrowserTest() {} PasswordManagerBrowserTest() {}
virtual ~PasswordManagerBrowserTest() {} ~PasswordManagerBrowserTest() override {}
// InProcessBrowserTest: // InProcessBrowserTest:
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
......
...@@ -75,30 +75,29 @@ class PasswordStoreX : public password_manager::PasswordStoreDefault { ...@@ -75,30 +75,29 @@ class PasswordStoreX : public password_manager::PasswordStoreDefault {
private: private:
friend class PasswordStoreXTest; friend class PasswordStoreXTest;
virtual ~PasswordStoreX(); ~PasswordStoreX() override;
// Implements PasswordStore interface. // Implements PasswordStore interface.
virtual password_manager::PasswordStoreChangeList AddLoginImpl( password_manager::PasswordStoreChangeList AddLoginImpl(
const autofill::PasswordForm& form) override; const autofill::PasswordForm& form) override;
virtual password_manager::PasswordStoreChangeList UpdateLoginImpl( password_manager::PasswordStoreChangeList UpdateLoginImpl(
const autofill::PasswordForm& form) override; const autofill::PasswordForm& form) override;
virtual password_manager::PasswordStoreChangeList RemoveLoginImpl( password_manager::PasswordStoreChangeList RemoveLoginImpl(
const autofill::PasswordForm& form) override; const autofill::PasswordForm& form) override;
virtual password_manager::PasswordStoreChangeList password_manager::PasswordStoreChangeList RemoveLoginsCreatedBetweenImpl(
RemoveLoginsCreatedBetweenImpl(base::Time delete_begin, base::Time delete_begin,
base::Time delete_end) override; base::Time delete_end) override;
virtual password_manager::PasswordStoreChangeList password_manager::PasswordStoreChangeList RemoveLoginsSyncedBetweenImpl(
RemoveLoginsSyncedBetweenImpl(base::Time delete_begin, base::Time delete_begin,
base::Time delete_end) override; base::Time delete_end) override;
virtual void GetLoginsImpl( void GetLoginsImpl(const autofill::PasswordForm& form,
const autofill::PasswordForm& form,
AuthorizationPromptPolicy prompt_policy, AuthorizationPromptPolicy prompt_policy,
const ConsumerCallbackRunner& callback_runner) override; const ConsumerCallbackRunner& callback_runner) override;
virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) override; void GetAutofillableLoginsImpl(GetLoginsRequest* request) override;
virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) override; void GetBlacklistLoginsImpl(GetLoginsRequest* request) override;
virtual bool FillAutofillableLogins( bool FillAutofillableLogins(
std::vector<autofill::PasswordForm*>* forms) override; std::vector<autofill::PasswordForm*>* forms) override;
virtual bool FillBlacklistLogins( bool FillBlacklistLogins(
std::vector<autofill::PasswordForm*>* forms) override; std::vector<autofill::PasswordForm*>* forms) override;
// Sort logins by origin, like the ORDER BY clause in login_database.cc. // Sort logins by origin, like the ORDER BY clause in login_database.cc.
......
...@@ -57,55 +57,50 @@ class MockPasswordStoreObserver ...@@ -57,55 +57,50 @@ class MockPasswordStoreObserver
class FailingBackend : public PasswordStoreX::NativeBackend { class FailingBackend : public PasswordStoreX::NativeBackend {
public: public:
virtual bool Init() override { return true; } bool Init() override { return true; }
virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) override { PasswordStoreChangeList AddLogin(const PasswordForm& form) override {
return PasswordStoreChangeList(); return PasswordStoreChangeList();
} }
virtual bool UpdateLogin(const PasswordForm& form, bool UpdateLogin(const PasswordForm& form,
PasswordStoreChangeList* changes) override { PasswordStoreChangeList* changes) override {
return false; return false;
} }
virtual bool RemoveLogin(const PasswordForm& form) override { return false; } bool RemoveLogin(const PasswordForm& form) override { return false; }
virtual bool RemoveLoginsCreatedBetween( bool RemoveLoginsCreatedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override { password_manager::PasswordStoreChangeList* changes) override {
return false; return false;
} }
virtual bool RemoveLoginsSyncedBetween( bool RemoveLoginsSyncedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override { password_manager::PasswordStoreChangeList* changes) override {
return false; return false;
} }
virtual bool GetLogins(const PasswordForm& form, bool GetLogins(const PasswordForm& form, PasswordFormList* forms) override {
PasswordFormList* forms) override {
return false; return false;
} }
virtual bool GetAutofillableLogins(PasswordFormList* forms) override { bool GetAutofillableLogins(PasswordFormList* forms) override { return false; }
return false; bool GetBlacklistLogins(PasswordFormList* forms) override { return false; }
}
virtual bool GetBlacklistLogins(PasswordFormList* forms) override {
return false;
}
}; };
class MockBackend : public PasswordStoreX::NativeBackend { class MockBackend : public PasswordStoreX::NativeBackend {
public: public:
virtual bool Init() override { return true; } bool Init() override { return true; }
virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) override { PasswordStoreChangeList AddLogin(const PasswordForm& form) override {
all_forms_.push_back(form); all_forms_.push_back(form);
PasswordStoreChange change(PasswordStoreChange::ADD, form); PasswordStoreChange change(PasswordStoreChange::ADD, form);
return PasswordStoreChangeList(1, change); return PasswordStoreChangeList(1, change);
} }
virtual bool UpdateLogin(const PasswordForm& form, bool UpdateLogin(const PasswordForm& form,
PasswordStoreChangeList* changes) override { PasswordStoreChangeList* changes) override {
for (size_t i = 0; i < all_forms_.size(); ++i) for (size_t i = 0; i < all_forms_.size(); ++i)
if (CompareForms(all_forms_[i], form, true)) { if (CompareForms(all_forms_[i], form, true)) {
...@@ -116,14 +111,14 @@ class MockBackend : public PasswordStoreX::NativeBackend { ...@@ -116,14 +111,14 @@ class MockBackend : public PasswordStoreX::NativeBackend {
return true; return true;
} }
virtual bool RemoveLogin(const PasswordForm& form) override { bool RemoveLogin(const PasswordForm& form) override {
for (size_t i = 0; i < all_forms_.size(); ++i) for (size_t i = 0; i < all_forms_.size(); ++i)
if (CompareForms(all_forms_[i], form, false)) if (CompareForms(all_forms_[i], form, false))
erase(i--); erase(i--);
return true; return true;
} }
virtual bool RemoveLoginsCreatedBetween( bool RemoveLoginsCreatedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override { password_manager::PasswordStoreChangeList* changes) override {
...@@ -135,7 +130,7 @@ class MockBackend : public PasswordStoreX::NativeBackend { ...@@ -135,7 +130,7 @@ class MockBackend : public PasswordStoreX::NativeBackend {
return true; return true;
} }
virtual bool RemoveLoginsSyncedBetween( bool RemoveLoginsSyncedBetween(
base::Time delete_begin, base::Time delete_begin,
base::Time delete_end, base::Time delete_end,
password_manager::PasswordStoreChangeList* changes) override { password_manager::PasswordStoreChangeList* changes) override {
...@@ -151,22 +146,21 @@ class MockBackend : public PasswordStoreX::NativeBackend { ...@@ -151,22 +146,21 @@ class MockBackend : public PasswordStoreX::NativeBackend {
return true; return true;
} }
virtual bool GetLogins(const PasswordForm& form, bool GetLogins(const PasswordForm& form, PasswordFormList* forms) override {
PasswordFormList* forms) override {
for (size_t i = 0; i < all_forms_.size(); ++i) for (size_t i = 0; i < all_forms_.size(); ++i)
if (all_forms_[i].signon_realm == form.signon_realm) if (all_forms_[i].signon_realm == form.signon_realm)
forms->push_back(new PasswordForm(all_forms_[i])); forms->push_back(new PasswordForm(all_forms_[i]));
return true; return true;
} }
virtual bool GetAutofillableLogins(PasswordFormList* forms) override { bool GetAutofillableLogins(PasswordFormList* forms) override {
for (size_t i = 0; i < all_forms_.size(); ++i) for (size_t i = 0; i < all_forms_.size(); ++i)
if (!all_forms_[i].blacklisted_by_user) if (!all_forms_[i].blacklisted_by_user)
forms->push_back(new PasswordForm(all_forms_[i])); forms->push_back(new PasswordForm(all_forms_[i]));
return true; return true;
} }
virtual bool GetBlacklistLogins(PasswordFormList* forms) override { bool GetBlacklistLogins(PasswordFormList* forms) override {
for (size_t i = 0; i < all_forms_.size(); ++i) for (size_t i = 0; i < all_forms_.size(); ++i)
if (all_forms_[i].blacklisted_by_user) if (all_forms_[i].blacklisted_by_user)
forms->push_back(new PasswordForm(all_forms_[i])); forms->push_back(new PasswordForm(all_forms_[i]));
...@@ -247,16 +241,14 @@ enum BackendType { ...@@ -247,16 +241,14 @@ enum BackendType {
class PasswordStoreXTest : public testing::TestWithParam<BackendType> { class PasswordStoreXTest : public testing::TestWithParam<BackendType> {
protected: protected:
virtual void SetUp() { void SetUp() override {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
login_db_.reset(new password_manager::LoginDatabase()); login_db_.reset(new password_manager::LoginDatabase());
ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append("login_test"))); ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append("login_test")));
} }
virtual void TearDown() { void TearDown() override { base::RunLoop().RunUntilIdle(); }
base::RunLoop().RunUntilIdle();
}
PasswordStoreX::NativeBackend* GetBackend() { PasswordStoreX::NativeBackend* GetBackend() {
switch (GetParam()) { switch (GetParam()) {
......
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