| 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/options/reset_profile_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/reset_profile_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/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 11 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/string16.h" | 14 #include "base/strings/string16.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/profile_resetter/brandcode_config_fetcher.h" | 18 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 config_fetcher_.reset(); | 207 config_fetcher_.reset(); |
| 206 } else { | 208 } else { |
| 207 DCHECK(brandcode_.empty()); | 209 DCHECK(brandcode_.empty()); |
| 208 } | 210 } |
| 209 | 211 |
| 210 // If failed to fetch BrandcodedDefaultSettings or this is an organic | 212 // If failed to fetch BrandcodedDefaultSettings or this is an organic |
| 211 // installation, use default settings. | 213 // installation, use default settings. |
| 212 if (!default_settings) | 214 if (!default_settings) |
| 213 default_settings.reset(new BrandcodedDefaultSettings); | 215 default_settings.reset(new BrandcodedDefaultSettings); |
| 214 resetter_->Reset( | 216 resetter_->Reset( |
| 215 ProfileResetter::ALL, | 217 ProfileResetter::ALL, std::move(default_settings), |
| 216 default_settings.Pass(), | |
| 217 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, | 218 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, |
| 218 AsWeakPtr(), | 219 AsWeakPtr(), send_settings)); |
| 219 send_settings)); | |
| 220 content::RecordAction(base::UserMetricsAction("ResetProfile")); | 220 content::RecordAction(base::UserMetricsAction("ResetProfile")); |
| 221 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); | 221 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ResetProfileSettingsHandler::UpdateFeedbackUI() { | 224 void ResetProfileSettingsHandler::UpdateFeedbackUI() { |
| 225 if (!setting_snapshot_) | 225 if (!setting_snapshot_) |
| 226 return; | 226 return; |
| 227 scoped_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( | 227 scoped_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( |
| 228 Profile::FromWebUI(web_ui()), | 228 Profile::FromWebUI(web_ui()), |
| 229 *setting_snapshot_); | 229 *setting_snapshot_); |
| 230 base::DictionaryValue feedback_info; | 230 base::DictionaryValue feedback_info; |
| 231 feedback_info.Set("feedbackInfo", list.release()); | 231 feedback_info.Set("feedbackInfo", list.release()); |
| 232 web_ui()->CallJavascriptFunction( | 232 web_ui()->CallJavascriptFunction( |
| 233 "ResetProfileSettingsOverlay.setFeedbackInfo", | 233 "ResetProfileSettingsOverlay.setFeedbackInfo", |
| 234 feedback_info); | 234 feedback_info); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace options | 237 } // namespace options |
| OLD | NEW |