diff options
author | dcheng <dcheng@chromium.org> | 2014-10-21 17:46:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-22 04:03:14 +0000 |
commit | 2bcca5574426bd380d58a7d4ed2ac206b447eb3e (patch) | |
tree | bb2388aaf74310e16fc21229770876d90aa22f88 | |
parent | ba1acbb6fd858192298dd2d9eba8298cd94c2948 (diff) | |
download | chromium_src-2bcca5574426bd380d58a7d4ed2ac206b447eb3e.zip chromium_src-2bcca5574426bd380d58a7d4ed2ac206b447eb3e.tar.gz chromium_src-2bcca5574426bd380d58a7d4ed2ac206b447eb3e.tar.bz2 |
Standardize usage of virtual/override/final in chrome/browser/safe_browsing/
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=mattm@chromium.org
Review URL: https://codereview.chromium.org/657373004
Cr-Commit-Position: refs/heads/master@{#300586}
38 files changed, 260 insertions, 299 deletions
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h index 77ed9e3..2384e35 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.h +++ b/chrome/browser/safe_browsing/client_side_detection_host.h @@ -35,26 +35,26 @@ class ClientSideDetectionHost : public content::WebContentsObserver, // The caller keeps ownership of the tab object and is responsible for // ensuring that it stays valid until WebContentsDestroyed is called. static ClientSideDetectionHost* Create(content::WebContents* tab); - virtual ~ClientSideDetectionHost(); + ~ClientSideDetectionHost() override; // From content::WebContentsObserver. - virtual bool OnMessageReceived(const IPC::Message& message) override; + bool OnMessageReceived(const IPC::Message& message) override; // From content::WebContentsObserver. If we navigate away we cancel all // pending callbacks that could show an interstitial, and check to see whether // we should classify the new URL. - virtual void DidNavigateMainFrame( + void DidNavigateMainFrame( const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params) override; // Called when the SafeBrowsingService found a hit with one of the // SafeBrowsing lists. This method is called on the UI thread. - virtual void OnSafeBrowsingHit( + void OnSafeBrowsingHit( const SafeBrowsingUIManager::UnsafeResource& resource) override; // Called when the SafeBrowsingService finds a match on the SB lists. // Called on the UI thread. Called even if the resource is whitelisted. - virtual void OnSafeBrowsingMatch( + void OnSafeBrowsingMatch( const SafeBrowsingUIManager::UnsafeResource& resource) override; virtual scoped_refptr<SafeBrowsingDatabaseManager> database_manager(); @@ -67,7 +67,7 @@ class ClientSideDetectionHost : public content::WebContentsObserver, explicit ClientSideDetectionHost(content::WebContents* tab); // From content::WebContentsObserver. - virtual void WebContentsDestroyed() override; + void WebContentsDestroyed() override; // Used for testing. void set_safe_browsing_managers( @@ -122,13 +122,13 @@ class ClientSideDetectionHost : public content::WebContentsObserver, // From NotificationObserver. Called when a notification comes in. This // method is called in the UI thread. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; // Inherited from WebContentsObserver. This is called once the page is // done loading. - virtual void DidStopLoading(content::RenderViewHost* rvh) override; + void DidStopLoading(content::RenderViewHost* rvh) override; // Returns true if the user has seen a regular SafeBrowsing // interstitial for the current page. This is only true if the user has diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index 2330132..240fdab 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -233,7 +233,7 @@ class ClientSideDetectionHostTest : public ChromeRenderViewHostTestHarness { ChromeRenderViewHostTestHarness::TearDown(); } - virtual content::BrowserContext* CreateBrowserContext() override { + content::BrowserContext* CreateBrowserContext() override { // Set custom profile object so that we can mock calls to IsOffTheRecord. // This needs to happen before we call the parent SetUp() function. We use // a nice mock because other parts of the code are calling IsOffTheRecord. diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h index 6528b5c..8804f73 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.h +++ b/chrome/browser/safe_browsing/client_side_detection_service.h @@ -66,7 +66,7 @@ class ClientSideDetectionService : public net::URLFetcherDelegate, typedef base::Callback<void(GURL, GURL, bool)> ClientReportMalwareRequestCallback; - virtual ~ClientSideDetectionService(); + ~ClientSideDetectionService() override; // Creates a client-side detection service. The service is initially // disabled, use SetEnabledAndRefreshState() to start it. The caller takes @@ -88,12 +88,12 @@ class ClientSideDetectionService : public net::URLFetcherDelegate, } // From the net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; // content::NotificationObserver overrides: - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; // Sends a request to the SafeBrowsing servers with the ClientPhishingRequest. // The URL scheme of the |url()| in the request should be HTTP. This method diff --git a/chrome/browser/safe_browsing/database_manager.h b/chrome/browser/safe_browsing/database_manager.h index 824800a..e001a35 100644 --- a/chrome/browser/safe_browsing/database_manager.h +++ b/chrome/browser/safe_browsing/database_manager.h @@ -205,7 +205,7 @@ class SafeBrowsingDatabaseManager void StopOnIOThread(bool shutdown); protected: - virtual ~SafeBrowsingDatabaseManager(); + ~SafeBrowsingDatabaseManager() override; // protected for tests. void NotifyDatabaseUpdateFinished(bool update_succeeded); @@ -341,15 +341,15 @@ class SafeBrowsingDatabaseManager const base::Closure& task); // SafeBrowsingProtocolManageDelegate override - virtual void ResetDatabase() override; - virtual void UpdateStarted() override; - virtual void UpdateFinished(bool success) override; - virtual void GetChunks(GetChunksCallback callback) override; - virtual void AddChunks(const std::string& list, - scoped_ptr<ScopedVector<SBChunkData> > chunks, - AddChunksCallback callback) override; - virtual void DeleteChunks( - scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) override; + void ResetDatabase() override; + void UpdateStarted() override; + void UpdateFinished(bool success) override; + void GetChunks(GetChunksCallback callback) override; + void AddChunks(const std::string& list, + scoped_ptr<ScopedVector<SBChunkData>> chunks, + AddChunksCallback callback) override; + void DeleteChunks( + scoped_ptr<std::vector<SBChunkDelete>> chunk_deletes) override; scoped_refptr<SafeBrowsingService> sb_service_; diff --git a/chrome/browser/safe_browsing/download_feedback.cc b/chrome/browser/safe_browsing/download_feedback.cc index dfa248b..27f4008 100644 --- a/chrome/browser/safe_browsing/download_feedback.cc +++ b/chrome/browser/safe_browsing/download_feedback.cc @@ -38,15 +38,15 @@ class DownloadFeedbackImpl : public DownloadFeedback { const base::FilePath& file_path, const std::string& ping_request, const std::string& ping_response); - virtual ~DownloadFeedbackImpl(); + ~DownloadFeedbackImpl() override; - virtual void Start(const base::Closure& finish_callback) override; + void Start(const base::Closure& finish_callback) override; - virtual const std::string& GetPingRequestForTesting() const override { + const std::string& GetPingRequestForTesting() const override { return ping_request_; } - virtual const std::string& GetPingResponseForTesting() const override { + const std::string& GetPingResponseForTesting() const override { return ping_response_; } diff --git a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc index e545b8d..450524f 100644 --- a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc @@ -40,20 +40,18 @@ class FakeDownloadFeedback : public DownloadFeedback { start_called_(false) { } - virtual ~FakeDownloadFeedback() { - deletion_callback_.Run(); - } + ~FakeDownloadFeedback() override { deletion_callback_.Run(); } - virtual void Start(const base::Closure& finish_callback) override { + void Start(const base::Closure& finish_callback) override { start_called_ = true; finish_callback_ = finish_callback; } - virtual const std::string& GetPingRequestForTesting() const override { + const std::string& GetPingRequestForTesting() const override { return ping_request_; } - virtual const std::string& GetPingResponseForTesting() const override { + const std::string& GetPingResponseForTesting() const override { return ping_response_; } @@ -79,9 +77,9 @@ class FakeDownloadFeedback : public DownloadFeedback { class FakeDownloadFeedbackFactory : public DownloadFeedbackFactory { public: - virtual ~FakeDownloadFeedbackFactory() {} + ~FakeDownloadFeedbackFactory() override {} - virtual DownloadFeedback* CreateDownloadFeedback( + DownloadFeedback* CreateDownloadFeedback( net::URLRequestContextGetter* request_context_getter, base::TaskRunner* file_task_runner, const base::FilePath& file_path, diff --git a/chrome/browser/safe_browsing/download_feedback_unittest.cc b/chrome/browser/safe_browsing/download_feedback_unittest.cc index 0fc5d15..fa9113a 100644 --- a/chrome/browser/safe_browsing/download_feedback_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_unittest.cc @@ -29,11 +29,9 @@ class FakeUploader : public TwoPhaseUploader { const base::FilePath& file_path, const ProgressCallback& progress_callback, const FinishCallback& finish_callback); - virtual ~FakeUploader() {} + ~FakeUploader() override {} - virtual void Start() override { - start_called_ = true; - } + void Start() override { start_called_ = true; } scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; scoped_refptr<base::TaskRunner> file_task_runner_; @@ -67,9 +65,9 @@ FakeUploader::FakeUploader( class FakeUploaderFactory : public TwoPhaseUploaderFactory { public: FakeUploaderFactory() : uploader_(NULL) {} - virtual ~FakeUploaderFactory() {} + ~FakeUploaderFactory() override {} - virtual TwoPhaseUploader* CreateTwoPhaseUploader( + TwoPhaseUploader* CreateTwoPhaseUploader( net::URLRequestContextGetter* url_request_context_getter, base::TaskRunner* file_task_runner, const GURL& base_url, diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc index b00646a..3af48ae 100644 --- a/chrome/browser/safe_browsing/download_protection_service.cc +++ b/chrome/browser/safe_browsing/download_protection_service.cc @@ -166,7 +166,7 @@ class DownloadSBClient protected: friend class base::RefCountedThreadSafe<DownloadSBClient>; - virtual ~DownloadSBClient() {} + ~DownloadSBClient() override {} void CheckDone(SBThreatType threat_type) { DownloadProtectionService::DownloadCheckResult result = @@ -236,7 +236,7 @@ class DownloadUrlSBClient : public DownloadSBClient { DOWNLOAD_URL_CHECKS_MALWARE), database_manager_(database_manager) { } - virtual void StartCheck() override { + void StartCheck() override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (!database_manager_.get() || database_manager_->CheckDownloadUrl(url_chain_, this)) { @@ -246,12 +246,12 @@ class DownloadUrlSBClient : public DownloadSBClient { } } - virtual bool IsDangerous(SBThreatType threat_type) const override { + bool IsDangerous(SBThreatType threat_type) const override { return threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL; } - virtual void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, - SBThreatType threat_type) override { + void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, + SBThreatType threat_type) override { CheckDone(threat_type); UMA_HISTOGRAM_TIMES("SB2.DownloadUrlCheckDuration", base::TimeTicks::Now() - start_time_); @@ -259,7 +259,7 @@ class DownloadUrlSBClient : public DownloadSBClient { } protected: - virtual ~DownloadUrlSBClient() {} + ~DownloadUrlSBClient() override {} private: scoped_refptr<SafeBrowsingDatabaseManager> database_manager_; @@ -378,13 +378,13 @@ class DownloadProtectionService::CheckClientDownloadRequest } // content::DownloadItem::Observer implementation. - virtual void OnDownloadDestroyed(content::DownloadItem* download) override { + void OnDownloadDestroyed(content::DownloadItem* download) override { Cancel(); DCHECK(item_ == NULL); } // From the net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override { + void OnURLFetchComplete(const net::URLFetcher* source) override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(source, fetcher_.get()); VLOG(2) << "Received a response for URL: " @@ -479,7 +479,7 @@ class DownloadProtectionService::CheckClientDownloadRequest friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class base::DeleteHelper<CheckClientDownloadRequest>; - virtual ~CheckClientDownloadRequest() { + ~CheckClientDownloadRequest() override { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(item_ == NULL); } diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index 9aed0ae..93324cf 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -90,14 +90,14 @@ class FakeSafeBrowsingService : public SafeBrowsingService { } protected: - virtual ~FakeSafeBrowsingService() { } + ~FakeSafeBrowsingService() override {} - virtual SafeBrowsingDatabaseManager* CreateDatabaseManager() override { + SafeBrowsingDatabaseManager* CreateDatabaseManager() override { mock_database_manager_ = new MockSafeBrowsingDatabaseManager(this); return mock_database_manager_; } - virtual void RegisterAllDelayedAnalysis() override { } + void RegisterAllDelayedAnalysis() override {} private: MockSafeBrowsingDatabaseManager* mock_database_manager_; @@ -131,12 +131,12 @@ class TestURLFetcherWatcher : public net::TestURLFetcherDelegateForTests { } // TestURLFetcherDelegateForTests impl: - virtual void OnRequestStart(int fetcher_id) override { + void OnRequestStart(int fetcher_id) override { fetcher_id_ = fetcher_id; run_loop_.Quit(); } - virtual void OnChunkUpload(int fetcher_id) override {} - virtual void OnRequestEnd(int fetcher_id) override {} + void OnChunkUpload(int fetcher_id) override {} + void OnRequestEnd(int fetcher_id) override {} int WaitForRequest() { run_loop_.Run(); diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.h b/chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.h index 83aadd9..4c75571 100644 --- a/chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.h +++ b/chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.h @@ -34,7 +34,7 @@ class IncidentReportUploaderImpl : public IncidentReportUploader, // The id associated with the URLFetcher, for use by tests. static const int kTestUrlFetcherId; - virtual ~IncidentReportUploaderImpl(); + ~IncidentReportUploaderImpl() override; // Uploads a report with a caller-provided URL context. |callback| will be run // when the upload is complete. Returns NULL if |report| cannot be serialized @@ -54,7 +54,7 @@ class IncidentReportUploaderImpl : public IncidentReportUploader, static GURL GetIncidentReportUrl(); // net::URLFetcherDelegate methods. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; // The underlying URL fetcher. The instance is alive from construction through // OnURLFetchComplete. diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h index 10fb114..9434e66 100644 --- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h +++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h @@ -71,7 +71,7 @@ class IncidentReportingService : public content::NotificationObserver { // All incident collection, data collection, and uploads in progress are // dropped at destruction. - virtual ~IncidentReportingService(); + ~IncidentReportingService() override; // Returns a callback by which external components can add an incident to the // service on behalf of |profile|. The callback may outlive the service, but @@ -233,9 +233,9 @@ class IncidentReportingService : public content::NotificationObserver { scoped_ptr<ClientIncidentResponse> response); // content::NotificationObserver methods. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; base::ThreadChecker thread_checker_; diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc index 9e469c1..ae6c3ce 100644 --- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc @@ -68,25 +68,25 @@ class IncidentReportingServiceTest : public testing::Test { test_instance_.Get().Set(this); } - virtual ~TestIncidentReportingService() { test_instance_.Get().Set(NULL); } + ~TestIncidentReportingService() override { test_instance_.Get().Set(NULL); } bool IsProcessingReport() const { return IncidentReportingService::IsProcessingReport(); } protected: - virtual void OnProfileAdded(Profile* profile) override { + void OnProfileAdded(Profile* profile) override { pre_profile_add_callback_.Run(profile); safe_browsing::IncidentReportingService::OnProfileAdded(profile); } - virtual scoped_ptr<safe_browsing::LastDownloadFinder> CreateDownloadFinder( + scoped_ptr<safe_browsing::LastDownloadFinder> CreateDownloadFinder( const safe_browsing::LastDownloadFinder::LastDownloadCallback& callback) override { return create_download_finder_callback_.Run(callback); } - virtual scoped_ptr<safe_browsing::IncidentReportUploader> StartReportUpload( + scoped_ptr<safe_browsing::IncidentReportUploader> StartReportUpload( const safe_browsing::IncidentReportUploader::OnResultCallback& callback, const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, @@ -315,7 +315,7 @@ class IncidentReportingServiceTest : public testing::Test { FROM_HERE, base::Bind(&FakeUploader::FinishUpload, base::Unretained(this))); } - virtual ~FakeUploader() { on_deleted_.Run(); } + ~FakeUploader() override { on_deleted_.Run(); } private: void FinishUpload() { @@ -346,7 +346,7 @@ class IncidentReportingServiceTest : public testing::Test { new FakeDownloadFinder(on_deleted)); } - virtual ~FakeDownloadFinder() { on_deleted_.Run(); } + ~FakeDownloadFinder() override { on_deleted_.Run(); } private: explicit FakeDownloadFinder(const base::Closure& on_deleted) diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h index 80d9694..233773b 100644 --- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h +++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.h @@ -42,7 +42,7 @@ class LastDownloadFinder : public content::NotificationObserver { typedef base::Callback<void(scoped_ptr<ClientIncidentReport_DownloadDetails>)> LastDownloadCallback; - virtual ~LastDownloadFinder(); + ~LastDownloadFinder() override; // Initiates an asynchronous search for the most recent download. |callback| // will be run when the search is complete. The returned instance can be @@ -89,9 +89,9 @@ class LastDownloadFinder : public content::NotificationObserver { void ReportResults(); // content::NotificationObserver methods. - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; // Caller-supplied callback to be invoked when the most recent download is // found. diff --git a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h index 6addfae..c013993 100644 --- a/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h +++ b/chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h @@ -19,16 +19,16 @@ class PreferenceValidationDelegate public: explicit PreferenceValidationDelegate( const AddIncidentCallback& add_incident); - virtual ~PreferenceValidationDelegate(); + ~PreferenceValidationDelegate() override; private: // TrackedPreferenceValidationDelegate methods. - virtual void OnAtomicPreferenceValidation( + void OnAtomicPreferenceValidation( const std::string& pref_path, const base::Value* value, PrefHashStoreTransaction::ValueState value_state, TrackedPreferenceHelper::ResetAction reset_action) override; - virtual void OnSplitPreferenceValidation( + void OnSplitPreferenceValidation( const std::string& pref_path, const base::DictionaryValue* dict_value, const std::vector<std::string>& invalid_keys, diff --git a/chrome/browser/safe_browsing/local_safebrowsing_test_server.h b/chrome/browser/safe_browsing/local_safebrowsing_test_server.h index 1bdc9a9..7639385 100644 --- a/chrome/browser/safe_browsing/local_safebrowsing_test_server.h +++ b/chrome/browser/safe_browsing/local_safebrowsing_test_server.h @@ -17,17 +17,16 @@ class LocalSafeBrowsingTestServer : public net::LocalTestServer { // Initialize a safebrowsing server using the given |data_file|. explicit LocalSafeBrowsingTestServer(const base::FilePath& data_file); - virtual ~LocalSafeBrowsingTestServer(); + ~LocalSafeBrowsingTestServer() override; - virtual bool SetPythonPath() const override; + bool SetPythonPath() const override; // Returns the path to safe_browsing_testserver.py. - virtual bool GetTestServerPath( - base::FilePath* testserver_path) const override; + bool GetTestServerPath(base::FilePath* testserver_path) const override; protected: // Adds the --data-file switch. Returns true on success. - virtual bool GenerateAdditionalArguments( + bool GenerateAdditionalArguments( base::DictionaryValue* arguments) const override; private: diff --git a/chrome/browser/safe_browsing/local_two_phase_testserver.h b/chrome/browser/safe_browsing/local_two_phase_testserver.h index 1b6bffd..1614521 100644 --- a/chrome/browser/safe_browsing/local_two_phase_testserver.h +++ b/chrome/browser/safe_browsing/local_two_phase_testserver.h @@ -17,11 +17,10 @@ class LocalTwoPhaseTestServer : public net::LocalTestServer { // Initialize a two phase protocol test server. LocalTwoPhaseTestServer(); - virtual ~LocalTwoPhaseTestServer(); + ~LocalTwoPhaseTestServer() override; // Returns the path to two_phase_testserver.py. - virtual bool GetTestServerPath( - base::FilePath* testserver_path) const override; + bool GetTestServerPath(base::FilePath* testserver_path) const override; private: DISALLOW_COPY_AND_ASSIGN(LocalTwoPhaseTestServer); diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index 9db467c..f831a3c 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -35,7 +35,7 @@ MalwareDetailsFactory* MalwareDetails::factory_ = NULL; // don't leak it. class MalwareDetailsFactoryImpl : public MalwareDetailsFactory { public: - virtual MalwareDetails* CreateMalwareDetails( + MalwareDetails* CreateMalwareDetails( SafeBrowsingUIManager* ui_manager, WebContents* web_contents, const SafeBrowsingUIManager::UnsafeResource& unsafe_resource) override { diff --git a/chrome/browser/safe_browsing/malware_details.h b/chrome/browser/safe_browsing/malware_details.h index 059588b..51dff4b 100644 --- a/chrome/browser/safe_browsing/malware_details.h +++ b/chrome/browser/safe_browsing/malware_details.h @@ -70,7 +70,7 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, void OnRedirectionCollectionReady(); // content::WebContentsObserver implementation. - virtual bool OnMessageReceived(const IPC::Message& message) override; + bool OnMessageReceived(const IPC::Message& message) override; protected: friend class MalwareDetailsFactoryImpl; @@ -79,7 +79,7 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, content::WebContents* web_contents, const UnsafeResource& resource); - virtual ~MalwareDetails(); + ~MalwareDetails() override; // Called on the IO thread with the DOM details. virtual void AddDOMDetails( diff --git a/chrome/browser/safe_browsing/malware_details_cache.h b/chrome/browser/safe_browsing/malware_details_cache.h index a6b7397..ec855cf 100644 --- a/chrome/browser/safe_browsing/malware_details_cache.h +++ b/chrome/browser/safe_browsing/malware_details_cache.h @@ -54,12 +54,12 @@ class MalwareDetailsCacheCollector protected: // Implementation of URLFetcher::Delegate. Called after the request // completes (either successfully or with failure). - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; private: friend class base::RefCountedThreadSafe<MalwareDetailsCacheCollector>; - virtual ~MalwareDetailsCacheCollector(); + ~MalwareDetailsCacheCollector() override; // Points to the url for which we are fetching the HTTP cache entry or // redirect chain. diff --git a/chrome/browser/safe_browsing/malware_details_history.h b/chrome/browser/safe_browsing/malware_details_history.h index 3193626..7482cc5 100644 --- a/chrome/browser/safe_browsing/malware_details_history.h +++ b/chrome/browser/safe_browsing/malware_details_history.h @@ -47,16 +47,16 @@ class MalwareDetailsRedirectsCollector const std::vector<safe_browsing::RedirectChain>& GetCollectedUrls() const; // content::NotificationObserver - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; private: friend struct content::BrowserThread::DeleteOnThread< content::BrowserThread::UI>; friend class base::DeleteHelper<MalwareDetailsRedirectsCollector>; - virtual ~MalwareDetailsRedirectsCollector(); + ~MalwareDetailsRedirectsCollector() override; void StartGetRedirects(const std::vector<GURL>& urls); void GetRedirects(const GURL& url); diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc index 3fc2905..390c6b42 100644 --- a/chrome/browser/safe_browsing/malware_details_unittest.cc +++ b/chrome/browser/safe_browsing/malware_details_unittest.cc @@ -136,7 +136,7 @@ class MalwareDetailsWrap : public MalwareDetails { } private: - virtual ~MalwareDetailsWrap() {} + ~MalwareDetailsWrap() override {} }; class MockSafeBrowsingUIManager : public SafeBrowsingUIManager { @@ -147,8 +147,7 @@ class MockSafeBrowsingUIManager : public SafeBrowsingUIManager { : SafeBrowsingUIManager(NULL), run_loop_(NULL) {} // When the MalwareDetails is done, this is called. - virtual void SendSerializedMalwareDetails( - const std::string& serialized) override { + void SendSerializedMalwareDetails(const std::string& serialized) override { DVLOG(1) << "SendSerializedMalwareDetails"; run_loop_->Quit(); run_loop_ = NULL; @@ -169,7 +168,7 @@ class MockSafeBrowsingUIManager : public SafeBrowsingUIManager { } private: - virtual ~MockSafeBrowsingUIManager() {} + ~MockSafeBrowsingUIManager() override {} std::string serialized_; DISALLOW_COPY_AND_ASSIGN(MockSafeBrowsingUIManager); diff --git a/chrome/browser/safe_browsing/ping_manager.h b/chrome/browser/safe_browsing/ping_manager.h index d48cc4f..a33559b 100644 --- a/chrome/browser/safe_browsing/ping_manager.h +++ b/chrome/browser/safe_browsing/ping_manager.h @@ -25,7 +25,7 @@ class URLRequestContextGetter; class SafeBrowsingPingManager : public net::URLFetcherDelegate { public: - virtual ~SafeBrowsingPingManager(); + ~SafeBrowsingPingManager() override; // Create an instance of the safe browsing ping manager. static SafeBrowsingPingManager* Create( @@ -33,7 +33,7 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate { const SafeBrowsingProtocolConfig& config); // net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; // For UMA users we report to Google when a SafeBrowsing interstitial is shown // to the user. |threat_type| should be one of the types known by diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 64dc05b..7a39760 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -73,8 +73,8 @@ static const size_t kSbMaxBackOff = 8; class SBProtocolManagerFactoryImpl : public SBProtocolManagerFactory { public: SBProtocolManagerFactoryImpl() { } - virtual ~SBProtocolManagerFactoryImpl() { } - virtual SafeBrowsingProtocolManager* CreateProtocolManager( + ~SBProtocolManagerFactoryImpl() override {} + SafeBrowsingProtocolManager* CreateProtocolManager( SafeBrowsingProtocolManagerDelegate* delegate, net::URLRequestContextGetter* request_context_getter, const SafeBrowsingProtocolConfig& config) override { diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h index 3eb549a..ae357f8 100644 --- a/chrome/browser/safe_browsing/protocol_manager.h +++ b/chrome/browser/safe_browsing/protocol_manager.h @@ -51,7 +51,7 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, typedef base::Callback<void(const std::vector<SBFullHashResult>&, const base::TimeDelta&)> FullHashCallback; - virtual ~SafeBrowsingProtocolManager(); + ~SafeBrowsingProtocolManager() override; // Makes the passed |factory| the factory used to instantiate // a SafeBrowsingService. Useful for tests. @@ -70,7 +70,7 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, virtual void Initialize(); // net::URLFetcherDelegate interface. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; // Retrieve the full hash for a set of prefixes, and invoke the callback // argument when the results are retrieved. The callback may be invoked diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index ac6b798..1c47c2c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -126,7 +126,7 @@ SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; class SafeBrowsingBlockingPageFactoryImpl : public SafeBrowsingBlockingPageFactory { public: - virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( + SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingUIManager* ui_manager, WebContents* web_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h index 3db2560..09dfe91 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h @@ -65,7 +65,7 @@ class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { typedef std::vector<UnsafeResource> UnsafeResourceList; typedef std::map<content::WebContents*, UnsafeResourceList> UnsafeResourceMap; - virtual ~SafeBrowsingBlockingPage(); + ~SafeBrowsingBlockingPage() override; // Creates a blocking page. Use ShowBlockingPage if you don't need to access // the blocking page directly. @@ -89,12 +89,11 @@ class SafeBrowsingBlockingPage : public content::InterstitialPageDelegate { } // InterstitialPageDelegate method: - virtual std::string GetHTMLContents() override; - virtual void OnProceed() override; - virtual void OnDontProceed() override; - virtual void CommandReceived(const std::string& command) override; - virtual void OverrideRendererPrefs( - content::RendererPreferences* prefs) override; + std::string GetHTMLContents() override; + void OnProceed() override; + void OnDontProceed() override; + void CommandReceived(const std::string& command) override; + void OverrideRendererPrefs(content::RendererPreferences* prefs) override; protected: friend class SafeBrowsingBlockingPageTest; diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 862d8a0..8b3c56a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -61,7 +61,7 @@ class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { // Otherwise it returns false, and "client" is called asynchronously with the // result when it is ready. // Overrides SafeBrowsingDatabaseManager::CheckBrowseUrl. - virtual bool CheckBrowseUrl(const GURL& gurl, Client* client) override { + bool CheckBrowseUrl(const GURL& gurl, Client* client) override { if (badurls[gurl.spec()] == SB_THREAT_TYPE_SAFE) return true; @@ -91,7 +91,7 @@ class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { } private: - virtual ~FakeSafeBrowsingDatabaseManager() {} + ~FakeSafeBrowsingDatabaseManager() override {} base::hash_map<std::string, SBThreatType> badurls; DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); @@ -104,8 +104,7 @@ class FakeSafeBrowsingUIManager : public SafeBrowsingUIManager { SafeBrowsingUIManager(service) { } // Overrides SafeBrowsingUIManager - virtual void SendSerializedMalwareDetails( - const std::string& serialized) override { + void SendSerializedMalwareDetails(const std::string& serialized) override { // Notify the UI thread that we got a report. BrowserThread::PostTask( BrowserThread::UI, @@ -138,7 +137,7 @@ class FakeSafeBrowsingUIManager : public SafeBrowsingUIManager { } protected: - virtual ~FakeSafeBrowsingUIManager() { } + ~FakeSafeBrowsingUIManager() override {} private: std::string report_; @@ -165,14 +164,14 @@ class FakeSafeBrowsingService : public SafeBrowsingService { } protected: - virtual ~FakeSafeBrowsingService() { } + ~FakeSafeBrowsingService() override {} - virtual SafeBrowsingDatabaseManager* CreateDatabaseManager() override { + SafeBrowsingDatabaseManager* CreateDatabaseManager() override { fake_database_manager_ = new FakeSafeBrowsingDatabaseManager(this); return fake_database_manager_; } - virtual SafeBrowsingUIManager* CreateUIManager() override { + SafeBrowsingUIManager* CreateUIManager() override { fake_ui_manager_ = new FakeSafeBrowsingUIManager(this); return fake_ui_manager_; } @@ -189,9 +188,9 @@ class TestSafeBrowsingServiceFactory : public SafeBrowsingServiceFactory { public: TestSafeBrowsingServiceFactory() : most_recent_service_(NULL) { } - virtual ~TestSafeBrowsingServiceFactory() { } + ~TestSafeBrowsingServiceFactory() override {} - virtual SafeBrowsingService* CreateSafeBrowsingService() override { + SafeBrowsingService* CreateSafeBrowsingService() override { most_recent_service_ = new FakeSafeBrowsingService(); return most_recent_service_; } @@ -215,9 +214,9 @@ class FakeMalwareDetails : public MalwareDetails { got_dom_(false), waiting_(false) { } - virtual void AddDOMDetails( + void AddDOMDetails( const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) - override { + override { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); MalwareDetails::AddDOMDetails(params); @@ -239,7 +238,7 @@ class FakeMalwareDetails : public MalwareDetails { } private: - virtual ~FakeMalwareDetails() {} + ~FakeMalwareDetails() override {} void OnDOMDetailsDone() { got_dom_ = true; @@ -257,9 +256,9 @@ class FakeMalwareDetails : public MalwareDetails { class TestMalwareDetailsFactory : public MalwareDetailsFactory { public: TestMalwareDetailsFactory() : details_() { } - virtual ~TestMalwareDetailsFactory() { } + ~TestMalwareDetailsFactory() override {} - virtual MalwareDetails* CreateMalwareDetails( + MalwareDetails* CreateMalwareDetails( SafeBrowsingUIManager* delegate, WebContents* web_contents, const SafeBrowsingUIManager::UnsafeResource& unsafe_resource) override { @@ -288,7 +287,7 @@ class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { malware_details_proceed_delay_ms_ = 100; } - virtual ~TestSafeBrowsingBlockingPage() { + ~TestSafeBrowsingBlockingPage() override { if (!wait_for_delete_) return; @@ -303,15 +302,11 @@ class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { } // InterstitialPageDelegate methods: - virtual void CommandReceived(const std::string& command) override { + void CommandReceived(const std::string& command) override { SafeBrowsingBlockingPage::CommandReceived(command); } - virtual void OnProceed() override { - SafeBrowsingBlockingPage::OnProceed(); - } - virtual void OnDontProceed() override { - SafeBrowsingBlockingPage::OnDontProceed(); - } + void OnProceed() override { SafeBrowsingBlockingPage::OnProceed(); } + void OnDontProceed() override { SafeBrowsingBlockingPage::OnDontProceed(); } private: bool wait_for_delete_; @@ -321,13 +316,13 @@ class TestSafeBrowsingBlockingPageFactory : public SafeBrowsingBlockingPageFactory { public: TestSafeBrowsingBlockingPageFactory() { } - virtual ~TestSafeBrowsingBlockingPageFactory() { } + ~TestSafeBrowsingBlockingPageFactory() override {} - virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( + SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingUIManager* delegate, WebContents* web_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) - override { + override { return new TestSafeBrowsingBlockingPage(delegate, web_contents, unsafe_resources); } @@ -363,7 +358,7 @@ class SafeBrowsingBlockingPageBrowserTest MalwareDetails::RegisterFactory(NULL); } - virtual void SetUpInProcessBrowserTestFixture() override { + void SetUpInProcessBrowserTestFixture() override { ASSERT_TRUE(test_server()->Start()); } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 6656837..700183d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -51,8 +51,7 @@ class TestSafeBrowsingUIManager: public SafeBrowsingUIManager { : SafeBrowsingUIManager(service) { } - virtual void SendSerializedMalwareDetails( - const std::string& serialized) override { + void SendSerializedMalwareDetails(const std::string& serialized) override { details_.push_back(serialized); } @@ -61,7 +60,7 @@ class TestSafeBrowsingUIManager: public SafeBrowsingUIManager { } private: - virtual ~TestSafeBrowsingUIManager() {} + ~TestSafeBrowsingUIManager() override {} std::list<std::string> details_; }; @@ -70,9 +69,9 @@ class TestSafeBrowsingBlockingPageFactory : public SafeBrowsingBlockingPageFactory { public: TestSafeBrowsingBlockingPageFactory() { } - virtual ~TestSafeBrowsingBlockingPageFactory() { } + ~TestSafeBrowsingBlockingPageFactory() override {} - virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( + SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingUIManager* manager, WebContents* web_contents, const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index c95a508..dea4b3c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -313,7 +313,7 @@ bool GetCachedFullHash(std::map<SBPrefix, SBCachedFullHashResult>* cache, // The default SafeBrowsingDatabaseFactory. class SafeBrowsingDatabaseFactoryImpl : public SafeBrowsingDatabaseFactory { public: - virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( + SafeBrowsingDatabase* CreateSafeBrowsingDatabase( bool enable_download_protection, bool enable_client_side_whitelist, bool enable_download_whitelist, diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index 17aad1d..3e2ca8d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -287,42 +287,37 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { // useds Sqlite. SafeBrowsingDatabaseNew(); - virtual ~SafeBrowsingDatabaseNew(); + ~SafeBrowsingDatabaseNew() override; // Implement SafeBrowsingDatabase interface. - virtual void Init(const base::FilePath& filename) override; - virtual bool ResetDatabase() override; - virtual bool ContainsBrowseUrl( - const GURL& url, - std::vector<SBPrefix>* prefix_hits, - std::vector<SBFullHashResult>* cache_hits) override; - virtual bool ContainsDownloadUrl(const std::vector<GURL>& urls, - std::vector<SBPrefix>* prefix_hits) override; - virtual bool ContainsCsdWhitelistedUrl(const GURL& url) override; - virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) override; - virtual bool ContainsDownloadWhitelistedString( - const std::string& str) override; - virtual bool ContainsExtensionPrefixes( - const std::vector<SBPrefix>& prefixes, - std::vector<SBPrefix>* prefix_hits) override; - virtual bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override; - virtual bool ContainsMalwareIP(const std::string& ip_address) override; - virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override; - virtual void InsertChunks(const std::string& list_name, - const std::vector<SBChunkData*>& chunks) override; - virtual void DeleteChunks( - const std::vector<SBChunkDelete>& chunk_deletes) override; - virtual void UpdateFinished(bool update_succeeded) override; - virtual void CacheHashResults( - const std::vector<SBPrefix>& prefixes, - const std::vector<SBFullHashResult>& full_hits, - const base::TimeDelta& cache_lifetime) override; + void Init(const base::FilePath& filename) override; + bool ResetDatabase() override; + bool ContainsBrowseUrl(const GURL& url, + std::vector<SBPrefix>* prefix_hits, + std::vector<SBFullHashResult>* cache_hits) override; + bool ContainsDownloadUrl(const std::vector<GURL>& urls, + std::vector<SBPrefix>* prefix_hits) override; + bool ContainsCsdWhitelistedUrl(const GURL& url) override; + bool ContainsDownloadWhitelistedUrl(const GURL& url) override; + bool ContainsDownloadWhitelistedString(const std::string& str) override; + bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, + std::vector<SBPrefix>* prefix_hits) override; + bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override; + bool ContainsMalwareIP(const std::string& ip_address) override; + bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override; + void InsertChunks(const std::string& list_name, + const std::vector<SBChunkData*>& chunks) override; + void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override; + void UpdateFinished(bool update_succeeded) override; + void CacheHashResults(const std::vector<SBPrefix>& prefixes, + const std::vector<SBFullHashResult>& full_hits, + const base::TimeDelta& cache_lifetime) override; // Returns the value of malware_kill_switch_; - virtual bool IsMalwareIPMatchKillSwitchOn() override; + bool IsMalwareIPMatchKillSwitchOn() override; // Returns true if the CSD whitelist has everything whitelisted. - virtual bool IsCsdWhitelistKillSwitchOn() override; + bool IsCsdWhitelistKillSwitchOn() override; private: friend class SafeBrowsingDatabaseTest; diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index a232dc7..f100f9b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -108,12 +108,12 @@ class SafeBrowsingURLRequestContextGetter SafeBrowsingService* sb_service_); // Implementation for net::UrlRequestContextGetter. - virtual net::URLRequestContext* GetURLRequestContext() override; - virtual scoped_refptr<base::SingleThreadTaskRunner> - GetNetworkTaskRunner() const override; + net::URLRequestContext* GetURLRequestContext() override; + scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() + const override; protected: - virtual ~SafeBrowsingURLRequestContextGetter(); + ~SafeBrowsingURLRequestContextGetter() override; private: SafeBrowsingService* const sb_service_; // Owned by BrowserProcess. @@ -151,7 +151,7 @@ SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL; // don't leak it. class SafeBrowsingServiceFactoryImpl : public SafeBrowsingServiceFactory { public: - virtual SafeBrowsingService* CreateSafeBrowsingService() override { + SafeBrowsingService* CreateSafeBrowsingService() override { return new SafeBrowsingService(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 60eea7e..51595489 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -135,7 +135,7 @@ class SafeBrowsingService // Creates the safe browsing service. Need to initialize before using. SafeBrowsingService(); - virtual ~SafeBrowsingService(); + ~SafeBrowsingService() override; virtual SafeBrowsingDatabaseManager* CreateDatabaseManager(); @@ -181,9 +181,9 @@ class SafeBrowsingService void Stop(bool shutdown); // content::NotificationObserver override - virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) override; + void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) override; // Starts following the safe browsing preference on |pref_service|. void AddPrefService(PrefService* pref_service); diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 1d906dd..cdb03bb 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -71,7 +71,7 @@ class FakeSafeBrowsingService : public SafeBrowsingService { explicit FakeSafeBrowsingService(const std::string& url_prefix) : url_prefix_(url_prefix) {} - virtual SafeBrowsingProtocolConfig GetProtocolConfig() const override { + SafeBrowsingProtocolConfig GetProtocolConfig() const override { SafeBrowsingProtocolConfig config; config.url_prefix = url_prefix_; // Makes sure the auto update is not triggered. The tests will force the @@ -85,7 +85,7 @@ class FakeSafeBrowsingService : public SafeBrowsingService { } private: - virtual ~FakeSafeBrowsingService() {} + ~FakeSafeBrowsingService() override {} std::string url_prefix_; @@ -98,7 +98,7 @@ class TestSafeBrowsingServiceFactory : public SafeBrowsingServiceFactory { explicit TestSafeBrowsingServiceFactory(const std::string& url_prefix) : url_prefix_(url_prefix) {} - virtual SafeBrowsingService* CreateSafeBrowsingService() override { + SafeBrowsingService* CreateSafeBrowsingService() override { return new FakeSafeBrowsingService(url_prefix_); } @@ -111,13 +111,13 @@ class TestSafeBrowsingDatabase : public SafeBrowsingDatabase { public: TestSafeBrowsingDatabase() {} - virtual ~TestSafeBrowsingDatabase() {} + ~TestSafeBrowsingDatabase() override {} // Initializes the database with the given filename. - virtual void Init(const base::FilePath& filename) override {} + void Init(const base::FilePath& filename) override {} // Deletes the current database and creates a new one. - virtual bool ResetDatabase() override { + bool ResetDatabase() override { badurls_.clear(); return true; } @@ -125,19 +125,17 @@ class TestSafeBrowsingDatabase : public SafeBrowsingDatabase { // Called on the IO thread to check if the given URL is safe or not. If we // can synchronously determine that the URL is safe, CheckUrl returns true, // otherwise it returns false. - virtual bool ContainsBrowseUrl( - const GURL& url, - std::vector<SBPrefix>* prefix_hits, - std::vector<SBFullHashResult>* cache_hits) override { + bool ContainsBrowseUrl(const GURL& url, + std::vector<SBPrefix>* prefix_hits, + std::vector<SBFullHashResult>* cache_hits) override { cache_hits->clear(); return ContainsUrl(safe_browsing_util::MALWARE, safe_browsing_util::PHISH, std::vector<GURL>(1, url), prefix_hits); } - virtual bool ContainsDownloadUrl( - const std::vector<GURL>& urls, - std::vector<SBPrefix>* prefix_hits) override { + bool ContainsDownloadUrl(const std::vector<GURL>& urls, + std::vector<SBPrefix>* prefix_hits) override { bool found = ContainsUrl(safe_browsing_util::BINURL, safe_browsing_util::BINURL, urls, @@ -147,55 +145,42 @@ class TestSafeBrowsingDatabase : public SafeBrowsingDatabase { DCHECK_LE(1U, prefix_hits->size()); return true; } - virtual bool ContainsCsdWhitelistedUrl(const GURL& url) override { + bool ContainsCsdWhitelistedUrl(const GURL& url) override { return true; } + bool ContainsDownloadWhitelistedString(const std::string& str) override { return true; } - virtual bool ContainsDownloadWhitelistedString( - const std::string& str) override { + bool ContainsDownloadWhitelistedUrl(const GURL& url) override { return true; } + bool ContainsExtensionPrefixes(const std::vector<SBPrefix>& prefixes, + std::vector<SBPrefix>* prefix_hits) override { return true; } - virtual bool ContainsDownloadWhitelistedUrl(const GURL& url) override { + bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override { return true; } - virtual bool ContainsExtensionPrefixes( - const std::vector<SBPrefix>& prefixes, - std::vector<SBPrefix>* prefix_hits) override { + bool ContainsMalwareIP(const std::string& ip_address) override { return true; } - virtual bool ContainsSideEffectFreeWhitelistUrl(const GURL& url) override { - return true; - } - virtual bool ContainsMalwareIP(const std::string& ip_address) override { - return true; - } - virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { + bool UpdateStarted(std::vector<SBListChunkRanges>* lists) override { ADD_FAILURE() << "Not implemented."; return false; } - virtual void InsertChunks( - const std::string& list_name, - const std::vector<SBChunkData*>& chunks) override { + void InsertChunks(const std::string& list_name, + const std::vector<SBChunkData*>& chunks) override { ADD_FAILURE() << "Not implemented."; } - virtual void DeleteChunks( - const std::vector<SBChunkDelete>& chunk_deletes) override { + void DeleteChunks(const std::vector<SBChunkDelete>& chunk_deletes) override { ADD_FAILURE() << "Not implemented."; } - virtual void UpdateFinished(bool update_succeeded) override { + void UpdateFinished(bool update_succeeded) override { ADD_FAILURE() << "Not implemented."; } - virtual void CacheHashResults( - const std::vector<SBPrefix>& prefixes, - const std::vector<SBFullHashResult>& cache_hits, - const base::TimeDelta& cache_lifetime) override { + void CacheHashResults(const std::vector<SBPrefix>& prefixes, + const std::vector<SBFullHashResult>& cache_hits, + const base::TimeDelta& cache_lifetime) override { // Do nothing for the cache. } - virtual bool IsMalwareIPMatchKillSwitchOn() override { - return false; - } - virtual bool IsCsdWhitelistKillSwitchOn() override { - return false; - } + bool IsMalwareIPMatchKillSwitchOn() override { return false; } + bool IsCsdWhitelistKillSwitchOn() override { return false; } // Fill up the database with test URL. void AddUrl(const GURL& url, @@ -248,9 +233,9 @@ class TestSafeBrowsingDatabase : public SafeBrowsingDatabase { class TestSafeBrowsingDatabaseFactory : public SafeBrowsingDatabaseFactory { public: TestSafeBrowsingDatabaseFactory() : db_(NULL) {} - virtual ~TestSafeBrowsingDatabaseFactory() {} + ~TestSafeBrowsingDatabaseFactory() override {} - virtual SafeBrowsingDatabase* CreateSafeBrowsingDatabase( + SafeBrowsingDatabase* CreateSafeBrowsingDatabase( bool enable_download_protection, bool enable_client_side_whitelist, bool enable_download_whitelist, @@ -279,19 +264,16 @@ class TestProtocolManager : public SafeBrowsingProtocolManager { create_count_++; } - virtual ~TestProtocolManager() { - delete_count_++; - } + ~TestProtocolManager() override { delete_count_++; } // This function is called when there is a prefix hit in local safebrowsing // database and safebrowsing service issues a get hash request to backends. // We return a result from the prefilled full_hashes_ hash_map to simulate // server's response. At the same time, latency is added to simulate real // life network issues. - virtual void GetFullHash( - const std::vector<SBPrefix>& prefixes, - SafeBrowsingProtocolManager::FullHashCallback callback, - bool is_download) override { + void GetFullHash(const std::vector<SBPrefix>& prefixes, + SafeBrowsingProtocolManager::FullHashCallback callback, + bool is_download) override { BrowserThread::PostDelayedTask( BrowserThread::IO, FROM_HERE, base::Bind(InvokeFullHashCallback, callback, full_hashes_), @@ -332,9 +314,9 @@ int TestProtocolManager::delete_count_ = 0; class TestSBProtocolManagerFactory : public SBProtocolManagerFactory { public: TestSBProtocolManagerFactory() : pm_(NULL) {} - virtual ~TestSBProtocolManagerFactory() {} + ~TestSBProtocolManagerFactory() override {} - virtual SafeBrowsingProtocolManager* CreateProtocolManager( + SafeBrowsingProtocolManager* CreateProtocolManager( SafeBrowsingProtocolManagerDelegate* delegate, net::URLRequestContextGetter* request_context_getter, const SafeBrowsingProtocolConfig& config) override { @@ -514,13 +496,13 @@ class SafeBrowsingServiceMetadataTest public: SafeBrowsingServiceMetadataTest() {} - virtual void SetUpOnMainThread() override { + void SetUpOnMainThread() override { SafeBrowsingServiceTest::SetUpOnMainThread(); g_browser_process->safe_browsing_service()->ui_manager()->AddObserver( &observer_); } - virtual void TearDownOnMainThread() override { + void TearDownOnMainThread() override { g_browser_process->safe_browsing_service()->ui_manager()->RemoveObserver( &observer_); SafeBrowsingServiceTest::TearDownOnMainThread(); @@ -744,7 +726,7 @@ class TestSBClient private: friend class base::RefCountedThreadSafe<TestSBClient>; - virtual ~TestSBClient() {} + ~TestSBClient() override {} void CheckDownloadUrlOnIOThread(const std::vector<GURL>& url_chain) { safe_browsing_service_->database_manager()-> @@ -752,8 +734,8 @@ class TestSBClient } // Called when the result of checking a download URL is known. - virtual void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, - SBThreatType threat_type) override { + void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain, + SBThreatType threat_type) override { threat_type_ = threat_type; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&TestSBClient::DownloadCheckDone, this)); @@ -1013,7 +995,7 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { SafeBrowsingService::RegisterFactory(NULL); } - virtual bool SetUpUserDataDirectory() override { + bool SetUpUserDataDirectory() override { base::FilePath cookie_path( SafeBrowsingService::GetCookieFilePathForTesting()); EXPECT_FALSE(base::PathExists(cookie_path)); @@ -1059,7 +1041,7 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { return InProcessBrowserTest::SetUpUserDataDirectory(); } - virtual void TearDownInProcessBrowserTestFixture() override { + void TearDownInProcessBrowserTestFixture() override { InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); sql::Connection db; @@ -1080,14 +1062,12 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { EXPECT_FALSE(smt.Step()); } - virtual void SetUpOnMainThread() override { + void SetUpOnMainThread() override { sb_service_ = g_browser_process->safe_browsing_service(); ASSERT_TRUE(sb_service_.get() != NULL); } - virtual void TearDownOnMainThread() override { - sb_service_ = NULL; - } + void TearDownOnMainThread() override { sb_service_ = NULL; } void ForceUpdate() { sb_service_->protocol_manager()->ForceScheduleNextUpdate( diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h index b8d324a..7497c9b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h @@ -125,50 +125,50 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { public: SafeBrowsingStoreFile(); - virtual ~SafeBrowsingStoreFile(); + ~SafeBrowsingStoreFile() override; - virtual void Init(const base::FilePath& filename, - const base::Closure& corruption_callback) override; + void Init(const base::FilePath& filename, + const base::Closure& corruption_callback) override; // Delete any on-disk files, including the permanent storage. - virtual bool Delete() override; + bool Delete() override; // Get all add hash prefixes and full-length hashes, respectively, from // the store. - virtual bool GetAddPrefixes(SBAddPrefixes* add_prefixes) override; - virtual bool GetAddFullHashes( - std::vector<SBAddFullHash>* add_full_hashes) override; - - virtual bool BeginChunk() override; - - virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) override; - virtual bool WriteAddHash(int32 chunk_id, - const SBFullHash& full_hash) override; - virtual bool WriteSubPrefix(int32 chunk_id, - int32 add_chunk_id, SBPrefix prefix) override; - virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, - const SBFullHash& full_hash) override; - virtual bool FinishChunk() override; - - virtual bool BeginUpdate() override; - virtual bool FinishUpdate( + bool GetAddPrefixes(SBAddPrefixes* add_prefixes) override; + bool GetAddFullHashes(std::vector<SBAddFullHash>* add_full_hashes) override; + + bool BeginChunk() override; + + bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) override; + bool WriteAddHash(int32 chunk_id, const SBFullHash& full_hash) override; + bool WriteSubPrefix(int32 chunk_id, + int32 add_chunk_id, + SBPrefix prefix) override; + bool WriteSubHash(int32 chunk_id, + int32 add_chunk_id, + const SBFullHash& full_hash) override; + bool FinishChunk() override; + + bool BeginUpdate() override; + bool FinishUpdate( safe_browsing::PrefixSetBuilder* builder, std::vector<SBAddFullHash>* add_full_hashes_result) override; - virtual bool CancelUpdate() override; + bool CancelUpdate() override; - virtual void SetAddChunk(int32 chunk_id) override; - virtual bool CheckAddChunk(int32 chunk_id) override; - virtual void GetAddChunks(std::vector<int32>* out) override; - virtual void SetSubChunk(int32 chunk_id) override; - virtual bool CheckSubChunk(int32 chunk_id) override; - virtual void GetSubChunks(std::vector<int32>* out) override; + void SetAddChunk(int32 chunk_id) override; + bool CheckAddChunk(int32 chunk_id) override; + void GetAddChunks(std::vector<int32>* out) override; + void SetSubChunk(int32 chunk_id) override; + bool CheckSubChunk(int32 chunk_id) override; + void GetSubChunks(std::vector<int32>* out) override; - virtual void DeleteAddChunk(int32 chunk_id) override; - virtual void DeleteSubChunk(int32 chunk_id) override; + void DeleteAddChunk(int32 chunk_id) override; + void DeleteSubChunk(int32 chunk_id) override; // Verify |file_|'s checksum, calling the corruption callback if it // does not check out. Empty input is considered valid. - virtual bool CheckValidity() override; + bool CheckValidity() override; // Returns the name of the temporary file used to buffer data for // |filename|. Exported for unit tests. diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h index b168540..c7201d9 100644 --- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.h +++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.h @@ -21,7 +21,7 @@ class ClientSideDetectionHost; class SafeBrowsingTabObserver : public content::WebContentsUserData<SafeBrowsingTabObserver> { public: - virtual ~SafeBrowsingTabObserver(); + ~SafeBrowsingTabObserver() override; // Forwards to detection host is client-side detection is enabled. bool DidPageReceiveSafeBrowsingMatch() const; diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 21f6ec2..273a086 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -112,7 +112,7 @@ class FakeSafeBrowsingService : public SafeBrowsingService { explicit FakeSafeBrowsingService(const std::string& url_prefix) : url_prefix_(url_prefix) {} - virtual SafeBrowsingProtocolConfig GetProtocolConfig() const override { + SafeBrowsingProtocolConfig GetProtocolConfig() const override { SafeBrowsingProtocolConfig config; config.url_prefix = url_prefix_; // Makes sure the auto update is not triggered. The tests will force the @@ -126,7 +126,7 @@ class FakeSafeBrowsingService : public SafeBrowsingService { } private: - virtual ~FakeSafeBrowsingService() {} + ~FakeSafeBrowsingService() override {} std::string url_prefix_; @@ -139,7 +139,7 @@ class TestSafeBrowsingServiceFactory : public SafeBrowsingServiceFactory { explicit TestSafeBrowsingServiceFactory(const std::string& url_prefix) : url_prefix_(url_prefix) {} - virtual SafeBrowsingService* CreateSafeBrowsingService() override { + SafeBrowsingService* CreateSafeBrowsingService() override { return new FakeSafeBrowsingService(url_prefix_); } @@ -281,7 +281,7 @@ class SafeBrowsingServerTest : public InProcessBrowserTest { SafeBrowsingService::RegisterFactory(NULL); } - virtual void SetUpCommandLine(CommandLine* command_line) override { + void SetUpCommandLine(CommandLine* command_line) override { // This test uses loopback. No need to use IPv6 especially it makes // local requests slow on Windows trybot when ipv6 local address [::1] // is not setup. @@ -349,9 +349,9 @@ class SafeBrowsingServerTestHelper } // Callbacks for SafeBrowsingDatabaseManager::Client. - virtual void OnCheckBrowseUrlResult(const GURL& url, - SBThreatType threat_type, - const std::string& metadata) override { + void OnCheckBrowseUrlResult(const GURL& url, + SBThreatType threat_type, + const std::string& metadata) override { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); EXPECT_TRUE(safe_browsing_test_->is_checked_url_in_db()); safe_browsing_test_->set_is_checked_url_safe( @@ -453,7 +453,7 @@ class SafeBrowsingServerTestHelper } // Callback for URLFetcher. - virtual void OnURLFetchComplete(const net::URLFetcher* source) override { + void OnURLFetchComplete(const net::URLFetcher* source) override { source->GetResponseAsString(&response_data_); response_status_ = source->GetStatus().status(); StopUILoop(); @@ -465,7 +465,7 @@ class SafeBrowsingServerTestHelper private: friend class base::RefCountedThreadSafe<SafeBrowsingServerTestHelper>; - virtual ~SafeBrowsingServerTestHelper() {} + ~SafeBrowsingServerTestHelper() override {} // Stops UI loop after desired status is updated. void StopUILoop() { diff --git a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h index e1cdfd7..7075b45 100644 --- a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h +++ b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h @@ -40,7 +40,7 @@ class SandboxedZipAnalyzer : public content::UtilityProcessHostClient { void Start(); private: - virtual ~SandboxedZipAnalyzer(); + ~SandboxedZipAnalyzer() override; // Creates the sandboxed utility process and tells it to start analysis. // Runs on a worker thread. @@ -48,7 +48,7 @@ class SandboxedZipAnalyzer : public content::UtilityProcessHostClient { // content::UtilityProcessHostClient implementation. // These notifications run on the IO thread. - virtual bool OnMessageReceived(const IPC::Message& message) override; + bool OnMessageReceived(const IPC::Message& message) override; // Notification that the utility process is running, and we can now get its // process handle. diff --git a/chrome/browser/safe_browsing/two_phase_uploader.cc b/chrome/browser/safe_browsing/two_phase_uploader.cc index bbc404f..ac79e41 100644 --- a/chrome/browser/safe_browsing/two_phase_uploader.cc +++ b/chrome/browser/safe_browsing/two_phase_uploader.cc @@ -33,16 +33,16 @@ class TwoPhaseUploaderImpl : public net::URLFetcherDelegate, const base::FilePath& file_path, const ProgressCallback& progress_callback, const FinishCallback& finish_callback); - virtual ~TwoPhaseUploaderImpl(); + ~TwoPhaseUploaderImpl() override; // Begins the upload process. - virtual void Start() override; + void Start() override; // net::URLFetcherDelegate implementation: - virtual void OnURLFetchComplete(const net::URLFetcher* source) override; - virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, - int64 current, - int64 total) override; + void OnURLFetchComplete(const net::URLFetcher* source) override; + void OnURLFetchUploadProgress(const net::URLFetcher* source, + int64 current, + int64 total) override; private: void UploadMetadata(); |