#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/database_manager.h"
#include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incident_handlers.h"
+#include "chrome/browser/safe_browsing/incident_reporting/blacklist_load_incident_handlers.h"
#include "chrome/browser/safe_browsing/incident_reporting/environment_data_collection.h"
#include "chrome/browser/safe_browsing/incident_reporting/incident_report_uploader_impl.h"
#include "chrome/browser/safe_browsing/incident_reporting/preference_validation_delegate.h"
// the histogram.
TRACKED_PREFERENCE = 1,
BINARY_INTEGRITY = 2,
+ BLACKLIST_LOAD = 3,
// Values for new incident types go here.
- NUM_INCIDENT_TYPES
+ NUM_INCIDENT_TYPES = 4
};
// The action taken for an incident; used for user metrics (see
++result;
if (incident.has_binary_integrity())
++result;
+ if (incident.has_blacklist_load())
+ ++result;
// Add detection for new incident types here.
return result;
}
return TRACKED_PREFERENCE;
if (incident_data.has_binary_integrity())
return BINARY_INTEGRITY;
+ if (incident_data.has_blacklist_load())
+ return BLACKLIST_LOAD;
// Add detection for new incident types here.
- COMPILE_ASSERT(BINARY_INTEGRITY + 1 == NUM_INCIDENT_TYPES,
+ COMPILE_ASSERT(BLACKLIST_LOAD + 1 == NUM_INCIDENT_TYPES,
add_support_for_new_types);
NOTREACHED();
return NUM_INCIDENT_TYPES;
state.key = GetBinaryIntegrityIncidentKey(incident);
state.digest = GetBinaryIntegrityIncidentDigest(incident);
break;
+ case BLACKLIST_LOAD:
+ state.key = GetBlacklistLoadIncidentKey(incident);
+ state.digest = GetBlacklistLoadIncidentDigest(incident);
+ break;
// Add handling for new incident types here.
default:
- COMPILE_ASSERT(BINARY_INTEGRITY + 1 == NUM_INCIDENT_TYPES,
+ COMPILE_ASSERT(BLACKLIST_LOAD + 1 == NUM_INCIDENT_TYPES,
add_support_for_new_types);
NOTREACHED();
break;
callback, request_context_getter, report).Pass();
}
+bool IncidentReportingService::IsProcessingReport() const {
+ return report_ != NULL;
+}
+
IncidentReportingService::ProfileContext*
IncidentReportingService::GetOrCreateProfileContext(Profile* profile) {
ProfileContextCollection::iterator it =
// The next easy case: waiting if the finder is operating.
if (last_download_finder_)
return true;
- // The harder case: waiting if a profile has not yet been added.
+ // The harder case: waiting if a non-NULL profile has not yet been added.
for (ProfileContextCollection::const_iterator scan = profiles_.begin();
scan != profiles_.end();
++scan) {
- if (!scan->second->added)
+ if (scan->first && !scan->second->added)
return true;
}
// There is no most recent download and there's nothing more to wait for.
scoped_ptr<UploadContext> context(new UploadContext(report.Pass()));
context->profiles_to_state.swap(profiles_to_state);
- if (!database_manager_) {
+ if (!database_manager_.get()) {
// No database manager during testing. Take ownership of the context and
// continue processing.
UploadContext* temp_context = context.get();