summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/preference_validation_delegate.h
blob: d898af11ede0b7060ef68c06d80da8733d5bf86e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2014 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_PREFERENCE_VALIDATION_DELEGATE_H_
#define CHROME_BROWSER_SAFE_BROWSING_PREFERENCE_VALIDATION_DELEGATE_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h"
#include "chrome/browser/safe_browsing/add_incident_callback.h"

namespace safe_browsing {

// A preference validation delegate that adds incidents to a given receiver
// for preference validation failures.
class PreferenceValidationDelegate
    : public TrackedPreferenceValidationDelegate {
 public:
  explicit PreferenceValidationDelegate(
      const AddIncidentCallback& add_incident);
  virtual ~PreferenceValidationDelegate();

 private:
  // TrackedPreferenceValidationDelegate methods.
  virtual void OnAtomicPreferenceValidation(
      const std::string& pref_path,
      const base::Value* value,
      PrefHashStoreTransaction::ValueState value_state,
      TrackedPreferenceHelper::ResetAction reset_action) OVERRIDE;
  virtual void OnSplitPreferenceValidation(
      const std::string& pref_path,
      const base::DictionaryValue* dict_value,
      const std::vector<std::string>& invalid_keys,
      PrefHashStoreTransaction::ValueState value_state,
      TrackedPreferenceHelper::ResetAction reset_action) OVERRIDE;

  AddIncidentCallback add_incident_;

  DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate);
};

}  // namespace safe_browsing

#endif  // CHROME_BROWSER_SAFE_BROWSING_PREFERENCE_VALIDATION_DELEGATE_H_