| 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" |
| 11 #include "google_apis/google_api_keys.h" | 11 #include "google_apis/google_api_keys.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Gaia service constants | 15 // Gaia service constants |
| 16 const char kDefaultGoogleUrl[] = "http://google.com"; | 16 const char kDefaultGoogleUrl[] = "http://google.com"; |
| 17 const char kDefaultGaiaUrl[] = "https://accounts.google.com"; | 17 const char kDefaultGaiaUrl[] = "https://accounts.google.com"; |
| 18 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; | 18 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; |
| 19 | 19 |
| 20 // API calls from accounts.google.com | 20 // API calls from accounts.google.com |
| 21 const char kClientLoginUrlSuffix[] = "ClientLogin"; | 21 const char kClientLoginUrlSuffix[] = "ClientLogin"; |
| 22 const char kServiceLoginUrlSuffix[] = "ServiceLogin"; | 22 const char kServiceLoginUrlSuffix[] = "ServiceLogin"; |
| 23 const char kEmbeddedSetupChromeOsUrlSuffix[] = "embedded/setup/chromeos"; | 23 const char kEmbeddedSetupChromeOsUrlSuffixV1[] = "embedded/setup/chromeos"; |
| 24 const char kEmbeddedSetupChromeOsUrlSuffixV2[] = "embedded/setup/v2/chromeos"; |
| 24 const char kServiceLoginAuthUrlSuffix[] = "ServiceLoginAuth"; | 25 const char kServiceLoginAuthUrlSuffix[] = "ServiceLoginAuth"; |
| 25 const char kServiceLogoutUrlSuffix[] = "Logout"; | 26 const char kServiceLogoutUrlSuffix[] = "Logout"; |
| 26 const char kIssueAuthTokenUrlSuffix[] = "IssueAuthToken"; | 27 const char kIssueAuthTokenUrlSuffix[] = "IssueAuthToken"; |
| 27 const char kGetUserInfoUrlSuffix[] = "GetUserInfo"; | 28 const char kGetUserInfoUrlSuffix[] = "GetUserInfo"; |
| 28 const char kTokenAuthUrlSuffix[] = "TokenAuth"; | 29 const char kTokenAuthUrlSuffix[] = "TokenAuth"; |
| 29 const char kMergeSessionUrlSuffix[] = "MergeSession"; | 30 const char kMergeSessionUrlSuffix[] = "MergeSession"; |
| 30 const char kOAuthGetAccessTokenUrlSuffix[] = "OAuthGetAccessToken"; | 31 const char kOAuthGetAccessTokenUrlSuffix[] = "OAuthGetAccessToken"; |
| 31 const char kOAuthWrapBridgeUrlSuffix[] = "OAuthWrapBridge"; | 32 const char kOAuthWrapBridgeUrlSuffix[] = "OAuthWrapBridge"; |
| 32 const char kOAuth1LoginUrlSuffix[] = "OAuthLogin"; | 33 const char kOAuth1LoginUrlSuffix[] = "OAuthLogin"; |
| 33 const char kOAuthRevokeTokenUrlSuffix[] = "AuthSubRevokeToken"; | 34 const char kOAuthRevokeTokenUrlSuffix[] = "AuthSubRevokeToken"; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 (gaia_url_.has_port() ? ":" + gaia_url_.port() : "")); | 91 (gaia_url_.has_port() ? ":" + gaia_url_.port() : "")); |
| 91 | 92 |
| 92 oauth2_chrome_client_id_ = | 93 oauth2_chrome_client_id_ = |
| 93 google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN); | 94 google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN); |
| 94 oauth2_chrome_client_secret_ = | 95 oauth2_chrome_client_secret_ = |
| 95 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_MAIN); | 96 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_MAIN); |
| 96 | 97 |
| 97 // URLs from accounts.google.com. | 98 // URLs from accounts.google.com. |
| 98 client_login_url_ = gaia_url_.Resolve(kClientLoginUrlSuffix); | 99 client_login_url_ = gaia_url_.Resolve(kClientLoginUrlSuffix); |
| 99 service_login_url_ = gaia_url_.Resolve(kServiceLoginUrlSuffix); | 100 service_login_url_ = gaia_url_.Resolve(kServiceLoginUrlSuffix); |
| 100 embedded_setup_chromeos_url_ = | 101 embedded_setup_chromeos_url_v1_ = |
| 101 gaia_url_.Resolve(kEmbeddedSetupChromeOsUrlSuffix); | 102 gaia_url_.Resolve(kEmbeddedSetupChromeOsUrlSuffixV1); |
| 103 embedded_setup_chromeos_url_v2_ = |
| 104 gaia_url_.Resolve(kEmbeddedSetupChromeOsUrlSuffixV2); |
| 102 service_login_auth_url_ = gaia_url_.Resolve(kServiceLoginAuthUrlSuffix); | 105 service_login_auth_url_ = gaia_url_.Resolve(kServiceLoginAuthUrlSuffix); |
| 103 service_logout_url_ = gaia_url_.Resolve(kServiceLogoutUrlSuffix); | 106 service_logout_url_ = gaia_url_.Resolve(kServiceLogoutUrlSuffix); |
| 104 issue_auth_token_url_ = gaia_url_.Resolve(kIssueAuthTokenUrlSuffix); | 107 issue_auth_token_url_ = gaia_url_.Resolve(kIssueAuthTokenUrlSuffix); |
| 105 get_user_info_url_ = gaia_url_.Resolve(kGetUserInfoUrlSuffix); | 108 get_user_info_url_ = gaia_url_.Resolve(kGetUserInfoUrlSuffix); |
| 106 token_auth_url_ = gaia_url_.Resolve(kTokenAuthUrlSuffix); | 109 token_auth_url_ = gaia_url_.Resolve(kTokenAuthUrlSuffix); |
| 107 merge_session_url_ = gaia_url_.Resolve(kMergeSessionUrlSuffix); | 110 merge_session_url_ = gaia_url_.Resolve(kMergeSessionUrlSuffix); |
| 108 oauth_get_access_token_url_ = | 111 oauth_get_access_token_url_ = |
| 109 gaia_url_.Resolve(kOAuthGetAccessTokenUrlSuffix); | 112 gaia_url_.Resolve(kOAuthGetAccessTokenUrlSuffix); |
| 110 oauth_wrap_bridge_url_ = gaia_url_.Resolve(kOAuthWrapBridgeUrlSuffix); | 113 oauth_wrap_bridge_url_ = gaia_url_.Resolve(kOAuthWrapBridgeUrlSuffix); |
| 111 oauth_revoke_token_url_ = gaia_url_.Resolve(kOAuthRevokeTokenUrlSuffix); | 114 oauth_revoke_token_url_ = gaia_url_.Resolve(kOAuthRevokeTokenUrlSuffix); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 156 } |
| 154 | 157 |
| 155 const GURL& GaiaUrls::client_login_url() const { | 158 const GURL& GaiaUrls::client_login_url() const { |
| 156 return client_login_url_; | 159 return client_login_url_; |
| 157 } | 160 } |
| 158 | 161 |
| 159 const GURL& GaiaUrls::service_login_url() const { | 162 const GURL& GaiaUrls::service_login_url() const { |
| 160 return service_login_url_; | 163 return service_login_url_; |
| 161 } | 164 } |
| 162 | 165 |
| 163 const GURL& GaiaUrls::embedded_setup_chromeos_url() const { | 166 const GURL& GaiaUrls::embedded_setup_chromeos_url(unsigned version) const { |
| 164 return embedded_setup_chromeos_url_; | 167 DCHECK_GT(version, 0U); |
| 168 DCHECK_LE(version, 2U); |
| 169 if (version == 2U) |
| 170 return embedded_setup_chromeos_url_v2_; |
| 171 |
| 172 return embedded_setup_chromeos_url_v1_; |
| 165 } | 173 } |
| 166 | 174 |
| 167 | 175 |
| 168 const GURL& GaiaUrls::service_login_auth_url() const { | 176 const GURL& GaiaUrls::service_login_auth_url() const { |
| 169 return service_login_auth_url_; | 177 return service_login_auth_url_; |
| 170 } | 178 } |
| 171 | 179 |
| 172 const GURL& GaiaUrls::service_logout_url() const { | 180 const GURL& GaiaUrls::service_logout_url() const { |
| 173 return service_logout_url_; | 181 return service_logout_url_; |
| 174 } | 182 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return source.empty() | 291 return source.empty() |
| 284 ? get_check_connection_info_url_ | 292 ? get_check_connection_info_url_ |
| 285 : get_check_connection_info_url_.Resolve( | 293 : get_check_connection_info_url_.Resolve( |
| 286 base::StringPrintf("?source=%s", source.c_str())); | 294 base::StringPrintf("?source=%s", source.c_str())); |
| 287 } | 295 } |
| 288 | 296 |
| 289 GURL GaiaUrls::signin_completed_continue_url() const { | 297 GURL GaiaUrls::signin_completed_continue_url() const { |
| 290 return | 298 return |
| 291 GURL("chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/success.html"); | 299 GURL("chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/success.html"); |
| 292 } | 300 } |
| OLD | NEW |