OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_PROTECTOR_BASE_PREFS_CHANGE_H_ | |
6 #define CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/prefs/public/pref_change_registrar.h" | |
12 #include "chrome/browser/protector/base_setting_change.h" | |
13 | |
14 namespace protector { | |
15 | |
16 // BaseSettingChange subclass for PrefService-managed settings changes. | |
17 class BasePrefsChange : public BaseSettingChange { | |
18 public: | |
19 BasePrefsChange(); | |
20 virtual ~BasePrefsChange(); | |
21 | |
22 // BaseSettingChange overrides: | |
23 virtual bool Init(Profile* profile) OVERRIDE; | |
24 virtual void InitWhenDisabled(Profile* profile) OVERRIDE; | |
25 | |
26 protected: | |
27 // Marks |this| to be dismissed when |pref_name| is changed. Should only be | |
28 // called after Init. | |
29 void DismissOnPrefChange(const std::string& pref_name); | |
30 | |
31 // Ignores any further changes to prefs. No further DismissOnPrefChange calls | |
32 // can be made. | |
33 void IgnorePrefChanges(); | |
34 | |
35 private: | |
36 void OnPreferenceChanged(const std::string& pref_name); | |
37 | |
38 PrefChangeRegistrar pref_observer_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(BasePrefsChange); | |
41 }; | |
42 | |
43 } // namespace protector | |
44 | |
45 #endif // CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ | |
OLD | NEW |