OLD | NEW |
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/settings/reset_settings_handler.h" | 5 #include "chrome/browser/ui/webui/settings/reset_settings_handler.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "build/build_config.h" | 16 #include "build/build_config.h" |
15 #include "chrome/browser/google/google_brand.h" | 17 #include "chrome/browser/google/google_brand.h" |
16 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 18 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } else { | 194 } else { |
193 DCHECK(brandcode_.empty()); | 195 DCHECK(brandcode_.empty()); |
194 } | 196 } |
195 | 197 |
196 // If failed to fetch BrandcodedDefaultSettings or this is an organic | 198 // If failed to fetch BrandcodedDefaultSettings or this is an organic |
197 // installation, use default settings. | 199 // installation, use default settings. |
198 if (!default_settings) | 200 if (!default_settings) |
199 default_settings.reset(new BrandcodedDefaultSettings); | 201 default_settings.reset(new BrandcodedDefaultSettings); |
200 | 202 |
201 GetResetter()->Reset( | 203 GetResetter()->Reset( |
202 ProfileResetter::ALL, | 204 ProfileResetter::ALL, std::move(default_settings), |
203 default_settings.Pass(), | 205 base::Bind(&ResetSettingsHandler::OnResetProfileSettingsDone, AsWeakPtr(), |
204 base::Bind(&ResetSettingsHandler::OnResetProfileSettingsDone, | |
205 AsWeakPtr(), | |
206 send_settings)); | 206 send_settings)); |
207 content::RecordAction(base::UserMetricsAction("ResetProfile")); | 207 content::RecordAction(base::UserMetricsAction("ResetProfile")); |
208 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); | 208 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); |
209 } | 209 } |
210 | 210 |
211 void ResetSettingsHandler::UpdateFeedbackUI() { | 211 void ResetSettingsHandler::UpdateFeedbackUI() { |
212 if (!setting_snapshot_) | 212 if (!setting_snapshot_) |
213 return; | 213 return; |
214 scoped_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( | 214 scoped_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( |
215 profile_, *setting_snapshot_); | 215 profile_, *setting_snapshot_); |
(...skipping 27 matching lines...) Expand all Loading... |
243 prefs->SetBoolean(prefs::kFactoryResetRequested, true); | 243 prefs->SetBoolean(prefs::kFactoryResetRequested, true); |
244 prefs->CommitPendingWrite(); | 244 prefs->CommitPendingWrite(); |
245 | 245 |
246 // Perform sign out. Current chrome process will then terminate, new one will | 246 // Perform sign out. Current chrome process will then terminate, new one will |
247 // be launched (as if it was a restart). | 247 // be launched (as if it was a restart). |
248 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 248 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
249 } | 249 } |
250 #endif // defined(OS_CHROMEOS) | 250 #endif // defined(OS_CHROMEOS) |
251 | 251 |
252 } // namespace settings | 252 } // namespace settings |
OLD | NEW |