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" | |
9 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.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 |
| 13 class Profile; |
13 | 14 |
14 namespace safe_browsing { | 15 namespace safe_browsing { |
15 | 16 |
| 17 class IncidentReceiver; |
| 18 |
16 // A preference validation delegate that adds incidents to a given receiver | 19 // A preference validation delegate that adds incidents to a given receiver |
17 // for preference validation failures. | 20 // for preference validation failures. The profile for which the delegate |
| 21 // operates must outlive the delegate itself. |
18 class PreferenceValidationDelegate | 22 class PreferenceValidationDelegate |
19 : public TrackedPreferenceValidationDelegate { | 23 : public TrackedPreferenceValidationDelegate { |
20 public: | 24 public: |
21 explicit PreferenceValidationDelegate( | 25 PreferenceValidationDelegate(Profile* profile, |
22 const AddIncidentCallback& add_incident); | 26 scoped_ptr<IncidentReceiver> incident_receiver); |
23 ~PreferenceValidationDelegate() override; | 27 ~PreferenceValidationDelegate() override; |
24 | 28 |
25 private: | 29 private: |
26 // TrackedPreferenceValidationDelegate methods. | 30 // TrackedPreferenceValidationDelegate methods. |
27 void OnAtomicPreferenceValidation( | 31 void OnAtomicPreferenceValidation( |
28 const std::string& pref_path, | 32 const std::string& pref_path, |
29 const base::Value* value, | 33 const base::Value* value, |
30 PrefHashStoreTransaction::ValueState value_state, | 34 PrefHashStoreTransaction::ValueState value_state, |
31 bool is_personal) override; | 35 bool is_personal) override; |
32 void OnSplitPreferenceValidation( | 36 void OnSplitPreferenceValidation( |
33 const std::string& pref_path, | 37 const std::string& pref_path, |
34 const base::DictionaryValue* dict_value, | 38 const base::DictionaryValue* dict_value, |
35 const std::vector<std::string>& invalid_keys, | 39 const std::vector<std::string>& invalid_keys, |
36 PrefHashStoreTransaction::ValueState value_state, | 40 PrefHashStoreTransaction::ValueState value_state, |
37 bool is_personal) override; | 41 bool is_personal) override; |
38 | 42 |
39 AddIncidentCallback add_incident_; | 43 Profile* profile_; |
| 44 scoped_ptr<IncidentReceiver> incident_receiver_; |
40 | 45 |
41 DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(PreferenceValidationDelegate); |
42 }; | 47 }; |
43 | 48 |
44 } // namespace safe_browsing | 49 } // namespace safe_browsing |
45 | 50 |
46 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION
_DELEGATE_H_ | 51 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_PREFERENCE_VALIDATION
_DELEGATE_H_ |
OLD | NEW |