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_oauth_client.h" | 5 #include "google_apis/gaia/gaia_oauth_client.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/profiler/scoped_profile.h" | 10 #include "base/profiler/scoped_profile.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 int max_retries, | 58 int max_retries, |
59 Delegate* delegate); | 59 Delegate* delegate); |
60 void GetUserInfo(const std::string& oauth_access_token, | 60 void GetUserInfo(const std::string& oauth_access_token, |
61 int max_retries, | 61 int max_retries, |
62 Delegate* delegate); | 62 Delegate* delegate); |
63 void GetTokenInfo(const std::string& oauth_access_token, | 63 void GetTokenInfo(const std::string& oauth_access_token, |
64 int max_retries, | 64 int max_retries, |
65 Delegate* delegate); | 65 Delegate* delegate); |
66 | 66 |
67 // net::URLFetcherDelegate implementation. | 67 // net::URLFetcherDelegate implementation. |
68 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 68 void OnURLFetchComplete(const net::URLFetcher* source) override; |
69 | 69 |
70 private: | 70 private: |
71 friend class base::RefCountedThreadSafe<Core>; | 71 friend class base::RefCountedThreadSafe<Core>; |
72 | 72 |
73 enum RequestType { | 73 enum RequestType { |
74 NO_PENDING_REQUEST, | 74 NO_PENDING_REQUEST, |
75 TOKENS_FROM_AUTH_CODE, | 75 TOKENS_FROM_AUTH_CODE, |
76 REFRESH_TOKEN, | 76 REFRESH_TOKEN, |
77 TOKEN_INFO, | 77 TOKEN_INFO, |
78 USER_EMAIL, | 78 USER_EMAIL, |
79 USER_ID, | 79 USER_ID, |
80 USER_INFO, | 80 USER_INFO, |
81 }; | 81 }; |
82 | 82 |
83 virtual ~Core() {} | 83 ~Core() override {} |
84 | 84 |
85 void GetUserInfoImpl(RequestType type, | 85 void GetUserInfoImpl(RequestType type, |
86 const std::string& oauth_access_token, | 86 const std::string& oauth_access_token, |
87 int max_retries, | 87 int max_retries, |
88 Delegate* delegate); | 88 Delegate* delegate); |
89 void MakeGaiaRequest(const GURL& url, | 89 void MakeGaiaRequest(const GURL& url, |
90 const std::string& post_body, | 90 const std::string& post_body, |
91 int max_retries, | 91 int max_retries, |
92 GaiaOAuthClient::Delegate* delegate); | 92 GaiaOAuthClient::Delegate* delegate); |
93 void HandleResponse(const net::URLFetcher* source, | 93 void HandleResponse(const net::URLFetcher* source, |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 return core_->GetUserInfo(access_token, max_retries, delegate); | 399 return core_->GetUserInfo(access_token, max_retries, delegate); |
400 } | 400 } |
401 | 401 |
402 void GaiaOAuthClient::GetTokenInfo(const std::string& access_token, | 402 void GaiaOAuthClient::GetTokenInfo(const std::string& access_token, |
403 int max_retries, | 403 int max_retries, |
404 Delegate* delegate) { | 404 Delegate* delegate) { |
405 return core_->GetTokenInfo(access_token, max_retries, delegate); | 405 return core_->GetTokenInfo(access_token, max_retries, delegate); |
406 } | 406 } |
407 | 407 |
408 } // namespace gaia | 408 } // namespace gaia |
OLD | NEW |