Index: components/safe_browsing/base_ping_manager.h |
diff --git a/chrome/browser/safe_browsing/ping_manager.h b/components/safe_browsing/base_ping_manager.h |
similarity index 50% |
copy from chrome/browser/safe_browsing/ping_manager.h |
copy to components/safe_browsing/base_ping_manager.h |
index 676fedf5f96b0dc1a8caac08f9752dd9b88f6da4..562ab7109d743e1946b3b9b6025548ef69ed5d09 100644 |
--- a/chrome/browser/safe_browsing/ping_manager.h |
+++ b/components/safe_browsing/base_ping_manager.h |
@@ -1,11 +1,11 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
-#define CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
+#ifndef COMPONENTS_SAFE_BROWSING_BASE_PING_MANAGER_H_ |
+#define COMPONENTS_SAFE_BROWSING_BASE_PING_MANAGER_H_ |
-// A class that reports safebrowsing statistics to Google's SafeBrowsing |
+// A class that reports basic safebrowsing statistics to Google's SafeBrowsing |
// servers. |
#include <memory> |
#include <set> |
@@ -14,33 +14,26 @@ |
#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 "base/memory/ref_counted.h" |
#include "components/safe_browsing_db/hit_report.h" |
#include "components/safe_browsing_db/util.h" |
+#include "content/public/browser/permission_type.h" |
#include "net/log/net_log_with_source.h" |
#include "net/url_request/url_fetcher_delegate.h" |
#include "url/gurl.h" |
-class Profile; |
-class SkBitmap; |
- |
namespace net { |
class URLRequestContextGetter; |
} // namespace net |
namespace safe_browsing { |
-class NotificationImageReporter; |
-class PermissionReporter; |
-class SafeBrowsingDatabaseManager; |
- |
-class SafeBrowsingPingManager : public net::URLFetcherDelegate { |
+class BasePingManager : public net::URLFetcherDelegate { |
public: |
- ~SafeBrowsingPingManager() override; |
+ ~BasePingManager() override; |
// Create an instance of the safe browsing ping manager. |
- static std::unique_ptr<SafeBrowsingPingManager> Create( |
+ static std::unique_ptr<BasePingManager> Create( |
net::URLRequestContextGetter* request_context_getter, |
const SafeBrowsingProtocolConfig& config); |
@@ -56,38 +49,21 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate { |
// 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); |
- |
- // Report notification content image to SafeBrowsing CSD server if necessary. |
- void ReportNotificationImage( |
- Profile* profile, |
- const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, |
- const GURL& origin, |
- const SkBitmap& image); |
+ protected: |
+ friend class BasePingManagerTest; |
+ // Constructs a BasePingManager that issues network requests |
+ // using |request_context_getter|. |
+ BasePingManager(net::URLRequestContextGetter* request_context_getter, |
+ const SafeBrowsingProtocolConfig& config); |
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); |
+ FRIEND_TEST_ALL_PREFIXES(BasePingManagerTest, TestSafeBrowsingHitUrl); |
+ FRIEND_TEST_ALL_PREFIXES(BasePingManagerTest, TestThreatDetailsUrl); |
+ FRIEND_TEST_ALL_PREFIXES(BasePingManagerTest, TestReportThreatDetails); |
+ FRIEND_TEST_ALL_PREFIXES(BasePingManagerTest, TestReportSafeBrowsingHit); |
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; |
@@ -111,17 +87,11 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate { |
// 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); |
+ DISALLOW_COPY_AND_ASSIGN(BasePingManager); |
}; |
} // namespace safe_browsing |
-#endif // CHROME_BROWSER_SAFE_BROWSING_PING_MANAGER_H_ |
+#endif // COMPONENTS_SAFE_BROWSING_BASE_PING_MANAGER_H_ |