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> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/metrics/user_metrics.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/browser/google/google_brand.h" | 17 #include "chrome/browser/google/google_brand.h" |
17 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 18 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
18 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" | 19 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" |
19 #include "chrome/browser/profile_resetter/profile_resetter.h" | 20 #include "chrome/browser/profile_resetter/profile_resetter.h" |
20 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 21 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/chromium_strings.h" | 24 #include "chrome/grit/chromium_strings.h" |
24 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
25 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
26 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
27 #include "content/public/browser/user_metrics.h" | |
28 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" | 32 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" |
33 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" | 33 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" |
34 #endif // defined(OS_WIN) | 34 #endif // defined(OS_WIN) |
35 | 35 |
36 namespace options { | 36 namespace options { |
37 | 37 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 // If failed to fetch BrandcodedDefaultSettings or this is an organic | 243 // If failed to fetch BrandcodedDefaultSettings or this is an organic |
244 // installation, use default settings. | 244 // installation, use default settings. |
245 if (!default_settings) | 245 if (!default_settings) |
246 default_settings.reset(new BrandcodedDefaultSettings); | 246 default_settings.reset(new BrandcodedDefaultSettings); |
247 resetter_->Reset( | 247 resetter_->Reset( |
248 ProfileResetter::ALL, std::move(default_settings), | 248 ProfileResetter::ALL, std::move(default_settings), |
249 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, | 249 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, |
250 AsWeakPtr(), send_settings, request_origin)); | 250 AsWeakPtr(), send_settings, request_origin)); |
251 content::RecordAction(base::UserMetricsAction("ResetProfile")); | 251 base::RecordAction(base::UserMetricsAction("ResetProfile")); |
252 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); | 252 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); |
253 UMA_HISTOGRAM_ENUMERATION( | 253 UMA_HISTOGRAM_ENUMERATION( |
254 "ProfileReset.ResetRequestOrigin", request_origin, | 254 "ProfileReset.ResetRequestOrigin", request_origin, |
255 reset_report::ChromeResetReport::ResetRequestOrigin_MAX + 1); | 255 reset_report::ChromeResetReport::ResetRequestOrigin_MAX + 1); |
256 } | 256 } |
257 | 257 |
258 void ResetProfileSettingsHandler::UpdateFeedbackUI() { | 258 void ResetProfileSettingsHandler::UpdateFeedbackUI() { |
259 if (!setting_snapshot_) | 259 if (!setting_snapshot_) |
260 return; | 260 return; |
261 std::unique_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( | 261 std::unique_ptr<base::ListValue> list = GetReadableFeedbackForSnapshot( |
262 Profile::FromWebUI(web_ui()), *setting_snapshot_); | 262 Profile::FromWebUI(web_ui()), *setting_snapshot_); |
263 base::DictionaryValue feedback_info; | 263 base::DictionaryValue feedback_info; |
264 feedback_info.Set("feedbackInfo", list.release()); | 264 feedback_info.Set("feedbackInfo", list.release()); |
265 web_ui()->CallJavascriptFunctionUnsafe( | 265 web_ui()->CallJavascriptFunctionUnsafe( |
266 "ResetProfileSettingsOverlay.setFeedbackInfo", feedback_info); | 266 "ResetProfileSettingsOverlay.setFeedbackInfo", feedback_info); |
267 } | 267 } |
268 | 268 |
269 } // namespace options | 269 } // namespace options |
OLD | NEW |