Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/browser/protector/prefs_backup_invalid_change.cc

Issue 9748016: [protector] Added UI for invalid Preferences backup case. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Whitespace. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
65 // (http://crbug.com/119088).
66 ProtectorServiceFactory::GetForProfile(profile())->OpenTab(
67 GURL(chrome::kChromeUISettingsURL), browser);
68 }
69
70 void PrefsBackupInvalidChange::Timeout() {
71 }
72
73 int PrefsBackupInvalidChange::GetBadgeIconID() const {
74 // Use icons for startup settings change.
75 return IDR_HOMEPAGE_CHANGE_BADGE;
76 }
77
78 int PrefsBackupInvalidChange::GetMenuItemIconID() const {
79 return IDR_HOMEPAGE_CHANGE_MENU;
80 }
81
82 int PrefsBackupInvalidChange::GetBubbleIconID() const {
83 return IDR_HOMEPAGE_CHANGE_ALERT;
84 }
85
86 string16 PrefsBackupInvalidChange::GetBubbleTitle() const {
87 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_TITLE);
88 }
89
90 string16 PrefsBackupInvalidChange::GetBubbleMessage() const {
91 return l10n_util::GetStringUTF16(IDS_SETTING_CHANGE_NO_BACKUP_BUBBLE_MESSAGE);
92 }
93
94 string16 PrefsBackupInvalidChange::GetApplyButtonText() const {
95 // Don't show this button.
96 return string16();
97 }
98
99 string16 PrefsBackupInvalidChange::GetDiscardButtonText() const {
100 return l10n_util::GetStringUTF16(IDS_EDIT_SETTINGS);
101 }
102
103 BaseSettingChange* CreatePrefsBackupInvalidChange() {
104 return new PrefsBackupInvalidChange();
105 }
106
107 } // namespace protector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698