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