diff options
author | dcheng <dcheng@chromium.org> | 2014-12-30 13:40:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-30 21:42:42 +0000 |
commit | 6a89b90150b02f7a2c7f56faf9913eaf40f6de17 (patch) | |
tree | ef9b6971622f769b94f885565d42b46006d4e5cb | |
parent | 2ce4615599f4c286b9de5da1eaa8c97da421d295 (diff) | |
download | chromium_src-6a89b90150b02f7a2c7f56faf9913eaf40f6de17.zip chromium_src-6a89b90150b02f7a2c7f56faf9913eaf40f6de17.tar.gz chromium_src-6a89b90150b02f7a2c7f56faf9913eaf40f6de17.tar.bz2 |
Standardize usage of virtual/override/final specifiers in components/.
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.
Several formatting edits by clang-format were manually reverted, due to
mangling of some of the more complicate IPC macros.
BUG=417463
TBR=blundell@chromium.org
Review URL: https://codereview.chromium.org/824513003
Cr-Commit-Position: refs/heads/master@{#309781}
19 files changed, 34 insertions, 50 deletions
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index 20d99d8..554d7f3 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc @@ -45,7 +45,7 @@ class TestPersonalDataManager : public PersonalDataManager { // Overridden to avoid a trip to the database. This should be a no-op except // for the side-effect of logging the profile count. - virtual void LoadProfiles() override { + void LoadProfiles() override { std::vector<AutofillProfile*> profiles; web_profiles_.release(&profiles); WDResult<std::vector<AutofillProfile*> > result(AUTOFILL_PROFILES_RESULT, @@ -55,15 +55,13 @@ class TestPersonalDataManager : public PersonalDataManager { } // Overridden to avoid a trip to the database. - virtual void LoadCreditCards() override {} + void LoadCreditCards() override {} void set_autofill_enabled(bool autofill_enabled) { autofill_enabled_ = autofill_enabled; } - virtual bool IsAutofillEnabled() const override { - return autofill_enabled_; - } + bool IsAutofillEnabled() const override { return autofill_enabled_; } private: void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc index b57ad13..beddfe5 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc @@ -26,14 +26,7 @@ namespace data_reduction_proxy { namespace { -class TestNetworkDelegate : public net::NetworkDelegateImpl { - public: - TestNetworkDelegate() { - } - - virtual ~TestNetworkDelegate() { - } -}; +using TestNetworkDelegate = net::NetworkDelegateImpl; const char kChromeProxyHeader[] = "chrome-proxy"; diff --git a/components/dom_distiller/content/web_contents_main_frame_observer_unittest.cc b/components/dom_distiller/content/web_contents_main_frame_observer_unittest.cc index 0e90092..eeed653 100644 --- a/components/dom_distiller/content/web_contents_main_frame_observer_unittest.cc +++ b/components/dom_distiller/content/web_contents_main_frame_observer_unittest.cc @@ -15,7 +15,7 @@ namespace dom_distiller { class WebContentsMainFrameObserverTest : public content::RenderViewHostTestHarness { - virtual void SetUp() override { + void SetUp() override { content::RenderViewHostTestHarness::SetUp(); dom_distiller::WebContentsMainFrameObserver::CreateForWebContents( web_contents()); diff --git a/components/dom_distiller/core/dom_distiller_store.h b/components/dom_distiller/core/dom_distiller_store.h index 4eda839..103d43e 100644 --- a/components/dom_distiller/core/dom_distiller_store.h +++ b/components/dom_distiller/core/dom_distiller_store.h @@ -126,12 +126,11 @@ class DomDistillerStore : public syncer::SyncableService, bool UpdateEntry(const ArticleEntry& entry) override; bool RemoveEntry(const ArticleEntry& entry) override; - virtual void UpdateAttachments( - const std::string& entry_id, - scoped_ptr<ArticleAttachmentsData> attachments_data, - const UpdateAttachmentsCallback& callback) override; - virtual void GetAttachments(const std::string& entry_id, - const GetAttachmentsCallback& callback) override; + void UpdateAttachments(const std::string& entry_id, + scoped_ptr<ArticleAttachmentsData> attachments_data, + const UpdateAttachmentsCallback& callback) override; + void GetAttachments(const std::string& entry_id, + const GetAttachmentsCallback& callback) override; bool GetEntryById(const std::string& entry_id, ArticleEntry* entry) override; bool GetEntryByUrl(const GURL& url, ArticleEntry* entry) override; diff --git a/components/domain_reliability/monitor.h b/components/domain_reliability/monitor.h index 60f121a..d2bcd6d 100644 --- a/components/domain_reliability/monitor.h +++ b/components/domain_reliability/monitor.h @@ -61,7 +61,7 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor // Must be called from the pref thread if |MoveToNetworkThread| was not // called, or from the network thread if it was called. - virtual ~DomainReliabilityMonitor(); + ~DomainReliabilityMonitor() override; // Must be called before |InitURLRequestContext| on the same thread on which // the Monitor was constructed. Moves (most of) the Monitor to the network @@ -99,7 +99,7 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor void OnCompleted(net::URLRequest* request, bool started); // net::NetworkChangeNotifier::NetworkChangeObserver implementation: - virtual void OnNetworkChanged( + void OnNetworkChanged( net::NetworkChangeNotifier::ConnectionType type) override; // Called to remove browsing data. With CLEAR_BEACONS, leaves contexts in diff --git a/components/domain_reliability/util.h b/components/domain_reliability/util.h index fae5a40..4256b05 100644 --- a/components/domain_reliability/util.h +++ b/components/domain_reliability/util.h @@ -104,10 +104,10 @@ class MockableTimeBackoffEntry : public net::BackoffEntry { MockableTimeBackoffEntry(const net::BackoffEntry::Policy* const policy, MockableTime* time); - virtual ~MockableTimeBackoffEntry(); + ~MockableTimeBackoffEntry() override; protected: - virtual base::TimeTicks ImplGetTimeNow() const override; + base::TimeTicks ImplGetTimeNow() const override; private: MockableTime* time_; diff --git a/components/google/core/browser/google_url_tracker_map_entry.h b/components/google/core/browser/google_url_tracker_map_entry.h index 79c52b7..b19b224 100644 --- a/components/google/core/browser/google_url_tracker_map_entry.h +++ b/components/google/core/browser/google_url_tracker_map_entry.h @@ -22,7 +22,7 @@ class GoogleURLTrackerMapEntry : public infobars::InfoBarManager::Observer { GoogleURLTracker* google_url_tracker, infobars::InfoBarManager* infobar_manager, scoped_ptr<GoogleURLTrackerNavigationHelper> navigation_helper); - virtual ~GoogleURLTrackerMapEntry(); + ~GoogleURLTrackerMapEntry() override; bool has_infobar_delegate() const { return !!infobar_delegate_; } GoogleURLTrackerInfoBarDelegate* infobar_delegate() { diff --git a/components/infobars/core/infobar_container.h b/components/infobars/core/infobar_container.h index d0b076a..ab90ad1 100644 --- a/components/infobars/core/infobar_container.h +++ b/components/infobars/core/infobar_container.h @@ -65,7 +65,7 @@ class InfoBarContainer : public InfoBarManager::Observer { }; explicit InfoBarContainer(Delegate* delegate); - virtual ~InfoBarContainer(); + ~InfoBarContainer() override; // Changes the InfoBarManager for which this container is showing infobars. // This will hide all current infobars, remove them from the container, add diff --git a/components/metrics/histogram_manager.h b/components/metrics/histogram_manager.h index a1f988a..7334ae3 100644 --- a/components/metrics/histogram_manager.h +++ b/components/metrics/histogram_manager.h @@ -27,7 +27,7 @@ namespace metrics { class HistogramManager : public base::HistogramFlattener { public: HistogramManager(); - ~HistogramManager(); + ~HistogramManager() override; // Snapshot all histograms to record the delta into |uma_proto_| and then // returns the serialized protobuf representation of the record in |data|. diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 8d533ed..30a91b5 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc @@ -95,15 +95,14 @@ class TestPasswordManagerClient : public StubPasswordManagerClient { true); } - virtual bool ShouldFilterAutofillResult( - const autofill::PasswordForm& form) override { + bool ShouldFilterAutofillResult(const autofill::PasswordForm& form) override { if (form == form_to_filter_) return true; return false; } - virtual PrefService* GetPrefs() override { return &prefs_; } - virtual PasswordStore* GetPasswordStore() override { return password_store_; } + PrefService* GetPrefs() override { return &prefs_; } + PasswordStore* GetPasswordStore() override { return password_store_; } void SetFormToFilter(const autofill::PasswordForm& form) { form_to_filter_ = form; @@ -113,7 +112,7 @@ class TestPasswordManagerClient : public StubPasswordManagerClient { base::WeakPtr<PasswordManagerDriver> driver() { return driver_->AsWeakPtr(); } - virtual autofill::AutofillManager* GetAutofillManagerForMainFrame() override { + autofill::AutofillManager* GetAutofillManagerForMainFrame() override { return mock_driver()->mock_autofill_manager(); } diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h index 85151e5..b678368 100644 --- a/components/password_manager/core/browser/password_store.h +++ b/components/password_manager/core/browser/password_store.h @@ -206,11 +206,11 @@ class PasswordStore : protected PasswordStoreSync, // Bring PasswordStoreSync methods to the scope of PasswordStore. Otherwise, // base::Bind can't be used with them because it fails to cast PasswordStore // to PasswordStoreSync. - virtual PasswordStoreChangeList AddLoginImpl( + PasswordStoreChangeList AddLoginImpl( const autofill::PasswordForm& form) override = 0; - virtual PasswordStoreChangeList UpdateLoginImpl( + PasswordStoreChangeList UpdateLoginImpl( const autofill::PasswordForm& form) override = 0; - virtual PasswordStoreChangeList RemoveLoginImpl( + PasswordStoreChangeList RemoveLoginImpl( const autofill::PasswordForm& form) override = 0; // Synchronous implementation to remove the given logins. diff --git a/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h b/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h index 717378c..49ce4b0 100644 --- a/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h +++ b/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h @@ -19,7 +19,7 @@ class CryptAuthAccountTokenFetcher : public CryptAuthAccessTokenFetcher, // |token_service| is not owned, and must outlive this object. CryptAuthAccountTokenFetcher(OAuth2TokenService* token_service, const std::string& account_id); - virtual ~CryptAuthAccountTokenFetcher(); + ~CryptAuthAccountTokenFetcher() override; // CryptAuthAccessTokenFetcher: void FetchAccessToken(const AccessTokenCallback& callback) override; diff --git a/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher_unittest.cc b/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher_unittest.cc index 23efd99..74fb5a3 100644 --- a/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher_unittest.cc +++ b/components/proximity_auth/cryptauth/cryptauth_account_token_fetcher_unittest.cc @@ -31,7 +31,6 @@ class ProximityAuthCryptAuthAccountTokenFetcherTest : public testing::Test { : fetcher_(&token_service_, kAccountId) { token_service_.AddAccount(kAccountId); } - virtual ~ProximityAuthCryptAuthAccountTokenFetcherTest() {} FakeOAuth2TokenService token_service_; CryptAuthAccountTokenFetcher fetcher_; diff --git a/components/proximity_auth/cryptauth/cryptauth_client_unittest.cc b/components/proximity_auth/cryptauth/cryptauth_client_unittest.cc index 117ef91..6ee8343 100644 --- a/components/proximity_auth/cryptauth/cryptauth_client_unittest.cc +++ b/components/proximity_auth/cryptauth/cryptauth_client_unittest.cc @@ -112,7 +112,6 @@ class ProximityAuthCryptAuthClientTest : public testing::Test { url_request_context_( new net::TestURLRequestContextGetter(new base::NullTaskRunner())), serialized_request_(std::string()) {} - virtual ~ProximityAuthCryptAuthClientTest() {} void SetUp() override { base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( diff --git a/components/renderer_context_menu/render_view_context_menu_base.h b/components/renderer_context_menu/render_view_context_menu_base.h index f84cf39..779e8bb 100644 --- a/components/renderer_context_menu/render_view_context_menu_base.h +++ b/components/renderer_context_menu/render_view_context_menu_base.h @@ -140,9 +140,8 @@ class RenderViewContextMenuBase : public ui::SimpleMenuModel::Delegate, #endif // Returns the accelerator for given |command_id|. - virtual bool GetAcceleratorForCommandId( - int command_id, - ui::Accelerator* accelerator) = 0; + bool GetAcceleratorForCommandId(int command_id, + ui::Accelerator* accelerator) override = 0; // Subclasses should send notification. virtual void NotifyMenuShown() = 0; diff --git a/components/suggestions/suggestions_service_unittest.cc b/components/suggestions/suggestions_service_unittest.cc index a920957..a2e12e3 100644 --- a/components/suggestions/suggestions_service_unittest.cc +++ b/components/suggestions/suggestions_service_unittest.cc @@ -113,7 +113,6 @@ class TestSuggestionsStore : public suggestions::SuggestionsStore { TestSuggestionsStore() { cached_suggestions = CreateSuggestionsProfile(); } - virtual ~TestSuggestionsStore() {} bool LoadSuggestions(SuggestionsProfile* suggestions) override { if (cached_suggestions.suggestions_size()) { *suggestions = cached_suggestions; diff --git a/components/sync_driver/non_ui_data_type_controller.h b/components/sync_driver/non_ui_data_type_controller.h index 45cee42..82f2eb1 100644 --- a/components/sync_driver/non_ui_data_type_controller.h +++ b/components/sync_driver/non_ui_data_type_controller.h @@ -33,8 +33,8 @@ class NonUIDataTypeController : public DataTypeController { void LoadModels(const ModelLoadCallback& model_load_callback) override; void StartAssociating(const StartCallback& start_callback) override; void Stop() override; - virtual syncer::ModelType type() const = 0; - virtual syncer::ModelSafeGroup model_safe_group() const = 0; + syncer::ModelType type() const override = 0; + syncer::ModelSafeGroup model_safe_group() const override = 0; ChangeProcessor* GetChangeProcessor() const override; std::string name() const override; State state() const override; diff --git a/components/translate/content/renderer/renderer_cld_data_provider.h b/components/translate/content/renderer/renderer_cld_data_provider.h index b5ae4b7..b4ba69b 100644 --- a/components/translate/content/renderer/renderer_cld_data_provider.h +++ b/components/translate/content/renderer/renderer_cld_data_provider.h @@ -40,7 +40,7 @@ class RendererCldDataProvider : public IPC::Listener { // This method is defined as virtual in order to force the implementation to // define the specific IPC message(s) that it handles. // The default implementation does nothing and returns false. - virtual bool OnMessageReceived(const IPC::Message& message) override; + bool OnMessageReceived(const IPC::Message& message) override; // Invoked by the renderer process to request that CLD data be obtained and // that CLD be initialized with it. The implementation is expected to diff --git a/components/wallpaper/wallpaper_manager_base.h b/components/wallpaper/wallpaper_manager_base.h index e81293e..fb4415f 100644 --- a/components/wallpaper/wallpaper_manager_base.h +++ b/components/wallpaper/wallpaper_manager_base.h @@ -223,7 +223,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase const std::string& file); WallpaperManagerBase(); - virtual ~WallpaperManagerBase(); + ~WallpaperManagerBase() override; // Returns the appropriate wallpaper resolution for all root windows. virtual WallpaperResolution GetAppropriateResolution() = 0; @@ -250,10 +250,9 @@ class WALLPAPER_EXPORT WallpaperManagerBase virtual void InitializeWallpaper() = 0; // NotificationObserver overrides: - virtual void Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override = 0; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override = 0; // Removes all |user_id| related wallpaper info and saved wallpapers. virtual void RemoveUserWallpaperInfo(const std::string& user_id) = 0; |