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

Side by Side Diff: google_apis/gaia/gaia_auth_fetcher.cc

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "google_apis/gaia/gaia_auth_fetcher.h" 5 #include "google_apis/gaia/gaia_auth_fetcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // From the JSON string |data|, extract the |access_token| and |expires_in_secs| 45 // From the JSON string |data|, extract the |access_token| and |expires_in_secs|
46 // both of which must exist. If the |refresh_token| is non-NULL, then it also 46 // both of which must exist. If the |refresh_token| is non-NULL, then it also
47 // must exist and is extraced; if it's NULL, then no extraction is attempted. 47 // must exist and is extraced; if it's NULL, then no extraction is attempted.
48 bool ExtractOAuth2TokenPairResponse(const std::string& data, 48 bool ExtractOAuth2TokenPairResponse(const std::string& data,
49 std::string* refresh_token, 49 std::string* refresh_token,
50 std::string* access_token, 50 std::string* access_token,
51 int* expires_in_secs) { 51 int* expires_in_secs) {
52 DCHECK(access_token); 52 DCHECK(access_token);
53 DCHECK(expires_in_secs); 53 DCHECK(expires_in_secs);
54 54
55 scoped_ptr<base::Value> value = base::JSONReader::Read(data); 55 std::unique_ptr<base::Value> value = base::JSONReader::Read(data);
56 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) 56 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
57 return false; 57 return false;
58 58
59 base::DictionaryValue* dict = 59 base::DictionaryValue* dict =
60 static_cast<base::DictionaryValue*>(value.get()); 60 static_cast<base::DictionaryValue*>(value.get());
61 61
62 if (!dict->GetStringWithoutPathExpansion("access_token", access_token) || 62 if (!dict->GetStringWithoutPathExpansion("access_token", access_token) ||
63 !dict->GetIntegerWithoutPathExpansion("expires_in", expires_in_secs)) { 63 !dict->GetIntegerWithoutPathExpansion("expires_in", expires_in_secs)) {
64 return false; 64 return false;
65 } 65 }
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 } 461 }
462 return false; 462 return false;
463 } 463 }
464 464
465 // static 465 // static
466 bool GaiaAuthFetcher::ParseListIdpSessionsResponse(const std::string& data, 466 bool GaiaAuthFetcher::ParseListIdpSessionsResponse(const std::string& data,
467 std::string* login_hint) { 467 std::string* login_hint) {
468 DCHECK(login_hint); 468 DCHECK(login_hint);
469 469
470 scoped_ptr<base::Value> value = base::JSONReader::Read(data); 470 std::unique_ptr<base::Value> value = base::JSONReader::Read(data);
471 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY) 471 if (!value.get() || value->GetType() != base::Value::TYPE_DICTIONARY)
472 return false; 472 return false;
473 473
474 base::DictionaryValue* dict = 474 base::DictionaryValue* dict =
475 static_cast<base::DictionaryValue*>(value.get()); 475 static_cast<base::DictionaryValue*>(value.get());
476 476
477 base::ListValue* sessionsList; 477 base::ListValue* sessionsList;
478 if (!dict->GetList("sessions", &sessionsList)) 478 if (!dict->GetList("sessions", &sessionsList))
479 return false; 479 return false;
480 480
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 return alleged_error.find(kSecondFactor) != 997 return alleged_error.find(kSecondFactor) !=
998 std::string::npos; 998 std::string::npos;
999 } 999 }
1000 1000
1001 // static 1001 // static
1002 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( 1002 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess(
1003 const std::string& alleged_error) { 1003 const std::string& alleged_error) {
1004 return alleged_error.find(kWebLoginRequired) != 1004 return alleged_error.find(kWebLoginRequired) !=
1005 std::string::npos; 1005 std::string::npos;
1006 } 1006 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698