Chromium Code Reviews| Index: chrome/browser/protector/prefs_backup_invalid_change.cc |
| diff --git a/chrome/browser/protector/prefs_backup_invalid_change.cc b/chrome/browser/protector/prefs_backup_invalid_change.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8e05bc537df72d5f66e857d9424fe35cd4cf052e |
| --- /dev/null |
| +++ b/chrome/browser/protector/prefs_backup_invalid_change.cc |
| @@ -0,0 +1,106 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/logging.h" |
| +#include "base/metrics/histogram.h" |
| +#include "base/utf_string_conversions.h" |
| +#include "chrome/browser/protector/base_setting_change.h" |
| +#include "chrome/browser/protector/histograms.h" |
| +#include "chrome/browser/protector/protector_service.h" |
| +#include "chrome/browser/protector/protector_service_factory.h" |
| +#include "chrome/common/url_constants.h" |
| +#include "googleurl/src/gurl.h" |
| +#include "grit/chromium_strings.h" |
| +#include "grit/generated_resources.h" |
| +#include "grit/theme_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| + |
| +namespace protector { |
| + |
| +// Unknown change to Preferences with invalid backup. |
| +class PrefsBackupInvalidChange : public BaseSettingChange { |
| + public: |
| + PrefsBackupInvalidChange(); |
| + |
| + // BaseSettingChange overrides: |
| + virtual bool Init(Profile* profile) OVERRIDE; |
| + virtual void Apply(Browser* browser) OVERRIDE; |
| + virtual void Discard(Browser* browser) OVERRIDE; |
| + virtual void Timeout() OVERRIDE; |
| + virtual int GetBadgeIconID() const OVERRIDE; |
| + virtual int GetMenuItemIconID() const OVERRIDE; |
| + virtual int GetBubbleIconID() const OVERRIDE; |
| + virtual string16 GetBubbleTitle() const OVERRIDE; |
| + virtual string16 GetBubbleMessage() const OVERRIDE; |
| + virtual string16 GetApplyButtonText() const OVERRIDE; |
| + virtual string16 GetDiscardButtonText() const OVERRIDE; |
| + |
| + private: |
| + virtual ~PrefsBackupInvalidChange(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PrefsBackupInvalidChange); |
| +}; |
| + |
| +PrefsBackupInvalidChange::PrefsBackupInvalidChange() { |
| +} |
| + |
| +PrefsBackupInvalidChange::~PrefsBackupInvalidChange() { |
| +} |
| + |
| +bool PrefsBackupInvalidChange::Init(Profile* profile) { |
| + if (!BaseSettingChange::Init(profile)) |
| + return false; |
| + return true; |
| +} |
| + |
| +void PrefsBackupInvalidChange::Apply(Browser* browser) { |
| + NOTREACHED(); |
| +} |
| + |
| +void PrefsBackupInvalidChange::Discard(Browser* browser) { |
| + // TODO(ivankr): highlight the protected prefs on the settings page. |
|
whywhat
2012/03/20 16:06:01
Bug id?
Ivan Korotkov
2012/03/20 16:16:02
Done.
|
| + ProtectorServiceFactory::GetForProfile(profile())->OpenTab( |
| + GURL(chrome::kChromeUISettingsURL), browser); |
| +} |
| + |
| +void PrefsBackupInvalidChange::Timeout() { |
| +} |
| + |
| +int PrefsBackupInvalidChange::GetBadgeIconID() const { |
| + // Use icons for startup settings change. |
| + return IDR_HOMEPAGE_CHANGE_BADGE; |
| +} |
| + |
| +int PrefsBackupInvalidChange::GetMenuItemIconID() const { |
| + return IDR_HOMEPAGE_CHANGE_MENU; |
| +} |
| + |
| +int PrefsBackupInvalidChange::GetBubbleIconID() const { |
| + return IDR_HOMEPAGE_CHANGE_ALERT; |
| +} |
| + |
| +string16 PrefsBackupInvalidChange::GetBubbleTitle() const { |
| + return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_TITLE); |
| +} |
| + |
| +string16 PrefsBackupInvalidChange::GetBubbleMessage() const { |
| + return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_BUBBLE_MESSAGE); |
| +} |
| + |
| +string16 PrefsBackupInvalidChange::GetApplyButtonText() const { |
| + // Don't show this button. |
| + return string16(); |
| +} |
| + |
| +string16 PrefsBackupInvalidChange::GetDiscardButtonText() const { |
| + return l10n_util::GetStringUTF16(IDS_EDIT_SETTINGS); |
| +} |
| + |
| +BaseSettingChange* CreatePrefsBackupInvalidChange() { |
| + return new PrefsBackupInvalidChange(); |
| +} |
| + |
| +} // namespace protector |