Home | History | Annotate | Download | only in tracked
      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_PREFS_TRACKED_TRACKED_PREFERENCE_VALIDATION_DELEGATE_H_
      6 #define CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_VALIDATION_DELEGATE_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "chrome/browser/prefs/pref_hash_store_transaction.h"
     12 #include "chrome/browser/prefs/tracked/tracked_preference_helper.h"
     13 
     14 namespace base {
     15 class DictionaryValue;
     16 class Value;
     17 }
     18 
     19 // A TrackedPreferenceValidationDelegate is notified of the results of each
     20 // tracked preference validation event.
     21 class TrackedPreferenceValidationDelegate {
     22  public:
     23   virtual ~TrackedPreferenceValidationDelegate() {}
     24 
     25   // Notifies observes of the result (|value_state|) of checking the atomic
     26   // |value| (which may be NULL) at |pref_path|. |reset_action| indicates
     27   // whether or not a reset will occur based on |value_state| and the
     28   // enforcement level in place.
     29   virtual void OnAtomicPreferenceValidation(
     30       const std::string& pref_path,
     31       const base::Value* value,
     32       PrefHashStoreTransaction::ValueState value_state,
     33       TrackedPreferenceHelper::ResetAction reset_action) = 0;
     34 
     35   // Notifies observes of the result (|value_state|) of checking the split
     36   // |dict_value| (which may be NULL) at |pref_path|. |reset_action| indicates
     37   // whether or not a reset of |value_keys| will occur based on |value_state|
     38   // and the enforcement level in place.
     39   virtual void OnSplitPreferenceValidation(
     40       const std::string& pref_path,
     41       const base::DictionaryValue* dict_value,
     42       const std::vector<std::string>& invalid_keys,
     43       PrefHashStoreTransaction::ValueState value_state,
     44       TrackedPreferenceHelper::ResetAction reset_action) = 0;
     45 };
     46 
     47 #endif  // CHROME_BROWSER_PREFS_TRACKED_TRACKED_PREFERENCE_VALIDATION_DELEGATE_H_
     48