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

Unified Diff: google_apis/gaia/google_service_auth_error.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | gpu/config/gpu_control_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/google_service_auth_error.cc
diff --git a/google_apis/gaia/google_service_auth_error.cc b/google_apis/gaia/google_service_auth_error.cc
index a357005f0cc8beb458662963155d3d65c78a4f20..8c657f0571be4c35d5e847250ee4b9a3845be8da 100644
--- a/google_apis/gaia/google_service_auth_error.cc
+++ b/google_apis/gaia/google_service_auth_error.cc
@@ -5,9 +5,11 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include <string>
+#include <utility>
#include "base/json/json_reader.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -197,23 +199,23 @@ base::DictionaryValue* GoogleServiceAuthError::ToValue() const {
value->SetString("errorMessage", error_message_);
}
if (state_ == CAPTCHA_REQUIRED) {
- base::DictionaryValue* captcha_value = new base::DictionaryValue();
- value->Set("captcha", captcha_value);
+ auto captcha_value = base::MakeUnique<base::DictionaryValue>();
captcha_value->SetString("token", captcha_.token);
captcha_value->SetString("audioUrl", captcha_.audio_url.spec());
captcha_value->SetString("imageUrl", captcha_.image_url.spec());
captcha_value->SetString("unlockUrl", captcha_.unlock_url.spec());
captcha_value->SetInteger("imageWidth", captcha_.image_width);
captcha_value->SetInteger("imageHeight", captcha_.image_height);
+ value->Set("captcha", std::move(captcha_value));
} else if (state_ == CONNECTION_FAILED) {
value->SetString("networkError", net::ErrorToString(network_error_));
} else if (state_ == TWO_FACTOR) {
- base::DictionaryValue* two_factor_value = new base::DictionaryValue();
- value->Set("two_factor", two_factor_value);
+ auto two_factor_value = base::MakeUnique<base::DictionaryValue>();
two_factor_value->SetString("token", second_factor_.token);
two_factor_value->SetString("promptText", second_factor_.prompt_text);
two_factor_value->SetString("alternateText", second_factor_.alternate_text);
two_factor_value->SetInteger("fieldLength", second_factor_.field_length);
+ value->Set("two_factor", std::move(two_factor_value));
}
return value;
}
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | gpu/config/gpu_control_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698