Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: chrome/browser/ui/webui/settings/reset_settings_handler.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 send_settings, request_origin)); 150 send_settings, request_origin));
151 } else { 151 } else {
152 ResetProfile(callback_id, send_settings, request_origin); 152 ResetProfile(callback_id, send_settings, request_origin);
153 } 153 }
154 } 154 }
155 155
156 void ResetSettingsHandler::OnResetProfileSettingsDone( 156 void ResetSettingsHandler::OnResetProfileSettingsDone(
157 std::string callback_id, 157 std::string callback_id,
158 bool send_feedback, 158 bool send_feedback,
159 reset_report::ChromeResetReport::ResetRequestOrigin request_origin) { 159 reset_report::ChromeResetReport::ResetRequestOrigin request_origin) {
160 ResolveJavascriptCallback( 160 ResolveJavascriptCallback(base::Value(callback_id),
161 base::StringValue(callback_id), *base::Value::CreateNullValue()); 161 *base::Value::CreateNullValue());
162 if (send_feedback && setting_snapshot_) { 162 if (send_feedback && setting_snapshot_) {
163 ResettableSettingsSnapshot current_snapshot(profile_); 163 ResettableSettingsSnapshot current_snapshot(profile_);
164 int difference = setting_snapshot_->FindDifferentFields(current_snapshot); 164 int difference = setting_snapshot_->FindDifferentFields(current_snapshot);
165 if (difference) { 165 if (difference) {
166 setting_snapshot_->Subtract(current_snapshot); 166 setting_snapshot_->Subtract(current_snapshot);
167 std::unique_ptr<reset_report::ChromeResetReport> report_proto = 167 std::unique_ptr<reset_report::ChromeResetReport> report_proto =
168 SerializeSettingsReportToProto(*setting_snapshot_, difference); 168 SerializeSettingsReportToProto(*setting_snapshot_, difference);
169 if (report_proto) { 169 if (report_proto) {
170 report_proto->set_reset_request_origin(request_origin); 170 report_proto->set_reset_request_origin(request_origin);
171 SendSettingsFeedbackProto(*report_proto, profile_); 171 SendSettingsFeedbackProto(*report_proto, profile_);
(...skipping 13 matching lines...) Expand all
185 185
186 setting_snapshot_->RequestShortcuts(base::Bind( 186 setting_snapshot_->RequestShortcuts(base::Bind(
187 &ResetSettingsHandler::OnGetReportedSettingsDone, 187 &ResetSettingsHandler::OnGetReportedSettingsDone,
188 weak_ptr_factory_.GetWeakPtr(), 188 weak_ptr_factory_.GetWeakPtr(),
189 callback_id)); 189 callback_id));
190 } 190 }
191 191
192 void ResetSettingsHandler::OnGetReportedSettingsDone(std::string callback_id) { 192 void ResetSettingsHandler::OnGetReportedSettingsDone(std::string callback_id) {
193 std::unique_ptr<base::ListValue> list = 193 std::unique_ptr<base::ListValue> list =
194 GetReadableFeedbackForSnapshot(profile_, *setting_snapshot_); 194 GetReadableFeedbackForSnapshot(profile_, *setting_snapshot_);
195 ResolveJavascriptCallback(base::StringValue(callback_id), *list); 195 ResolveJavascriptCallback(base::Value(callback_id), *list);
196 } 196 }
197 197
198 void ResetSettingsHandler::OnShowResetProfileDialog( 198 void ResetSettingsHandler::OnShowResetProfileDialog(
199 const base::ListValue* args) { 199 const base::ListValue* args) {
200 if (!GetResetter()->IsActive()) { 200 if (!GetResetter()->IsActive()) {
201 setting_snapshot_.reset(new ResettableSettingsSnapshot(profile_)); 201 setting_snapshot_.reset(new ResettableSettingsSnapshot(profile_));
202 } 202 }
203 203
204 if (brandcode_.empty()) 204 if (brandcode_.empty())
205 return; 205 return;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Now that a reset UI has been shown, don't trigger again for this profile. 287 // Now that a reset UI has been shown, don't trigger again for this profile.
288 triggered_profile_resetter->ClearResetTrigger(); 288 triggered_profile_resetter->ClearResetTrigger();
289 } 289 }
290 #endif // defined(OS_WIN) 290 #endif // defined(OS_WIN)
291 291
292 if (reset_tool_name.empty()) { 292 if (reset_tool_name.empty()) {
293 reset_tool_name = l10n_util::GetStringUTF16( 293 reset_tool_name = l10n_util::GetStringUTF16(
294 IDS_TRIGGERED_RESET_PROFILE_SETTINGS_DEFAULT_TOOL_NAME); 294 IDS_TRIGGERED_RESET_PROFILE_SETTINGS_DEFAULT_TOOL_NAME);
295 } 295 }
296 296
297 base::StringValue string_value(reset_tool_name); 297 base::Value string_value(reset_tool_name);
298 ResolveJavascriptCallback(*callback_id, string_value); 298 ResolveJavascriptCallback(*callback_id, string_value);
299 } 299 }
300 300
301 #if defined(OS_CHROMEOS) 301 #if defined(OS_CHROMEOS)
302 void ResetSettingsHandler::OnShowPowerwashDialog( 302 void ResetSettingsHandler::OnShowPowerwashDialog(
303 const base::ListValue* args) { 303 const base::ListValue* args) {
304 UMA_HISTOGRAM_ENUMERATION( 304 UMA_HISTOGRAM_ENUMERATION(
305 "Reset.ChromeOS.PowerwashDialogShown", 305 "Reset.ChromeOS.PowerwashDialogShown",
306 chromeos::reset::DIALOG_FROM_OPTIONS, 306 chromeos::reset::DIALOG_FROM_OPTIONS,
307 chromeos::reset::DIALOG_VIEW_TYPE_SIZE); 307 chromeos::reset::DIALOG_VIEW_TYPE_SIZE);
308 } 308 }
309 #endif // defined(OS_CHROMEOS) 309 #endif // defined(OS_CHROMEOS)
310 310
311 } // namespace settings 311 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698