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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/prefs/session_startup_pref.h" | 10 #include "chrome/browser/prefs/session_startup_pref.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace protector { | 24 namespace protector { |
25 | 25 |
26 // Unknown change to Preferences with invalid backup. | 26 // Unknown change to Preferences with invalid backup. |
27 class PrefsBackupInvalidChange : public BasePrefsChange { | 27 class PrefsBackupInvalidChange : public BasePrefsChange { |
28 public: | 28 public: |
29 PrefsBackupInvalidChange(); | 29 PrefsBackupInvalidChange(); |
30 | 30 |
31 // BasePrefsChange overrides: | 31 // BasePrefsChange overrides: |
32 virtual bool Init(Profile* profile) OVERRIDE; | 32 virtual bool Init(Profile* profile) OVERRIDE; |
| 33 virtual void InitWhenDisabled(Profile* profile) OVERRIDE; |
33 virtual void Apply(Browser* browser) OVERRIDE; | 34 virtual void Apply(Browser* browser) OVERRIDE; |
34 virtual void Discard(Browser* browser) OVERRIDE; | 35 virtual void Discard(Browser* browser) OVERRIDE; |
35 virtual void Timeout() OVERRIDE; | 36 virtual void Timeout() OVERRIDE; |
36 virtual int GetBadgeIconID() const OVERRIDE; | 37 virtual int GetBadgeIconID() const OVERRIDE; |
37 virtual int GetMenuItemIconID() const OVERRIDE; | 38 virtual int GetMenuItemIconID() const OVERRIDE; |
38 virtual int GetBubbleIconID() const OVERRIDE; | 39 virtual int GetBubbleIconID() const OVERRIDE; |
39 virtual string16 GetBubbleTitle() const OVERRIDE; | 40 virtual string16 GetBubbleTitle() const OVERRIDE; |
40 virtual string16 GetBubbleMessage() const OVERRIDE; | 41 virtual string16 GetBubbleMessage() const OVERRIDE; |
41 virtual string16 GetApplyButtonText() const OVERRIDE; | 42 virtual string16 GetApplyButtonText() const OVERRIDE; |
42 virtual string16 GetDiscardButtonText() const OVERRIDE; | 43 virtual string16 GetDiscardButtonText() const OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
67 ApplyDefaults(profile); | 68 ApplyDefaults(profile); |
68 DismissOnPrefChange(prefs::kHomePageIsNewTabPage); | 69 DismissOnPrefChange(prefs::kHomePageIsNewTabPage); |
69 DismissOnPrefChange(prefs::kHomePage); | 70 DismissOnPrefChange(prefs::kHomePage); |
70 DismissOnPrefChange(prefs::kShowHomeButton); | 71 DismissOnPrefChange(prefs::kShowHomeButton); |
71 DismissOnPrefChange(prefs::kRestoreOnStartup); | 72 DismissOnPrefChange(prefs::kRestoreOnStartup); |
72 DismissOnPrefChange(prefs::kURLsToRestoreOnStartup); | 73 DismissOnPrefChange(prefs::kURLsToRestoreOnStartup); |
73 DismissOnPrefChange(prefs::kPinnedTabs); | 74 DismissOnPrefChange(prefs::kPinnedTabs); |
74 return true; | 75 return true; |
75 } | 76 } |
76 | 77 |
| 78 void PrefsBackupInvalidChange::InitWhenDisabled(Profile* profile) { |
| 79 // Nothing to do here since the backup has been already reset. |
| 80 } |
| 81 |
77 void PrefsBackupInvalidChange::Apply(Browser* browser) { | 82 void PrefsBackupInvalidChange::Apply(Browser* browser) { |
78 NOTREACHED(); | 83 NOTREACHED(); |
79 } | 84 } |
80 | 85 |
81 void PrefsBackupInvalidChange::Discard(Browser* browser) { | 86 void PrefsBackupInvalidChange::Discard(Browser* browser) { |
82 // TODO(ivankr): highlight the protected prefs on the settings page | 87 // TODO(ivankr): highlight the protected prefs on the settings page |
83 // (http://crbug.com/119088). | 88 // (http://crbug.com/119088). |
84 ProtectorServiceFactory::GetForProfile(profile())->OpenTab( | 89 ProtectorServiceFactory::GetForProfile(profile())->OpenTab( |
85 GURL(chrome::kChromeUISettingsURL), browser); | 90 GURL(chrome::kChromeUISettingsURL), browser); |
86 } | 91 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 139 |
135 bool PrefsBackupInvalidChange::CanBeMerged() const { | 140 bool PrefsBackupInvalidChange::CanBeMerged() const { |
136 return false; | 141 return false; |
137 } | 142 } |
138 | 143 |
139 BaseSettingChange* CreatePrefsBackupInvalidChange() { | 144 BaseSettingChange* CreatePrefsBackupInvalidChange() { |
140 return new PrefsBackupInvalidChange(); | 145 return new PrefsBackupInvalidChange(); |
141 } | 146 } |
142 | 147 |
143 } // namespace protector | 148 } // namespace protector |
OLD | NEW |