| 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 "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "google_apis/gaia/gaia_switches.h" | 10 #include "google_apis/gaia/gaia_switches.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 const char kEmbeddedSigninSuffix[] = "EmbeddedSignIn"; | 33 const char kEmbeddedSigninSuffix[] = "EmbeddedSignIn"; |
| 34 const char kAddAccountSuffix[] = "AddSession"; | 34 const char kAddAccountSuffix[] = "AddSession"; |
| 35 const char kGetCheckConnectionInfoSuffix[] = "GetCheckConnectionInfo"; | 35 const char kGetCheckConnectionInfoSuffix[] = "GetCheckConnectionInfo"; |
| 36 | 36 |
| 37 // API calls from accounts.google.com (LSO) | 37 // API calls from accounts.google.com (LSO) |
| 38 const char kGetOAuthTokenUrlSuffix[] = "o/oauth/GetOAuthToken/"; | 38 const char kGetOAuthTokenUrlSuffix[] = "o/oauth/GetOAuthToken/"; |
| 39 const char kClientLoginToOAuth2UrlSuffix[] = "o/oauth2/programmatic_auth"; | 39 const char kClientLoginToOAuth2UrlSuffix[] = "o/oauth2/programmatic_auth"; |
| 40 const char kOAuth2AuthUrlSuffix[] = "o/oauth2/auth"; | 40 const char kOAuth2AuthUrlSuffix[] = "o/oauth2/auth"; |
| 41 const char kOAuth2RevokeUrlSuffix[] = "o/oauth2/revoke"; | 41 const char kOAuth2RevokeUrlSuffix[] = "o/oauth2/revoke"; |
| 42 const char kOAuth2TokenUrlSuffix[] = "o/oauth2/token"; | 42 const char kOAuth2TokenUrlSuffix[] = "o/oauth2/token"; |
| 43 const char kOAuth2IFrameUrlSuffix[] = "o/oauth2/iframerpc"; |
| 43 | 44 |
| 44 // API calls from www.googleapis.com | 45 // API calls from www.googleapis.com |
| 45 const char kOAuth2IssueTokenUrlSuffix[] = "oauth2/v2/IssueToken"; | 46 const char kOAuth2IssueTokenUrlSuffix[] = "oauth2/v2/IssueToken"; |
| 46 const char kOAuth2TokenInfoUrlSuffix[] = "oauth2/v2/tokeninfo"; | 47 const char kOAuth2TokenInfoUrlSuffix[] = "oauth2/v2/tokeninfo"; |
| 47 const char kOAuthUserInfoUrlSuffix[] = "oauth2/v1/userinfo"; | 48 const char kOAuthUserInfoUrlSuffix[] = "oauth2/v1/userinfo"; |
| 48 | 49 |
| 49 void GetSwitchValueWithDefault(const char* switch_value, | 50 void GetSwitchValueWithDefault(const char* switch_value, |
| 50 const char* default_value, | 51 const char* default_value, |
| 51 std::string* output_value) { | 52 std::string* output_value) { |
| 52 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 53 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 get_check_connection_info_url_ = | 110 get_check_connection_info_url_ = |
| 110 gaia_url_.Resolve(kGetCheckConnectionInfoSuffix); | 111 gaia_url_.Resolve(kGetCheckConnectionInfoSuffix); |
| 111 | 112 |
| 112 // URLs from accounts.google.com (LSO). | 113 // URLs from accounts.google.com (LSO). |
| 113 get_oauth_token_url_ = lso_origin_url_.Resolve(kGetOAuthTokenUrlSuffix); | 114 get_oauth_token_url_ = lso_origin_url_.Resolve(kGetOAuthTokenUrlSuffix); |
| 114 client_login_to_oauth2_url_ = | 115 client_login_to_oauth2_url_ = |
| 115 lso_origin_url_.Resolve(kClientLoginToOAuth2UrlSuffix); | 116 lso_origin_url_.Resolve(kClientLoginToOAuth2UrlSuffix); |
| 116 oauth2_auth_url_ = lso_origin_url_.Resolve(kOAuth2AuthUrlSuffix); | 117 oauth2_auth_url_ = lso_origin_url_.Resolve(kOAuth2AuthUrlSuffix); |
| 117 oauth2_token_url_ = lso_origin_url_.Resolve(kOAuth2TokenUrlSuffix); | 118 oauth2_token_url_ = lso_origin_url_.Resolve(kOAuth2TokenUrlSuffix); |
| 118 oauth2_revoke_url_ = lso_origin_url_.Resolve(kOAuth2RevokeUrlSuffix); | 119 oauth2_revoke_url_ = lso_origin_url_.Resolve(kOAuth2RevokeUrlSuffix); |
| 120 oauth2_iframe_url_ = |
| 121 lso_origin_url_.Resolve(kOAuth2IFrameUrlSuffix); |
| 119 | 122 |
| 120 // URLs from www.googleapis.com. | 123 // URLs from www.googleapis.com. |
| 121 oauth2_issue_token_url_ = | 124 oauth2_issue_token_url_ = |
| 122 google_apis_origin_url_.Resolve(kOAuth2IssueTokenUrlSuffix); | 125 google_apis_origin_url_.Resolve(kOAuth2IssueTokenUrlSuffix); |
| 123 oauth2_token_info_url_ = | 126 oauth2_token_info_url_ = |
| 124 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); | 127 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); |
| 125 oauth_user_info_url_ = | 128 oauth_user_info_url_ = |
| 126 google_apis_origin_url_.Resolve(kOAuthUserInfoUrlSuffix); | 129 google_apis_origin_url_.Resolve(kOAuthUserInfoUrlSuffix); |
| 127 | 130 |
| 128 gaia_login_form_realm_ = gaia_url_; | 131 gaia_login_form_realm_ = gaia_url_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 187 } |
| 185 | 188 |
| 186 const GURL& GaiaUrls::oauth_user_info_url() const { | 189 const GURL& GaiaUrls::oauth_user_info_url() const { |
| 187 return oauth_user_info_url_; | 190 return oauth_user_info_url_; |
| 188 } | 191 } |
| 189 | 192 |
| 190 const GURL& GaiaUrls::oauth_revoke_token_url() const { | 193 const GURL& GaiaUrls::oauth_revoke_token_url() const { |
| 191 return oauth_revoke_token_url_; | 194 return oauth_revoke_token_url_; |
| 192 } | 195 } |
| 193 | 196 |
| 197 const GURL& GaiaUrls::oauth2_iframe_url() const { |
| 198 return oauth2_iframe_url_; |
| 199 } |
| 200 |
| 194 const GURL& GaiaUrls::oauth1_login_url() const { | 201 const GURL& GaiaUrls::oauth1_login_url() const { |
| 195 return oauth1_login_url_; | 202 return oauth1_login_url_; |
| 196 } | 203 } |
| 197 | 204 |
| 198 const GURL& GaiaUrls::embedded_signin_url() const { | 205 const GURL& GaiaUrls::embedded_signin_url() const { |
| 199 return embedded_signin_url_; | 206 return embedded_signin_url_; |
| 200 } | 207 } |
| 201 | 208 |
| 202 const GURL& GaiaUrls::add_account_url() const { | 209 const GURL& GaiaUrls::add_account_url() const { |
| 203 return add_account_url_; | 210 return add_account_url_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 base::StringPrintf("?source=%s&%s", source.c_str(), query.c_str())); | 255 base::StringPrintf("?source=%s&%s", source.c_str(), query.c_str())); |
| 249 } | 256 } |
| 250 } | 257 } |
| 251 | 258 |
| 252 GURL GaiaUrls::GetCheckConnectionInfoURLWithSource(const std::string& source) { | 259 GURL GaiaUrls::GetCheckConnectionInfoURLWithSource(const std::string& source) { |
| 253 return source.empty() | 260 return source.empty() |
| 254 ? get_check_connection_info_url_ | 261 ? get_check_connection_info_url_ |
| 255 : get_check_connection_info_url_.Resolve( | 262 : get_check_connection_info_url_.Resolve( |
| 256 base::StringPrintf("?source=%s", source.c_str())); | 263 base::StringPrintf("?source=%s", source.c_str())); |
| 257 } | 264 } |
| OLD | NEW |