| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 base::Unretained(this))); | 107 base::Unretained(this))); |
| 108 web_ui()->RegisterMessageCallback( | 108 web_ui()->RegisterMessageCallback( |
| 109 "requestFactoryResetRestart", | 109 "requestFactoryResetRestart", |
| 110 base::Bind(&ResetSettingsHandler::HandleFactoryResetRestart, | 110 base::Bind(&ResetSettingsHandler::HandleFactoryResetRestart, |
| 111 base::Unretained(this))); | 111 base::Unretained(this))); |
| 112 #endif // defined(OS_CHROMEOS) | 112 #endif // defined(OS_CHROMEOS) |
| 113 } | 113 } |
| 114 | 114 |
| 115 void ResetSettingsHandler::HandleResetProfileSettings( | 115 void ResetSettingsHandler::HandleResetProfileSettings( |
| 116 const base::ListValue* args) { | 116 const base::ListValue* args) { |
| 117 AllowJavascript(); |
| 118 |
| 117 CHECK_EQ(2U, args->GetSize()); | 119 CHECK_EQ(2U, args->GetSize()); |
| 118 std::string callback_id; | 120 std::string callback_id; |
| 119 CHECK(args->GetString(0, &callback_id)); | 121 CHECK(args->GetString(0, &callback_id)); |
| 120 bool send_settings = false; | 122 bool send_settings = false; |
| 121 CHECK(args->GetBoolean(1, &send_settings)); | 123 CHECK(args->GetBoolean(1, &send_settings)); |
| 122 | 124 |
| 123 DCHECK(brandcode_.empty() || config_fetcher_); | 125 DCHECK(brandcode_.empty() || config_fetcher_); |
| 124 if (config_fetcher_ && config_fetcher_->IsActive()) { | 126 if (config_fetcher_ && config_fetcher_->IsActive()) { |
| 125 // Reset once the prefs are fetched. | 127 // Reset once the prefs are fetched. |
| 126 config_fetcher_->SetCallback( | 128 config_fetcher_->SetCallback( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 146 SerializeSettingsReportToProto(*setting_snapshot_, difference); | 148 SerializeSettingsReportToProto(*setting_snapshot_, difference); |
| 147 if (report_proto) | 149 if (report_proto) |
| 148 SendSettingsFeedbackProto(*report_proto, profile_); | 150 SendSettingsFeedbackProto(*report_proto, profile_); |
| 149 } | 151 } |
| 150 } | 152 } |
| 151 setting_snapshot_.reset(); | 153 setting_snapshot_.reset(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 void ResetSettingsHandler::HandleGetReportedSettings( | 156 void ResetSettingsHandler::HandleGetReportedSettings( |
| 155 const base::ListValue* args) { | 157 const base::ListValue* args) { |
| 158 AllowJavascript(); |
| 159 |
| 156 CHECK_EQ(1U, args->GetSize()); | 160 CHECK_EQ(1U, args->GetSize()); |
| 157 std::string callback_id; | 161 std::string callback_id; |
| 158 CHECK(args->GetString(0, &callback_id)); | 162 CHECK(args->GetString(0, &callback_id)); |
| 159 | 163 |
| 160 setting_snapshot_->RequestShortcuts(base::Bind( | 164 setting_snapshot_->RequestShortcuts(base::Bind( |
| 161 &ResetSettingsHandler::OnGetReportedSettingsDone, | 165 &ResetSettingsHandler::OnGetReportedSettingsDone, |
| 162 weak_ptr_factory_.GetWeakPtr(), | 166 weak_ptr_factory_.GetWeakPtr(), |
| 163 callback_id)); | 167 callback_id)); |
| 164 } | 168 } |
| 165 | 169 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 prefs->SetBoolean(prefs::kFactoryResetRequested, true); | 257 prefs->SetBoolean(prefs::kFactoryResetRequested, true); |
| 254 prefs->CommitPendingWrite(); | 258 prefs->CommitPendingWrite(); |
| 255 | 259 |
| 256 // Perform sign out. Current chrome process will then terminate, new one will | 260 // Perform sign out. Current chrome process will then terminate, new one will |
| 257 // be launched (as if it was a restart). | 261 // be launched (as if it was a restart). |
| 258 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 262 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 259 } | 263 } |
| 260 #endif // defined(OS_CHROMEOS) | 264 #endif // defined(OS_CHROMEOS) |
| 261 | 265 |
| 262 } // namespace settings | 266 } // namespace settings |
| OLD | NEW |