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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 base::StringPrintf( | 383 base::StringPrintf( |
384 "oauth_code=%s; Path=/o/GetOAuth2Token; Secure; HttpOnly;", | 384 "oauth_code=%s; Path=/o/GetOAuth2Token; Secure; HttpOnly;", |
385 merge_session_params_.auth_code.c_str())); | 385 merge_session_params_.auth_code.c_str())); |
386 http_response->set_code(net::HTTP_OK); | 386 http_response->set_code(net::HTTP_OK); |
387 http_response->set_content_type("text/html"); | 387 http_response->set_content_type("text/html"); |
388 } | 388 } |
389 | 389 |
390 void FakeGaia::FormatJSONResponse(const base::DictionaryValue& response_dict, | 390 void FakeGaia::FormatJSONResponse(const base::DictionaryValue& response_dict, |
391 BasicHttpResponse* http_response) { | 391 BasicHttpResponse* http_response) { |
392 std::string response_json; | 392 std::string response_json; |
393 base::JSONWriter::Write(&response_dict, &response_json); | 393 base::JSONWriter::Write(response_dict, &response_json); |
394 http_response->set_content(response_json); | 394 http_response->set_content(response_json); |
395 http_response->set_code(net::HTTP_OK); | 395 http_response->set_code(net::HTTP_OK); |
396 } | 396 } |
397 | 397 |
398 const FakeGaia::AccessTokenInfo* FakeGaia::FindAccessTokenInfo( | 398 const FakeGaia::AccessTokenInfo* FakeGaia::FindAccessTokenInfo( |
399 const std::string& auth_token, | 399 const std::string& auth_token, |
400 const std::string& client_id, | 400 const std::string& client_id, |
401 const std::string& scope_string) const { | 401 const std::string& scope_string) const { |
402 if (auth_token.empty() || client_id.empty()) | 402 if (auth_token.empty() || client_id.empty()) |
403 return NULL; | 403 return NULL; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 if (token_info) { | 712 if (token_info) { |
713 base::DictionaryValue response_dict; | 713 base::DictionaryValue response_dict; |
714 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); | 714 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); |
715 response_dict.SetString("email", token_info->email); | 715 response_dict.SetString("email", token_info->email); |
716 response_dict.SetString("verified_email", token_info->email); | 716 response_dict.SetString("verified_email", token_info->email); |
717 FormatJSONResponse(response_dict, http_response); | 717 FormatJSONResponse(response_dict, http_response); |
718 } else { | 718 } else { |
719 http_response->set_code(net::HTTP_BAD_REQUEST); | 719 http_response->set_code(net::HTTP_BAD_REQUEST); |
720 } | 720 } |
721 } | 721 } |
OLD | NEW |