OLD | NEW |
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_util.h" | 5 #include "google_apis/gaia/gaia_auth_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "google_apis/gaia/gaia_urls.h" | 16 #include "google_apis/gaia/gaia_urls.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace gaia { | 19 namespace gaia { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 114 |
114 return url == GaiaUrls::GetInstance()->gaia_url(); | 115 return url == GaiaUrls::GetInstance()->gaia_url(); |
115 } | 116 } |
116 | 117 |
117 | 118 |
118 bool ParseListAccountsData( | 119 bool ParseListAccountsData( |
119 const std::string& data, std::vector<ListedAccount>* accounts) { | 120 const std::string& data, std::vector<ListedAccount>* accounts) { |
120 accounts->clear(); | 121 accounts->clear(); |
121 | 122 |
122 // Parse returned data and make sure we have data. | 123 // Parse returned data and make sure we have data. |
123 scoped_ptr<base::Value> value = base::JSONReader::Read(data); | 124 std::unique_ptr<base::Value> value = base::JSONReader::Read(data); |
124 if (!value) | 125 if (!value) |
125 return false; | 126 return false; |
126 | 127 |
127 base::ListValue* list; | 128 base::ListValue* list; |
128 if (!value->GetAsList(&list) || list->GetSize() < 2) | 129 if (!value->GetAsList(&list) || list->GetSize() < 2) |
129 return false; | 130 return false; |
130 | 131 |
131 // Get list of account info. | 132 // Get list of account info. |
132 base::ListValue* account_list; | 133 base::ListValue* account_list; |
133 if (!list->GetList(1, &account_list) || accounts == NULL) | 134 if (!list->GetList(1, &account_list) || accounts == NULL) |
(...skipping 26 matching lines...) Expand all Loading... |
160 accounts->push_back(listed_account); | 161 accounts->push_back(listed_account); |
161 } | 162 } |
162 } | 163 } |
163 } | 164 } |
164 } | 165 } |
165 | 166 |
166 return true; | 167 return true; |
167 } | 168 } |
168 | 169 |
169 } // namespace gaia | 170 } // namespace gaia |
OLD | NEW |