Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: chrome/browser/safe_browsing/ping_manager.h

Issue 2650973005: Componentize ping_manager (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/blacklist_state_fetcher.cc ('k') | chrome/browser/safe_browsing/ping_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/ping_manager.h
diff --git a/chrome/browser/safe_browsing/ping_manager.h b/chrome/browser/safe_browsing/ping_manager.h
index 676fedf5f96b0dc1a8caac08f9752dd9b88f6da4..e6e0c42990a1af4ede3f846fccbbb323ef84a68c 100644
--- a/chrome/browser/safe_browsing/ping_manager.h
+++ b/chrome/browser/safe_browsing/ping_manager.h
@@ -5,24 +5,10 @@
#ifndef CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
#define CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_
-// A class that reports safebrowsing statistics to Google's SafeBrowsing
-// servers.
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/gtest_prod_util.h"
-#include "base/macros.h"
#include "chrome/browser/permissions/permission_uma_util.h"
-#include "chrome/browser/safe_browsing/protocol_manager_helper.h"
-#include "components/safe_browsing_db/hit_report.h"
-#include "components/safe_browsing_db/util.h"
-#include "net/log/net_log_with_source.h"
-#include "net/url_request/url_fetcher_delegate.h"
-#include "url/gurl.h"
-
-class Profile;
+#include "components/safe_browsing/base_ping_manager.h"
+#include "content/public/browser/permission_type.h"
+
class SkBitmap;
namespace net {
@@ -35,7 +21,7 @@ class NotificationImageReporter;
class PermissionReporter;
class SafeBrowsingDatabaseManager;
-class SafeBrowsingPingManager : public net::URLFetcherDelegate {
+class SafeBrowsingPingManager : public BasePingManager {
public:
~SafeBrowsingPingManager() override;
@@ -44,18 +30,6 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate {
net::URLRequestContextGetter* request_context_getter,
const SafeBrowsingProtocolConfig& config);
- // net::URLFetcherDelegate interface.
- void OnURLFetchComplete(const net::URLFetcher* source) override;
-
- // Report to Google when a SafeBrowsing warning is shown to the user.
- // |hit_report.threat_type| should be one of the types known by
- // SafeBrowsingtHitUrl.
- void ReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report);
-
- // Users can opt-in on the SafeBrowsing interstitial to send detailed
- // threat reports. |report| is the serialized report.
- void ReportThreatDetails(const std::string& report);
-
// Report permission action to SafeBrowsing servers.
void ReportPermissionAction(const PermissionReportInfo& report_info);
@@ -69,56 +43,21 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate {
private:
friend class NotificationImageReporterTest;
friend class PermissionReporterBrowserTest;
- friend class SafeBrowsingPingManagerTest;
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
- TestSafeBrowsingHitUrl);
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, TestThreatDetailsUrl);
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
- TestReportThreatDetails);
- FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest,
- TestReportSafeBrowsingHit);
FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerCertReportingTest,
UMAOnFailure);
- typedef std::set<std::unique_ptr<net::URLFetcher>> Reports;
-
// Constructs a SafeBrowsingPingManager that issues network requests
// using |request_context_getter|.
SafeBrowsingPingManager(
net::URLRequestContextGetter* request_context_getter,
const SafeBrowsingProtocolConfig& config);
- // Generates URL for reporting safe browsing hits.
- GURL SafeBrowsingHitUrl(const safe_browsing::HitReport& hit_report) const;
-
- // Generates URL for reporting threat details for users who opt-in.
- GURL ThreatDetailsUrl() const;
-
- // Current product version sent in each request.
- std::string version_;
-
- // The safe browsing client name sent in each request.
- std::string client_name_;
-
- // The context we use to issue network requests.
- scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
-
- // URL prefix where browser reports hits to the safebrowsing list and
- // sends detaild threat reports for UMA users.
- std::string url_prefix_;
-
- // Track outstanding SafeBrowsing report fetchers for clean up.
- // We add both "hit" and "detail" fetchers in this set.
- Reports safebrowsing_reports_;
-
// Sends reports of permission actions.
std::unique_ptr<PermissionReporter> permission_reporter_;
// Sends reports of notification content images.
std::unique_ptr<NotificationImageReporter> notification_image_reporter_;
- net::NetLogWithSource net_log_;
-
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager);
};
« no previous file with comments | « chrome/browser/extensions/blacklist_state_fetcher.cc ('k') | chrome/browser/safe_browsing/ping_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698