OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DE
LEGATE_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DE
LEGATE_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DE
LEGATE_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION_DE
LEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 11 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
12 #include "chrome/browser/safe_browsing/incident_reporting/add_incident_callback.
h" | 12 #include "chrome/browser/safe_browsing/incident_reporting/add_incident_callback.
h" |
13 | 13 |
| 14 class Profile; |
| 15 |
14 namespace safe_browsing { | 16 namespace safe_browsing { |
15 | 17 |
16 // A preference validation delegate that adds incidents to a given receiver | 18 // A preference validation delegate that adds incidents to a given receiver |
17 // for preference validation failures. | 19 // for preference validation failures. The profile for which the delegate |
| 20 // operates must outlive the delegate itself. |
18 class PreferenceValidationDelegate | 21 class PreferenceValidationDelegate |
19 : public TrackedPreferenceValidationDelegate { | 22 : public TrackedPreferenceValidationDelegate { |
20 public: | 23 public: |
21 explicit PreferenceValidationDelegate( | 24 PreferenceValidationDelegate(Profile* profile, |
22 const AddIncidentCallback& add_incident); | 25 const AddIncidentCallback& add_incident); |
23 ~PreferenceValidationDelegate() override; | 26 ~PreferenceValidationDelegate() override; |
24 | 27 |
25 private: | 28 private: |
26 // TrackedPreferenceValidationDelegate methods. | 29 // TrackedPreferenceValidationDelegate methods. |
27 void OnAtomicPreferenceValidation( | 30 void OnAtomicPreferenceValidation( |
28 const std::string& pref_path, | 31 const std::string& pref_path, |
29 const base::Value* value, | 32 const base::Value* value, |
30 PrefHashStoreTransaction::ValueState value_state, | 33 PrefHashStoreTransaction::ValueState value_state, |
31 bool is_personal) override; | 34 bool is_personal) override; |
32 void OnSplitPreferenceValidation( | 35 void OnSplitPreferenceValidation( |
33 const std::string& pref_path, | 36 const std::string& pref_path, |
34 const base::DictionaryValue* dict_value, | 37 const base::DictionaryValue* dict_value, |
35 const std::vector<std::string>& invalid_keys, | 38 const std::vector<std::string>& invalid_keys, |
36 PrefHashStoreTransaction::ValueState value_state, | 39 PrefHashStoreTransaction::ValueState value_state, |
37 bool is_personal) override; | 40 bool is_personal) override; |
38 | 41 |
| 42 Profile* profile_; |
39 AddIncidentCallback add_incident_; | 43 AddIncidentCallback add_incident_; |
40 | 44 |
41 DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate); | 45 DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate); |
42 }; | 46 }; |
43 | 47 |
44 } // namespace safe_browsing | 48 } // namespace safe_browsing |
45 | 49 |
46 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION
_DELEGATE_H_ | 50 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION
_DELEGATE_H_ |
OLD | NEW |