| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 std::string callback_id, bool send_feedback) { | 125 std::string callback_id, bool send_feedback) { |
| 126 ResolveJavascriptCallback( | 126 ResolveJavascriptCallback( |
| 127 base::StringValue(callback_id), *base::Value::CreateNullValue()); | 127 base::StringValue(callback_id), *base::Value::CreateNullValue()); |
| 128 if (send_feedback && setting_snapshot_) { | 128 if (send_feedback && setting_snapshot_) { |
| 129 ResettableSettingsSnapshot current_snapshot(profile_); | 129 ResettableSettingsSnapshot current_snapshot(profile_); |
| 130 int difference = setting_snapshot_->FindDifferentFields(current_snapshot); | 130 int difference = setting_snapshot_->FindDifferentFields(current_snapshot); |
| 131 if (difference) { | 131 if (difference) { |
| 132 setting_snapshot_->Subtract(current_snapshot); | 132 setting_snapshot_->Subtract(current_snapshot); |
| 133 std::unique_ptr<reset_report::ChromeResetReport> report_proto = | 133 std::unique_ptr<reset_report::ChromeResetReport> report_proto = |
| 134 SerializeSettingsReportToProto(*setting_snapshot_, difference); | 134 SerializeSettingsReportToProto(*setting_snapshot_, difference); |
| 135 if (report_proto) | 135 if (report_proto) { |
| 136 // The material design version of the settings page currently does not |
| 137 // expose the alternative ways, made available by the old settings page, |
| 138 // to get to the reset settings dialog. Until those are available, we |
| 139 // can assume that all reset requests came directly from user |
| 140 // navigation. |
| 141 report_proto->set_reset_request_origin( |
| 142 reset_report::ChromeResetReport::RESET_REQUEST_ORIGIN_USER_CLICK); |
| 136 SendSettingsFeedbackProto(*report_proto, profile_); | 143 SendSettingsFeedbackProto(*report_proto, profile_); |
| 144 } |
| 137 } | 145 } |
| 138 } | 146 } |
| 139 setting_snapshot_.reset(); | 147 setting_snapshot_.reset(); |
| 140 } | 148 } |
| 141 | 149 |
| 142 void ResetSettingsHandler::HandleGetReportedSettings( | 150 void ResetSettingsHandler::HandleGetReportedSettings( |
| 143 const base::ListValue* args) { | 151 const base::ListValue* args) { |
| 144 AllowJavascript(); | 152 AllowJavascript(); |
| 145 | 153 |
| 146 CHECK_EQ(1U, args->GetSize()); | 154 CHECK_EQ(1U, args->GetSize()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void ResetSettingsHandler::OnShowPowerwashDialog( | 237 void ResetSettingsHandler::OnShowPowerwashDialog( |
| 230 const base::ListValue* args) { | 238 const base::ListValue* args) { |
| 231 UMA_HISTOGRAM_ENUMERATION( | 239 UMA_HISTOGRAM_ENUMERATION( |
| 232 "Reset.ChromeOS.PowerwashDialogShown", | 240 "Reset.ChromeOS.PowerwashDialogShown", |
| 233 chromeos::reset::DIALOG_FROM_OPTIONS, | 241 chromeos::reset::DIALOG_FROM_OPTIONS, |
| 234 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); | 242 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); |
| 235 } | 243 } |
| 236 #endif // defined(OS_CHROMEOS) | 244 #endif // defined(OS_CHROMEOS) |
| 237 | 245 |
| 238 } // namespace settings | 246 } // namespace settings |
| OLD | NEW |