OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "google_apis/gaia/fake_gaia.h" | 5 #include "google_apis/gaia/fake_gaia.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 if (GetQueryParameter(request.content, "access_token", &access_token)) | 701 if (GetQueryParameter(request.content, "access_token", &access_token)) |
702 token_info = GetAccessTokenInfo(access_token); | 702 token_info = GetAccessTokenInfo(access_token); |
703 | 703 |
704 if (token_info) { | 704 if (token_info) { |
705 base::DictionaryValue response_dict; | 705 base::DictionaryValue response_dict; |
706 response_dict.SetString("issued_to", token_info->issued_to); | 706 response_dict.SetString("issued_to", token_info->issued_to); |
707 response_dict.SetString("audience", token_info->audience); | 707 response_dict.SetString("audience", token_info->audience); |
708 response_dict.SetString("user_id", token_info->user_id); | 708 response_dict.SetString("user_id", token_info->user_id); |
709 std::vector<std::string> scope_vector(token_info->scopes.begin(), | 709 std::vector<std::string> scope_vector(token_info->scopes.begin(), |
710 token_info->scopes.end()); | 710 token_info->scopes.end()); |
711 response_dict.SetString("scope", JoinString(scope_vector, " ")); | 711 response_dict.SetString("scope", base::JoinString(scope_vector, " ")); |
712 response_dict.SetInteger("expires_in", token_info->expires_in); | 712 response_dict.SetInteger("expires_in", token_info->expires_in); |
713 response_dict.SetString("email", token_info->email); | 713 response_dict.SetString("email", token_info->email); |
714 FormatJSONResponse(response_dict, http_response); | 714 FormatJSONResponse(response_dict, http_response); |
715 } else { | 715 } else { |
716 http_response->set_code(net::HTTP_BAD_REQUEST); | 716 http_response->set_code(net::HTTP_BAD_REQUEST); |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
720 void FakeGaia::HandleIssueToken(const HttpRequest& request, | 720 void FakeGaia::HandleIssueToken(const HttpRequest& request, |
721 BasicHttpResponse* http_response) { | 721 BasicHttpResponse* http_response) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 if (token_info) { | 769 if (token_info) { |
770 base::DictionaryValue response_dict; | 770 base::DictionaryValue response_dict; |
771 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); | 771 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); |
772 response_dict.SetString("email", token_info->email); | 772 response_dict.SetString("email", token_info->email); |
773 response_dict.SetString("verified_email", token_info->email); | 773 response_dict.SetString("verified_email", token_info->email); |
774 FormatJSONResponse(response_dict, http_response); | 774 FormatJSONResponse(response_dict, http_response); |
775 } else { | 775 } else { |
776 http_response->set_code(net::HTTP_BAD_REQUEST); | 776 http_response->set_code(net::HTTP_BAD_REQUEST); |
777 } | 777 } |
778 } | 778 } |
OLD | NEW |