Home | History | Annotate | Download | only in incident_reporting
      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.
      4 
      5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_
      6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_
      7 
      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"
     12 
     13 namespace safe_browsing {
     14 
     15 // A preference validation delegate that adds incidents to a given receiver
     16 // for preference validation failures.
     17 class PreferenceValidationDelegate
     18     : public TrackedPreferenceValidationDelegate {
     19  public:
     20   explicit PreferenceValidationDelegate(
     21       const AddIncidentCallback& add_incident);
     22   virtual ~PreferenceValidationDelegate();
     23 
     24  private:
     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;
     37 
     38   AddIncidentCallback add_incident_;
     39 
     40   DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate);
     41 };
     42 
     43 }  // namespace safe_browsing
     44 
     45 #endif  // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DELEGATE_H_
     46