OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_PROTECTOR_BASE_PREFS_CHANGE_H_ | 5 #ifndef CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ |
6 #define CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ | 6 #define CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/protector/base_setting_change.h" | 12 #include "chrome/browser/protector/base_setting_change.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 | 14 |
15 class PrefSetObserver; | 15 class PrefSetObserver; |
16 | 16 |
17 namespace protector { | 17 namespace protector { |
18 | 18 |
19 // BaseSettingChange subclass for PrefService-managed settings changes. | 19 // BaseSettingChange subclass for PrefService-managed settings changes. |
20 class BasePrefsChange : public BaseSettingChange, | 20 class BasePrefsChange : public BaseSettingChange, |
21 public content::NotificationObserver { | 21 public content::NotificationObserver { |
22 public: | 22 public: |
23 BasePrefsChange(); | 23 BasePrefsChange(); |
24 virtual ~BasePrefsChange(); | 24 virtual ~BasePrefsChange(); |
25 | 25 |
26 // BaseSettingChange overrides: | 26 // BaseSettingChange overrides: |
27 virtual bool Init(Profile* profile) OVERRIDE; | 27 virtual bool Init(Profile* profile) OVERRIDE; |
| 28 virtual void InitWhenDisabled(Profile* profile) OVERRIDE; |
28 | 29 |
29 protected: | 30 protected: |
30 // Marks |this| to be dismissed when |pref_name| is changed. Should only be | 31 // Marks |this| to be dismissed when |pref_name| is changed. Should only be |
31 // called after Init. | 32 // called after Init. |
32 void DismissOnPrefChange(const std::string& pref_name); | 33 void DismissOnPrefChange(const std::string& pref_name); |
33 | 34 |
34 // Ignores any further changes to prefs. No further DismissOnPrefChange calls | 35 // Ignores any further changes to prefs. No further DismissOnPrefChange calls |
35 // can be made. | 36 // can be made. |
36 void IgnorePrefChanges(); | 37 void IgnorePrefChanges(); |
37 | 38 |
38 private: | 39 private: |
39 // content::NotificationObserver overrides: | 40 // content::NotificationObserver overrides: |
40 virtual void Observe(int type, | 41 virtual void Observe(int type, |
41 const content::NotificationSource& source, | 42 const content::NotificationSource& source, |
42 const content::NotificationDetails& details) OVERRIDE; | 43 const content::NotificationDetails& details) OVERRIDE; |
43 | 44 |
44 scoped_ptr<PrefSetObserver> pref_observer_; | 45 scoped_ptr<PrefSetObserver> pref_observer_; |
45 | 46 |
46 DISALLOW_COPY_AND_ASSIGN(BasePrefsChange); | 47 DISALLOW_COPY_AND_ASSIGN(BasePrefsChange); |
47 }; | 48 }; |
48 | 49 |
49 } // namespace protector | 50 } // namespace protector |
50 | 51 |
51 #endif // CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ | 52 #endif // CHROME_BROWSER_PROTECTOR_BASE_PREFS_CHANGE_H_ |
OLD | NEW |