| 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 "google_apis/gaia/gaia_switches.h" | 10 #include "google_apis/gaia/gaia_switches.h" |
| 10 #include "google_apis/google_api_keys.h" | 11 #include "google_apis/google_api_keys.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 // Gaia service constants | 15 // Gaia service constants |
| 15 const char kDefaultGaiaUrl[] = "https://accounts.google.com"; | 16 const char kDefaultGaiaUrl[] = "https://accounts.google.com"; |
| 16 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; | 17 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; |
| 17 | 18 |
| 18 // API calls from accounts.google.com | 19 // API calls from accounts.google.com |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 188 } |
| 188 | 189 |
| 189 const GURL& GaiaUrls::oauth_revoke_token_url() const { | 190 const GURL& GaiaUrls::oauth_revoke_token_url() const { |
| 190 return oauth_revoke_token_url_; | 191 return oauth_revoke_token_url_; |
| 191 } | 192 } |
| 192 | 193 |
| 193 const GURL& GaiaUrls::oauth1_login_url() const { | 194 const GURL& GaiaUrls::oauth1_login_url() const { |
| 194 return oauth1_login_url_; | 195 return oauth1_login_url_; |
| 195 } | 196 } |
| 196 | 197 |
| 197 const GURL& GaiaUrls::list_accounts_url() const { | |
| 198 return list_accounts_url_; | |
| 199 } | |
| 200 | |
| 201 const GURL& GaiaUrls::embedded_signin_url() const { | 198 const GURL& GaiaUrls::embedded_signin_url() const { |
| 202 return embedded_signin_url_; | 199 return embedded_signin_url_; |
| 203 } | 200 } |
| 204 | 201 |
| 205 const GURL& GaiaUrls::add_account_url() const { | 202 const GURL& GaiaUrls::add_account_url() const { |
| 206 return add_account_url_; | 203 return add_account_url_; |
| 207 } | 204 } |
| 208 | 205 |
| 209 const GURL& GaiaUrls::get_check_connection_info_url() const { | |
| 210 return get_check_connection_info_url_; | |
| 211 } | |
| 212 | |
| 213 const std::string& GaiaUrls::oauth2_chrome_client_id() const { | 206 const std::string& GaiaUrls::oauth2_chrome_client_id() const { |
| 214 return oauth2_chrome_client_id_; | 207 return oauth2_chrome_client_id_; |
| 215 } | 208 } |
| 216 | 209 |
| 217 const std::string& GaiaUrls::oauth2_chrome_client_secret() const { | 210 const std::string& GaiaUrls::oauth2_chrome_client_secret() const { |
| 218 return oauth2_chrome_client_secret_; | 211 return oauth2_chrome_client_secret_; |
| 219 } | 212 } |
| 220 | 213 |
| 221 const GURL& GaiaUrls::client_login_to_oauth2_url() const { | 214 const GURL& GaiaUrls::client_login_to_oauth2_url() const { |
| 222 return client_login_to_oauth2_url_; | 215 return client_login_to_oauth2_url_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 238 return oauth2_token_info_url_; | 231 return oauth2_token_info_url_; |
| 239 } | 232 } |
| 240 | 233 |
| 241 const GURL& GaiaUrls::oauth2_revoke_url() const { | 234 const GURL& GaiaUrls::oauth2_revoke_url() const { |
| 242 return oauth2_revoke_url_; | 235 return oauth2_revoke_url_; |
| 243 } | 236 } |
| 244 | 237 |
| 245 const GURL& GaiaUrls::gaia_login_form_realm() const { | 238 const GURL& GaiaUrls::gaia_login_form_realm() const { |
| 246 return gaia_url_; | 239 return gaia_url_; |
| 247 } | 240 } |
| 241 |
| 242 GURL GaiaUrls::ListAccountsURLWithSource(const std::string& source) { |
| 243 if (source.empty()) { |
| 244 return list_accounts_url_; |
| 245 } else { |
| 246 std::string query = list_accounts_url_.query(); |
| 247 return list_accounts_url_.Resolve( |
| 248 base::StringPrintf("?source=%s&%s", source.c_str(), query.c_str())); |
| 249 } |
| 250 } |
| 251 |
| 252 GURL GaiaUrls::GetCheckConnectionInfoURLWithSource(const std::string& source) { |
| 253 return source.empty() |
| 254 ? get_check_connection_info_url_ |
| 255 : get_check_connection_info_url_.Resolve( |
| 256 base::StringPrintf("?source=%s", source.c_str())); |
| 257 } |
| OLD | NEW |