#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/sequenced_task_runner_helpers.h"
+#include "chrome/browser/safe_browsing/incident_reporting/delayed_analysis_callback.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
class PrefChangeRegistrar;
class PrefService;
+class Profile;
struct SafeBrowsingProtocolConfig;
class SafeBrowsingDatabaseManager;
class SafeBrowsingPingManager;
class SafeBrowsingServiceFactory;
class SafeBrowsingUIManager;
class SafeBrowsingURLRequestContextGetter;
+class TrackedPreferenceValidationDelegate;
namespace base {
class Thread;
namespace safe_browsing {
class ClientSideDetectionService;
class DownloadProtectionService;
+class IncidentReportingService;
}
// Construction needs to happen on the main thread.
// Create an instance of the safe browsing service.
static SafeBrowsingService* CreateSafeBrowsingService();
+#if defined(OS_ANDROID) && defined(FULL_SAFE_BROWSING)
+ // Return whether the user is in mobile safe browsing
+ // field trial enabled group.
+ static bool IsEnabledByFieldTrial();
+#endif
+
// Called on the UI thread to initialize the service.
void Initialize();
bool DownloadBinHashNeeded() const;
// Create a protocol config struct.
- SafeBrowsingProtocolConfig GetProtocolConfig() const;
+ virtual SafeBrowsingProtocolConfig GetProtocolConfig() const;
bool enabled() const { return enabled_; }
SafeBrowsingPingManager* ping_manager() const;
+ // Returns a preference validation delegate that adds incidents to the
+ // incident reporting service for validation failures. Returns NULL if the
+ // service is not applicable for the given profile.
+ scoped_ptr<TrackedPreferenceValidationDelegate>
+ CreatePreferenceValidationDelegate(Profile* profile) const;
+
+ // Registers |callback| to be run after some delay following process launch.
+ // |callback| will be dropped if the service is not applicable for the
+ // process.
+ void RegisterDelayedAnalysisCallback(
+ const safe_browsing::DelayedAnalysisCallback& callback);
+
protected:
// Creates the safe browsing service. Need to initialize before using.
SafeBrowsingService();
virtual SafeBrowsingUIManager* CreateUIManager();
+ // Registers all the delayed analysis with the incident reporting service.
+ // This is where you register your process-wide, profile-independent analysis.
+ virtual void RegisterAllDelayedAnalysis();
+
private:
friend class SafeBrowsingServiceFactoryImpl;
friend struct content::BrowserThread::DeleteOnThread<
// Accessed on UI thread.
scoped_ptr<safe_browsing::DownloadProtectionService> download_service_;
+ scoped_ptr<safe_browsing::IncidentReportingService> incident_service_;
+
// The UI manager handles showing interstitials. Accessed on both UI and IO
// thread.
scoped_refptr<SafeBrowsingUIManager> ui_manager_;