| 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 22 matching lines...) Expand all Loading... |
| 33 virtual void Apply(Browser* browser) OVERRIDE; | 33 virtual void Apply(Browser* browser) OVERRIDE; |
| 34 virtual void Discard(Browser* browser) OVERRIDE; | 34 virtual void Discard(Browser* browser) OVERRIDE; |
| 35 virtual void Timeout() OVERRIDE; | 35 virtual void Timeout() OVERRIDE; |
| 36 virtual int GetBadgeIconID() const OVERRIDE; | 36 virtual int GetBadgeIconID() const OVERRIDE; |
| 37 virtual int GetMenuItemIconID() const OVERRIDE; | 37 virtual int GetMenuItemIconID() const OVERRIDE; |
| 38 virtual int GetBubbleIconID() const OVERRIDE; | 38 virtual int GetBubbleIconID() const OVERRIDE; |
| 39 virtual string16 GetBubbleTitle() const OVERRIDE; | 39 virtual string16 GetBubbleTitle() const OVERRIDE; |
| 40 virtual string16 GetBubbleMessage() const OVERRIDE; | 40 virtual string16 GetBubbleMessage() const OVERRIDE; |
| 41 virtual string16 GetApplyButtonText() const OVERRIDE; | 41 virtual string16 GetApplyButtonText() const OVERRIDE; |
| 42 virtual string16 GetDiscardButtonText() const OVERRIDE; | 42 virtual string16 GetDiscardButtonText() const OVERRIDE; |
| 43 virtual bool CanBeMerged() const OVERRIDE; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 virtual ~PrefsBackupInvalidChange(); | 46 virtual ~PrefsBackupInvalidChange(); |
| 46 | 47 |
| 47 // Applies default settings values when appropriate. | 48 // Applies default settings values when appropriate. |
| 48 void ApplyDefaults(Profile* profile); | 49 void ApplyDefaults(Profile* profile); |
| 49 | 50 |
| 50 // True if session startup prefs have been reset. | 51 // True if session startup prefs have been reset. |
| 51 bool startup_pref_reset_; | 52 bool startup_pref_reset_; |
| 52 | 53 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 int PrefsBackupInvalidChange::GetMenuItemIconID() const { | 95 int PrefsBackupInvalidChange::GetMenuItemIconID() const { |
| 95 return IDR_UPDATE_MENU4; | 96 return IDR_UPDATE_MENU4; |
| 96 } | 97 } |
| 97 | 98 |
| 98 int PrefsBackupInvalidChange::GetBubbleIconID() const { | 99 int PrefsBackupInvalidChange::GetBubbleIconID() const { |
| 99 return IDR_INPUT_ALERT; | 100 return IDR_INPUT_ALERT; |
| 100 } | 101 } |
| 101 | 102 |
| 102 string16 PrefsBackupInvalidChange::GetBubbleTitle() const { | 103 string16 PrefsBackupInvalidChange::GetBubbleTitle() const { |
| 103 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_TITLE); | 104 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_TITLE); |
| 104 } | 105 } |
| 105 | 106 |
| 106 string16 PrefsBackupInvalidChange::GetBubbleMessage() const { | 107 string16 PrefsBackupInvalidChange::GetBubbleMessage() const { |
| 107 return startup_pref_reset_ ? | 108 return startup_pref_reset_ ? |
| 108 l10n_util::GetStringUTF16( | 109 l10n_util::GetStringUTF16( |
| 109 IDS_SETTING_CHANGE_NO_BACKUP_STARTUP_RESET_BUBBLE_MESSAGE) : | 110 IDS_SETTING_CHANGE_NO_BACKUP_STARTUP_RESET_BUBBLE_MESSAGE) : |
| 110 l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_BUBBLE_MESSAGE); | 111 l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_BUBBLE_MESSAGE); |
| 111 } | 112 } |
| 112 | 113 |
| 113 string16 PrefsBackupInvalidChange::GetApplyButtonText() const { | 114 string16 PrefsBackupInvalidChange::GetApplyButtonText() const { |
| 114 // Don't show this button. | 115 // Don't show this button. |
| 115 return string16(); | 116 return string16(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 string16 PrefsBackupInvalidChange::GetDiscardButtonText() const { | 119 string16 PrefsBackupInvalidChange::GetDiscardButtonText() const { |
| 119 return l10n_util::GetStringUTF16(IDS_EDIT_SETTINGS); | 120 return l10n_util::GetStringUTF16(IDS_EDIT_SETTINGS); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void PrefsBackupInvalidChange::ApplyDefaults(Profile* profile) { | 123 void PrefsBackupInvalidChange::ApplyDefaults(Profile* profile) { |
| 123 PrefService* prefs = profile->GetPrefs(); | 124 PrefService* prefs = profile->GetPrefs(); |
| 124 SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(prefs); | 125 SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(prefs); |
| 125 if (startup_pref.type != SessionStartupPref::LAST) { | 126 if (startup_pref.type != SessionStartupPref::LAST) { |
| 126 // If startup type is LAST, resetting it is dangerous (the whole previous | 127 // If startup type is LAST, resetting it is dangerous (the whole previous |
| 127 // session will be lost). | 128 // session will be lost). |
| 128 startup_pref.type = SessionStartupPref::GetDefaultStartupType(); | 129 startup_pref.type = SessionStartupPref::GetDefaultStartupType(); |
| 129 SessionStartupPref::SetStartupPref(prefs, startup_pref); | 130 SessionStartupPref::SetStartupPref(prefs, startup_pref); |
| 130 startup_pref_reset_ = true; | 131 startup_pref_reset_ = true; |
| 131 } | 132 } |
| 132 } | 133 } |
| 133 | 134 |
| 135 bool PrefsBackupInvalidChange::CanBeMerged() const { |
| 136 return false; |
| 137 } |
| 138 |
| 134 BaseSettingChange* CreatePrefsBackupInvalidChange() { | 139 BaseSettingChange* CreatePrefsBackupInvalidChange() { |
| 135 return new PrefsBackupInvalidChange(); | 140 return new PrefsBackupInvalidChange(); |
| 136 } | 141 } |
| 137 | 142 |
| 138 } // namespace protector | 143 } // namespace protector |
| OLD | NEW |