1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
11 #include "chrome/browser/safe_browsing/incident_reporting/add_incident_callback.h"
13 namespace safe_browsing {
15 // A preference validation delegate that adds incidents to a given receiver
16 // for preference validation failures.
17 class PreferenceValidationDelegate
18 : public TrackedPreferenceValidationDelegate {
20 explicit PreferenceValidationDelegate(
21 const AddIncidentCallback& add_incident);
22 virtual ~PreferenceValidationDelegate();
25 // TrackedPreferenceValidationDelegate methods.
26 virtual void OnAtomicPreferenceValidation(
27 const std::string& pref_path,
28 const base::Value* value,
29 PrefHashStoreTransaction::ValueState value_state,
30 TrackedPreferenceHelper::ResetAction reset_action) OVERRIDE;
31 virtual void OnSplitPreferenceValidation(
32 const std::string& pref_path,
33 const base::DictionaryValue* dict_value,
34 const std::vector<std::string>& invalid_keys,
35 PrefHashStoreTransaction::ValueState value_state,
36 TrackedPreferenceHelper::ResetAction reset_action) OVERRIDE;
38 AddIncidentCallback add_incident_;
40 DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate);
43 } // namespace safe_browsing
45 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_