| 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> | 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
| 29 #include "content/public/browser/web_ui.h" | 29 #include "content/public/browser/web_ui.h" |
| 30 #include "content/public/browser/web_ui_data_source.h" | 30 #include "content/public/browser/web_ui_data_source.h" |
| 31 | 31 |
| 32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 34 #include "chrome/browser/browser_process_platform_part.h" | 34 #include "chrome/browser/browser_process_platform_part.h" |
| 35 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 35 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 36 #include "chrome/browser/chromeos/reset/metrics.h" | 36 #include "chrome/browser/chromeos/reset/metrics.h" |
| 37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 38 #include "components/prefs/pref_service.h" | |
| 39 #include "components/user_manager/user_manager.h" | 38 #include "components/user_manager/user_manager.h" |
| 40 #endif // defined(OS_CHROMEOS) | 39 #endif // defined(OS_CHROMEOS) |
| 41 | 40 |
| 42 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 43 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" | 42 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" |
| 44 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" | 43 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" |
| 45 #endif // defined(OS_WIN) | 44 #endif // defined(OS_WIN) |
| 46 | 45 |
| 47 namespace settings { | 46 namespace settings { |
| 48 | 47 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 std::string callback_id, bool send_feedback) { | 127 std::string callback_id, bool send_feedback) { |
| 129 ResolveJavascriptCallback( | 128 ResolveJavascriptCallback( |
| 130 base::StringValue(callback_id), *base::Value::CreateNullValue()); | 129 base::StringValue(callback_id), *base::Value::CreateNullValue()); |
| 131 if (send_feedback && setting_snapshot_) { | 130 if (send_feedback && setting_snapshot_) { |
| 132 ResettableSettingsSnapshot current_snapshot(profile_); | 131 ResettableSettingsSnapshot current_snapshot(profile_); |
| 133 int difference = setting_snapshot_->FindDifferentFields(current_snapshot); | 132 int difference = setting_snapshot_->FindDifferentFields(current_snapshot); |
| 134 if (difference) { | 133 if (difference) { |
| 135 setting_snapshot_->Subtract(current_snapshot); | 134 setting_snapshot_->Subtract(current_snapshot); |
| 136 std::unique_ptr<reset_report::ChromeResetReport> report_proto = | 135 std::unique_ptr<reset_report::ChromeResetReport> report_proto = |
| 137 SerializeSettingsReportToProto(*setting_snapshot_, difference); | 136 SerializeSettingsReportToProto(*setting_snapshot_, difference); |
| 138 if (report_proto) | 137 if (report_proto) { |
| 138 // The material design version of the settings page currently does not |
| 139 // expose the alternative ways, made available by the old settings page, |
| 140 // to get to the reset settings dialog. Until those are available, we |
| 141 // can assume that all reset requests came directly from user |
| 142 // navigation. |
| 143 report_proto->set_reset_request_origin( |
| 144 reset_report::ChromeResetReport::RESET_REQUEST_ORIGIN_USER_CLICK); |
| 139 SendSettingsFeedbackProto(*report_proto, profile_); | 145 SendSettingsFeedbackProto(*report_proto, profile_); |
| 146 } |
| 140 } | 147 } |
| 141 } | 148 } |
| 142 setting_snapshot_.reset(); | 149 setting_snapshot_.reset(); |
| 143 } | 150 } |
| 144 | 151 |
| 145 void ResetSettingsHandler::HandleGetReportedSettings( | 152 void ResetSettingsHandler::HandleGetReportedSettings( |
| 146 const base::ListValue* args) { | 153 const base::ListValue* args) { |
| 147 AllowJavascript(); | 154 AllowJavascript(); |
| 148 | 155 |
| 149 CHECK_EQ(1U, args->GetSize()); | 156 CHECK_EQ(1U, args->GetSize()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void ResetSettingsHandler::OnShowPowerwashDialog( | 239 void ResetSettingsHandler::OnShowPowerwashDialog( |
| 233 const base::ListValue* args) { | 240 const base::ListValue* args) { |
| 234 UMA_HISTOGRAM_ENUMERATION( | 241 UMA_HISTOGRAM_ENUMERATION( |
| 235 "Reset.ChromeOS.PowerwashDialogShown", | 242 "Reset.ChromeOS.PowerwashDialogShown", |
| 236 chromeos::reset::DIALOG_FROM_OPTIONS, | 243 chromeos::reset::DIALOG_FROM_OPTIONS, |
| 237 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 244 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
| 238 } | 245 } |
| 239 #endif // defined(OS_CHROMEOS) | 246 #endif // defined(OS_CHROMEOS) |
| 240 | 247 |
| 241 } // namespace settings | 248 } // namespace settings |
| OLD | NEW |