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

Side by Side Diff: chrome/browser/ui/webui/options/reset_profile_settings_handler.cc

Issue 16106002: Modify UI and logic in Reset Profile dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 'Reset homepage' => 'Reset startup page' Created 7 years, 6 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
« no previous file with comments | « chrome/browser/resources/options/reset_profile_settings_overlay.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/webui/options/reset_profile_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/reset_profile_settings_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 void ResetProfileSettingsHandler::GetLocalizedValues( 38 void ResetProfileSettingsHandler::GetLocalizedValues(
39 DictionaryValue* localized_strings) { 39 DictionaryValue* localized_strings) {
40 DCHECK(localized_strings); 40 DCHECK(localized_strings);
41 41
42 static OptionsStringResource resources[] = { 42 static OptionsStringResource resources[] = {
43 { "resetProfileSettingsLabel", IDS_RESET_PROFILE_SETTINGS_LABEL }, 43 { "resetProfileSettingsLabel", IDS_RESET_PROFILE_SETTINGS_LABEL },
44 { "resetDefaultSearchEngineCheckbox", 44 { "resetDefaultSearchEngineCheckbox",
45 IDS_RESET_PROFILE_DEFAULT_SEARCH_ENGINE_CHECKBOX }, 45 IDS_RESET_PROFILE_DEFAULT_SEARCH_ENGINE_CHECKBOX },
46 { "resetHomepageCheckbox", IDS_RESET_PROFILE_HOMEPAGE_CHECKBOX }, 46 { "resetStartupAndHomepageCheckbox",
47 IDS_RESET_PROFILE_STARTUP_HOMEPAGE_CHECKBOX },
47 { "resetContentSettingsCheckbox", 48 { "resetContentSettingsCheckbox",
48 IDS_RESET_PROFILE_CONTENT_SETTINGS_CHECKBOX }, 49 IDS_RESET_PROFILE_CONTENT_SETTINGS_CHECKBOX },
49 { "resetCookiesAndSiteDataCheckbox", IDS_RESET_PROFILE_COOKIES_CHECKBOX }, 50 { "resetCookiesAndSiteDataCheckbox", IDS_RESET_PROFILE_COOKIES_CHECKBOX },
50 { "resetExtensionsCheckbox", IDS_RESET_PROFILE_EXTENSIONS_CHECKBOX }, 51 { "resetExtensionsCheckbox", IDS_RESET_PROFILE_EXTENSIONS_CHECKBOX },
51 { "resetProfileSettingsCommit", IDS_RESET_PROFILE_SETTINGS_COMMIT_BUTTON }, 52 { "resetProfileSettingsCommit", IDS_RESET_PROFILE_SETTINGS_COMMIT_BUTTON },
52 }; 53 };
53 54
54 RegisterStrings(localized_strings, resources, arraysize(resources)); 55 RegisterStrings(localized_strings, resources, arraysize(resources));
55 RegisterTitle(localized_strings, "resetProfileSettingsOverlay", 56 RegisterTitle(localized_strings, "resetProfileSettingsOverlay",
56 IDS_RESET_PROFILE_SETTINGS_TITLE); 57 IDS_RESET_PROFILE_SETTINGS_TITLE);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DCHECK(resetter_); 94 DCHECK(resetter_);
94 DCHECK(!resetter_->IsActive()); 95 DCHECK(!resetter_->IsActive());
95 96
96 Profile* profile = Profile::FromWebUI(web_ui()); 97 Profile* profile = Profile::FromWebUI(web_ui());
97 PrefService* prefs = profile->GetPrefs(); 98 PrefService* prefs = profile->GetPrefs();
98 99
99 ProfileResetter::ResettableFlags reset_mask = 0; 100 ProfileResetter::ResettableFlags reset_mask = 0;
100 101
101 struct { 102 struct {
102 const char* flag_name; 103 const char* flag_name;
103 ProfileResetter::Resettable mask; 104 ProfileResetter::ResettableFlags mask;
104 } name_to_flag[] = { 105 } name_to_flag[] = {
105 { prefs::kResetDefaultSearchEngine, 106 { prefs::kResetDefaultSearchEngine,
106 ProfileResetter::DEFAULT_SEARCH_ENGINE }, 107 ProfileResetter::DEFAULT_SEARCH_ENGINE },
107 { prefs::kResetHomepage, ProfileResetter::HOMEPAGE }, 108 { prefs::kResetHomepage, ProfileResetter::HOMEPAGE |
109 ProfileResetter::STARTUP_PAGE },
108 { prefs::kResetContentSettings, ProfileResetter::CONTENT_SETTINGS }, 110 { prefs::kResetContentSettings, ProfileResetter::CONTENT_SETTINGS },
109 { prefs::kResetCookiesAndSiteData, ProfileResetter::COOKIES_AND_SITE_DATA }, 111 { prefs::kResetCookiesAndSiteData, ProfileResetter::COOKIES_AND_SITE_DATA },
110 { prefs::kResetExtensions, ProfileResetter::EXTENSIONS }, 112 { prefs::kResetExtensions, ProfileResetter::EXTENSIONS },
111 }; 113 };
112 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(name_to_flag); ++i) { 114 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(name_to_flag); ++i) {
113 if (prefs->GetBoolean(name_to_flag[i].flag_name)) 115 if (prefs->GetBoolean(name_to_flag[i].flag_name))
114 reset_mask |= name_to_flag[i].mask; 116 reset_mask |= name_to_flag[i].mask;
115 } 117 }
116 118
117 ProfileResetter::ExtensionHandling extension_handling = 119 ProfileResetter::ExtensionHandling extension_handling =
118 (prefs->GetInteger(prefs::kResetExtensionsHandling) == 0) 120 (prefs->GetInteger(prefs::kResetExtensionsHandling) == 0)
119 ? ProfileResetter::DISABLE_EXTENSIONS 121 ? ProfileResetter::DISABLE_EXTENSIONS
120 : ProfileResetter::UNINSTALL_EXTENSIONS; 122 : ProfileResetter::UNINSTALL_EXTENSIONS;
121 123
122 resetter_->Reset( 124 resetter_->Reset(
123 reset_mask, 125 reset_mask,
124 extension_handling, 126 extension_handling,
125 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, 127 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone,
126 AsWeakPtr())); 128 AsWeakPtr()));
127 } 129 }
128 130
129 void ResetProfileSettingsHandler::OnResetProfileSettingsDone() { 131 void ResetProfileSettingsHandler::OnResetProfileSettingsDone() {
130 web_ui()->CallJavascriptFunction("ResetProfileSettingsOverlay.doneResetting"); 132 web_ui()->CallJavascriptFunction("ResetProfileSettingsOverlay.doneResetting");
131 } 133 }
132 134
133 } // namespace options 135 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/reset_profile_settings_overlay.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698