| 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 "chrome/common/net/gaia/gaia_urls.h" | 5 #include "chrome/common/net/gaia/gaia_urls.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 56 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 57 std::string host_base; | 57 std::string host_base; |
| 58 if (command_line->HasSwitch(switches::kGaiaHost)) { | 58 if (command_line->HasSwitch(switches::kGaiaHost)) { |
| 59 host_base = command_line->GetSwitchValueASCII(switches::kGaiaHost); | 59 host_base = command_line->GetSwitchValueASCII(switches::kGaiaHost); |
| 60 } else { | 60 } else { |
| 61 host_base = kDefaultGaiaBaseUrl; | 61 host_base = kDefaultGaiaBaseUrl; |
| 62 } | 62 } |
| 63 | 63 |
| 64 captcha_url_prefix_ = "http://" + host_base + kCaptchaUrlPrefixSuffix; | 64 captcha_url_prefix_ = "http://" + host_base + kCaptchaUrlPrefixSuffix; |
| 65 gaia_origin_url_ = "https://" + host_base; | 65 gaia_origin_url_ = "https://" + host_base; |
| 66 client_login_url_ = gaia_origin_url_ + kClientLoginUrlSuffix; | 66 std::string gaia_url_base = gaia_origin_url_; |
| 67 service_login_url_ = gaia_origin_url_ + kServiceLoginUrlSuffix; | 67 if (command_line->HasSwitch(switches::kGaiaUrlPath)) { |
| 68 issue_auth_token_url_ = gaia_origin_url_ + kIssueAuthTokenUrlSuffix; | 68 std::string path = |
| 69 get_user_info_url_ = gaia_origin_url_ + kGetUserInfoUrlSuffix; | 69 command_line->GetSwitchValueASCII(switches::kGaiaUrlPath); |
| 70 token_auth_url_ = gaia_origin_url_ + kTokenAuthUrlSuffix; | 70 if (!path.empty()) { |
| 71 merge_session_url_ = gaia_origin_url_ + kMergeSessionUrlSuffix; | 71 if (path[0] != '/') |
| 72 gaia_url_base.append("/"); |
| 73 |
| 74 gaia_url_base.append(path); |
| 75 } |
| 76 } |
| 77 |
| 78 client_login_url_ = gaia_url_base + kClientLoginUrlSuffix; |
| 79 service_login_url_ = gaia_url_base + kServiceLoginUrlSuffix; |
| 80 issue_auth_token_url_ = gaia_url_base + kIssueAuthTokenUrlSuffix; |
| 81 get_user_info_url_ = gaia_url_base + kGetUserInfoUrlSuffix; |
| 82 token_auth_url_ = gaia_url_base + kTokenAuthUrlSuffix; |
| 83 merge_session_url_ = gaia_url_base + kMergeSessionUrlSuffix; |
| 72 | 84 |
| 73 // Federated login is not part of Gaia and has its own endpoints. | 85 // Federated login is not part of Gaia and has its own endpoints. |
| 74 get_oauth_token_url_ = std::string(kDefaultFederatedLoginBaseUrl) + | 86 get_oauth_token_url_ = std::string(kDefaultFederatedLoginBaseUrl) + |
| 75 kGetOAuthTokenUrlSuffix; | 87 kGetOAuthTokenUrlSuffix; |
| 76 | 88 |
| 77 oauth_get_access_token_url_ = gaia_origin_url_ + | 89 oauth_get_access_token_url_ = gaia_url_base + |
| 78 kOAuthGetAccessTokenUrlSuffix; | 90 kOAuthGetAccessTokenUrlSuffix; |
| 79 oauth_wrap_bridge_url_ = gaia_origin_url_ + kOAuthWrapBridgeUrlSuffix; | 91 oauth_wrap_bridge_url_ = gaia_url_base + kOAuthWrapBridgeUrlSuffix; |
| 80 oauth_revoke_token_url_ = gaia_origin_url_ + kOAuthRevokeTokenUrlSuffix; | 92 oauth_revoke_token_url_ = gaia_url_base + kOAuthRevokeTokenUrlSuffix; |
| 81 oauth1_login_url_ = gaia_origin_url_ + kOAuth1LoginUrlSuffix; | 93 oauth1_login_url_ = gaia_url_base + kOAuth1LoginUrlSuffix; |
| 82 | 94 |
| 83 // TODO(joaodasilva): these aren't configurable for now, but are managed here | 95 // TODO(joaodasilva): these aren't configurable for now, but are managed here |
| 84 // so that users of Gaia URLs don't have to use static constants. | 96 // so that users of Gaia URLs don't have to use static constants. |
| 85 // http://crbug.com/97126 | 97 // http://crbug.com/97126 |
| 86 oauth1_login_scope_ = "https://www.google.com/accounts/OAuthLogin"; | 98 oauth1_login_scope_ = "https://www.google.com/accounts/OAuthLogin"; |
| 87 oauth_user_info_url_ = "https://www.googleapis.com/oauth2/v1/userinfo"; | 99 oauth_user_info_url_ = "https://www.googleapis.com/oauth2/v1/userinfo"; |
| 88 oauth_wrap_bridge_user_info_scope_ = | 100 oauth_wrap_bridge_user_info_scope_ = |
| 89 "https://www.googleapis.com/auth/userinfo.email"; | 101 "https://www.googleapis.com/auth/userinfo.email"; |
| 90 client_oauth_url_ = "https://accounts.google.com/ClientOAuth"; | 102 client_oauth_url_ = "https://accounts.google.com/ClientOAuth"; |
| 91 | 103 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 199 } |
| 188 | 200 |
| 189 const std::string& GaiaUrls::oauth2_issue_token_url() { | 201 const std::string& GaiaUrls::oauth2_issue_token_url() { |
| 190 return oauth2_issue_token_url_; | 202 return oauth2_issue_token_url_; |
| 191 } | 203 } |
| 192 | 204 |
| 193 | 205 |
| 194 const std::string& GaiaUrls::gaia_login_form_realm() { | 206 const std::string& GaiaUrls::gaia_login_form_realm() { |
| 195 return gaia_login_form_realm_; | 207 return gaia_login_form_realm_; |
| 196 } | 208 } |
| OLD | NEW |