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 "google_apis/gaia/gaia_switches.h" | 8 #include "google_apis/gaia/gaia_switches.h" |
9 #include "google_apis/google_api_keys.h" | 9 #include "google_apis/google_api_keys.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 const char kGetOAuthTokenUrlSuffix[] = "/o/oauth/GetOAuthToken/"; | 31 const char kGetOAuthTokenUrlSuffix[] = "/o/oauth/GetOAuthToken/"; |
32 | 32 |
33 const char kClientLoginToOAuth2Url[] = | 33 const char kClientLoginToOAuth2Url[] = |
34 "https://accounts.google.com/o/oauth2/programmatic_auth"; | 34 "https://accounts.google.com/o/oauth2/programmatic_auth"; |
35 const char kOAuth2TokenUrl[] = | 35 const char kOAuth2TokenUrl[] = |
36 "https://accounts.google.com/o/oauth2/token"; | 36 "https://accounts.google.com/o/oauth2/token"; |
37 const char kOAuth2IssueTokenUrl[] = | 37 const char kOAuth2IssueTokenUrl[] = |
38 "https://www.googleapis.com/oauth2/v2/IssueToken"; | 38 "https://www.googleapis.com/oauth2/v2/IssueToken"; |
39 const char kOAuth1LoginScope[] = | 39 const char kOAuth1LoginScope[] = |
40 "https://www.google.com/accounts/OAuthLogin"; | 40 "https://www.google.com/accounts/OAuthLogin"; |
| 41 const char kOAuthUserInfoUrl[] = |
| 42 "https://www.googleapis.com/oauth2/v1/userinfo"; |
| 43 |
41 | 44 |
42 void GetSwitchValueWithDefault(const char* switch_value, | 45 void GetSwitchValueWithDefault(const char* switch_value, |
43 const char* default_value, | 46 const char* default_value, |
44 std::string* output_value) { | 47 std::string* output_value) { |
45 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 48 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
46 if (command_line->HasSwitch(switch_value)) { | 49 if (command_line->HasSwitch(switch_value)) { |
47 *output_value = command_line->GetSwitchValueASCII(switch_value); | 50 *output_value = command_line->GetSwitchValueASCII(switch_value); |
48 } else { | 51 } else { |
49 *output_value = default_value; | 52 *output_value = default_value; |
50 } | 53 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 oauth_revoke_token_url_ = gaia_url_base + kOAuthRevokeTokenUrlSuffix; | 92 oauth_revoke_token_url_ = gaia_url_base + kOAuthRevokeTokenUrlSuffix; |
90 oauth1_login_url_ = gaia_url_base + kOAuth1LoginUrlSuffix; | 93 oauth1_login_url_ = gaia_url_base + kOAuth1LoginUrlSuffix; |
91 | 94 |
92 GetSwitchValueWithDefault(switches::kOAuth1LoginScope, | 95 GetSwitchValueWithDefault(switches::kOAuth1LoginScope, |
93 kOAuth1LoginScope, | 96 kOAuth1LoginScope, |
94 &oauth1_login_scope_); | 97 &oauth1_login_scope_); |
95 | 98 |
96 // TODO(joaodasilva): these aren't configurable for now, but are managed here | 99 // TODO(joaodasilva): these aren't configurable for now, but are managed here |
97 // so that users of Gaia URLs don't have to use static constants. | 100 // so that users of Gaia URLs don't have to use static constants. |
98 // http://crbug.com/97126 | 101 // http://crbug.com/97126 |
99 oauth_user_info_url_ = "https://www.googleapis.com/oauth2/v1/userinfo"; | |
100 oauth_wrap_bridge_user_info_scope_ = | 102 oauth_wrap_bridge_user_info_scope_ = |
101 "https://www.googleapis.com/auth/userinfo.email"; | 103 "https://www.googleapis.com/auth/userinfo.email"; |
102 client_oauth_url_ = "https://accounts.google.com/ClientOAuth"; | 104 client_oauth_url_ = "https://accounts.google.com/ClientOAuth"; |
103 | 105 |
104 oauth2_chrome_client_id_ = | 106 oauth2_chrome_client_id_ = |
105 google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN); | 107 google_apis::GetOAuth2ClientID(google_apis::CLIENT_MAIN); |
106 oauth2_chrome_client_secret_ = | 108 oauth2_chrome_client_secret_ = |
107 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_MAIN); | 109 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_MAIN); |
108 | 110 |
109 GetSwitchValueWithDefault(switches::kClientLoginToOAuth2Url, | 111 GetSwitchValueWithDefault(switches::kClientLoginToOAuth2Url, |
110 kClientLoginToOAuth2Url, | 112 kClientLoginToOAuth2Url, |
111 &client_login_to_oauth2_url_); | 113 &client_login_to_oauth2_url_); |
112 GetSwitchValueWithDefault(switches::kOAuth2TokenUrl, | 114 GetSwitchValueWithDefault(switches::kOAuth2TokenUrl, |
113 kOAuth2TokenUrl, | 115 kOAuth2TokenUrl, |
114 &oauth2_token_url_); | 116 &oauth2_token_url_); |
115 GetSwitchValueWithDefault(switches::kOAuth2IssueTokenUrl, | 117 GetSwitchValueWithDefault(switches::kOAuth2IssueTokenUrl, |
116 kOAuth2IssueTokenUrl, | 118 kOAuth2IssueTokenUrl, |
117 &oauth2_issue_token_url_); | 119 &oauth2_issue_token_url_); |
| 120 GetSwitchValueWithDefault(switches::kOAuthUserInfoUrl, |
| 121 kOAuthUserInfoUrl, |
| 122 &oauth_user_info_url_); |
118 | 123 |
119 gaia_login_form_realm_ = "https://accounts.google.com/"; | 124 gaia_login_form_realm_ = "https://accounts.google.com/"; |
120 } | 125 } |
121 | 126 |
122 GaiaUrls::~GaiaUrls() { | 127 GaiaUrls::~GaiaUrls() { |
123 } | 128 } |
124 | 129 |
125 const std::string& GaiaUrls::captcha_url_prefix() { | 130 const std::string& GaiaUrls::captcha_url_prefix() { |
126 return captcha_url_prefix_; | 131 return captcha_url_prefix_; |
127 } | 132 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 212 } |
208 | 213 |
209 const std::string& GaiaUrls::oauth2_issue_token_url() { | 214 const std::string& GaiaUrls::oauth2_issue_token_url() { |
210 return oauth2_issue_token_url_; | 215 return oauth2_issue_token_url_; |
211 } | 216 } |
212 | 217 |
213 | 218 |
214 const std::string& GaiaUrls::gaia_login_form_realm() { | 219 const std::string& GaiaUrls::gaia_login_form_realm() { |
215 return gaia_login_form_realm_; | 220 return gaia_login_form_realm_; |
216 } | 221 } |
OLD | NEW |