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_urls.h" | 5 #include "google_apis/gaia/gaia_urls.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "google_apis/gaia/gaia_switches.h" | 9 #include "google_apis/gaia/gaia_switches.h" |
10 #include "google_apis/google_api_keys.h" | 10 #include "google_apis/google_api_keys.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // API calls from accounts.google.com (LSO) | 35 // API calls from accounts.google.com (LSO) |
36 const char kGetOAuthTokenUrlSuffix[] = "o/oauth/GetOAuthToken/"; | 36 const char kGetOAuthTokenUrlSuffix[] = "o/oauth/GetOAuthToken/"; |
37 const char kClientLoginToOAuth2UrlSuffix[] = "o/oauth2/programmatic_auth"; | 37 const char kClientLoginToOAuth2UrlSuffix[] = "o/oauth2/programmatic_auth"; |
38 const char kOAuth2AuthUrlSuffix[] = "o/oauth2/auth"; | 38 const char kOAuth2AuthUrlSuffix[] = "o/oauth2/auth"; |
39 const char kOAuth2RevokeUrlSuffix[] = "o/oauth2/revoke"; | 39 const char kOAuth2RevokeUrlSuffix[] = "o/oauth2/revoke"; |
40 const char kOAuth2TokenUrlSuffix[] = "o/oauth2/token"; | 40 const char kOAuth2TokenUrlSuffix[] = "o/oauth2/token"; |
41 | 41 |
42 // API calls from www.googleapis.com | 42 // API calls from www.googleapis.com |
43 const char kOAuth2IssueTokenUrlSuffix[] = "oauth2/v2/IssueToken"; | 43 const char kOAuth2IssueTokenUrlSuffix[] = "oauth2/v2/IssueToken"; |
44 const char kOAuth2TokenInfoUrlSuffix[] = "oauth2/v2/tokeninfo"; | 44 const char kOAuth2TokenInfoUrlSuffix[] = "oauth2/v2/tokeninfo"; |
45 const char kOAuthUserInfoUrlSuffix[] = "oauth2/v1/userinfo"; | 45 const char kPeopleGetUrlSuffix[] = "plus/v1/people/me"; |
46 | 46 |
47 void GetSwitchValueWithDefault(const char* switch_value, | 47 void GetSwitchValueWithDefault(const char* switch_value, |
48 const char* default_value, | 48 const char* default_value, |
49 std::string* output_value) { | 49 std::string* output_value) { |
50 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 50 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
51 if (command_line->HasSwitch(switch_value)) { | 51 if (command_line->HasSwitch(switch_value)) { |
52 *output_value = command_line->GetSwitchValueASCII(switch_value); | 52 *output_value = command_line->GetSwitchValueASCII(switch_value); |
53 } else { | 53 } else { |
54 *output_value = default_value; | 54 *output_value = default_value; |
55 } | 55 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 lso_origin_url_.Resolve(kClientLoginToOAuth2UrlSuffix); | 111 lso_origin_url_.Resolve(kClientLoginToOAuth2UrlSuffix); |
112 oauth2_auth_url_ = lso_origin_url_.Resolve(kOAuth2AuthUrlSuffix); | 112 oauth2_auth_url_ = lso_origin_url_.Resolve(kOAuth2AuthUrlSuffix); |
113 oauth2_token_url_ = lso_origin_url_.Resolve(kOAuth2TokenUrlSuffix); | 113 oauth2_token_url_ = lso_origin_url_.Resolve(kOAuth2TokenUrlSuffix); |
114 oauth2_revoke_url_ = lso_origin_url_.Resolve(kOAuth2RevokeUrlSuffix); | 114 oauth2_revoke_url_ = lso_origin_url_.Resolve(kOAuth2RevokeUrlSuffix); |
115 | 115 |
116 // URLs from www.googleapis.com. | 116 // URLs from www.googleapis.com. |
117 oauth2_issue_token_url_ = | 117 oauth2_issue_token_url_ = |
118 google_apis_origin_url_.Resolve(kOAuth2IssueTokenUrlSuffix); | 118 google_apis_origin_url_.Resolve(kOAuth2IssueTokenUrlSuffix); |
119 oauth2_token_info_url_ = | 119 oauth2_token_info_url_ = |
120 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); | 120 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); |
121 oauth_user_info_url_ = | 121 people_get_url_ = |
122 google_apis_origin_url_.Resolve(kOAuthUserInfoUrlSuffix); | 122 google_apis_origin_url_.Resolve(kPeopleGetUrlSuffix); |
123 | 123 |
124 gaia_login_form_realm_ = gaia_url_; | 124 gaia_login_form_realm_ = gaia_url_; |
125 } | 125 } |
126 | 126 |
127 GaiaUrls::~GaiaUrls() { | 127 GaiaUrls::~GaiaUrls() { |
128 } | 128 } |
129 | 129 |
130 const GURL& GaiaUrls::gaia_url() const { | 130 const GURL& GaiaUrls::gaia_url() const { |
131 return gaia_url_; | 131 return gaia_url_; |
132 } | 132 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 const GURL& GaiaUrls::oauth_get_access_token_url() const { | 174 const GURL& GaiaUrls::oauth_get_access_token_url() const { |
175 return oauth_get_access_token_url_; | 175 return oauth_get_access_token_url_; |
176 } | 176 } |
177 | 177 |
178 const GURL& GaiaUrls::oauth_wrap_bridge_url() const { | 178 const GURL& GaiaUrls::oauth_wrap_bridge_url() const { |
179 return oauth_wrap_bridge_url_; | 179 return oauth_wrap_bridge_url_; |
180 } | 180 } |
181 | 181 |
182 const GURL& GaiaUrls::oauth_user_info_url() const { | 182 const GURL& GaiaUrls::people_get_url() const { |
183 return oauth_user_info_url_; | 183 return people_get_url_; |
184 } | 184 } |
185 | 185 |
186 const GURL& GaiaUrls::oauth_revoke_token_url() const { | 186 const GURL& GaiaUrls::oauth_revoke_token_url() const { |
187 return oauth_revoke_token_url_; | 187 return oauth_revoke_token_url_; |
188 } | 188 } |
189 | 189 |
190 const GURL& GaiaUrls::oauth1_login_url() const { | 190 const GURL& GaiaUrls::oauth1_login_url() const { |
191 return oauth1_login_url_; | 191 return oauth1_login_url_; |
192 } | 192 } |
193 | 193 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return oauth2_token_info_url_; | 231 return oauth2_token_info_url_; |
232 } | 232 } |
233 | 233 |
234 const GURL& GaiaUrls::oauth2_revoke_url() const { | 234 const GURL& GaiaUrls::oauth2_revoke_url() const { |
235 return oauth2_revoke_url_; | 235 return oauth2_revoke_url_; |
236 } | 236 } |
237 | 237 |
238 const GURL& GaiaUrls::gaia_login_form_realm() const { | 238 const GURL& GaiaUrls::gaia_login_form_realm() const { |
239 return gaia_url_; | 239 return gaia_url_; |
240 } | 240 } |
OLD | NEW |