Chromium Code Reviews| 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 #include "base/basictypes.h" | |
| 6 #include "base/compiler_specific.h" | |
| 7 #include "base/logging.h" | |
| 8 #include "base/metrics/histogram.h" | |
| 9 #include "base/utf_string_conversions.h" | |
| 10 #include "chrome/browser/protector/base_setting_change.h" | |
| 11 #include "chrome/browser/protector/histograms.h" | |
| 12 #include "chrome/browser/protector/protector_service.h" | |
| 13 #include "chrome/browser/protector/protector_service_factory.h" | |
| 14 #include "chrome/common/url_constants.h" | |
| 15 #include "googleurl/src/gurl.h" | |
| 16 #include "grit/chromium_strings.h" | |
| 17 #include "grit/generated_resources.h" | |
| 18 #include "grit/theme_resources.h" | |
| 19 #include "ui/base/l10n/l10n_util.h" | |
| 20 | |
| 21 namespace protector { | |
| 22 | |
| 23 // Unknown change to Preferences with invalid backup. | |
| 24 class PrefsBackupInvalidChange : public BaseSettingChange { | |
| 25 public: | |
| 26 PrefsBackupInvalidChange(); | |
| 27 | |
| 28 // BaseSettingChange overrides: | |
| 29 virtual bool Init(Profile* profile) OVERRIDE; | |
| 30 virtual void Apply(Browser* browser) OVERRIDE; | |
| 31 virtual void Discard(Browser* browser) OVERRIDE; | |
| 32 virtual void Timeout() OVERRIDE; | |
| 33 virtual int GetBadgeIconID() const OVERRIDE; | |
| 34 virtual int GetMenuItemIconID() const OVERRIDE; | |
| 35 virtual int GetBubbleIconID() const OVERRIDE; | |
| 36 virtual string16 GetBubbleTitle() const OVERRIDE; | |
| 37 virtual string16 GetBubbleMessage() const OVERRIDE; | |
| 38 virtual string16 GetApplyButtonText() const OVERRIDE; | |
| 39 virtual string16 GetDiscardButtonText() const OVERRIDE; | |
| 40 | |
| 41 private: | |
| 42 virtual ~PrefsBackupInvalidChange(); | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(PrefsBackupInvalidChange); | |
| 45 }; | |
| 46 | |
| 47 PrefsBackupInvalidChange::PrefsBackupInvalidChange() { | |
| 48 } | |
| 49 | |
| 50 PrefsBackupInvalidChange::~PrefsBackupInvalidChange() { | |
| 51 } | |
| 52 | |
| 53 bool PrefsBackupInvalidChange::Init(Profile* profile) { | |
| 54 if (!BaseSettingChange::Init(profile)) | |
| 55 return false; | |
| 56 return true; | |
| 57 } | |
| 58 | |
| 59 void PrefsBackupInvalidChange::Apply(Browser* browser) { | |
| 60 NOTREACHED(); | |
| 61 } | |
| 62 | |
| 63 void PrefsBackupInvalidChange::Discard(Browser* browser) { | |
| 64 // 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.
| |
| 65 ProtectorServiceFactory::GetForProfile(profile())->OpenTab( | |
| 66 GURL(chrome::kChromeUISettingsURL), browser); | |
| 67 } | |
| 68 | |
| 69 void PrefsBackupInvalidChange::Timeout() { | |
| 70 } | |
| 71 | |
| 72 int PrefsBackupInvalidChange::GetBadgeIconID() const { | |
| 73 // Use icons for startup settings change. | |
| 74 return IDR_HOMEPAGE_CHANGE_BADGE; | |
| 75 } | |
| 76 | |
| 77 int PrefsBackupInvalidChange::GetMenuItemIconID() const { | |
| 78 return IDR_HOMEPAGE_CHANGE_MENU; | |
| 79 } | |
| 80 | |
| 81 int PrefsBackupInvalidChange::GetBubbleIconID() const { | |
| 82 return IDR_HOMEPAGE_CHANGE_ALERT; | |
| 83 } | |
| 84 | |
| 85 string16 PrefsBackupInvalidChange::GetBubbleTitle() const { | |
| 86 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_TITLE); | |
| 87 } | |
| 88 | |
| 89 string16 PrefsBackupInvalidChange::GetBubbleMessage() const { | |
| 90 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_BUBBLE_MESSAGE); | |
| 91 } | |
| 92 | |
| 93 string16 PrefsBackupInvalidChange::GetApplyButtonText() const { | |
| 94 // Don't show this button. | |
| 95 return string16(); | |
| 96 } | |
| 97 | |
| 98 string16 PrefsBackupInvalidChange::GetDiscardButtonText() const { | |
| 99 return l10n_util::GetStringUTF16(IDS_EDIT_SETTINGS); | |
| 100 } | |
| 101 | |
| 102 BaseSettingChange* CreatePrefsBackupInvalidChange() { | |
| 103 return new PrefsBackupInvalidChange(); | |
| 104 } | |
| 105 | |
| 106 } // namespace protector | |
| OLD | NEW |