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 kDefaultGaiaUrl[] = "https://accounts.google.com"; | 17 const char kDefaultGaiaUrl[] = "https://accounts.google.com"; |
17 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; | 18 const char kDefaultGoogleApisBaseUrl[] = "https://www.googleapis.com"; |
18 | 19 |
19 // API calls from accounts.google.com | 20 // API calls from accounts.google.com |
20 const char kClientLoginUrlSuffix[] = "ClientLogin"; | 21 const char kClientLoginUrlSuffix[] = "ClientLogin"; |
21 const char kServiceLoginUrlSuffix[] = "ServiceLogin"; | 22 const char kServiceLoginUrlSuffix[] = "ServiceLogin"; |
22 const char kEmbeddedSetupChromeOsUrlSuffix[] = "embedded/setup/chromeos"; | 23 const char kEmbeddedSetupChromeOsUrlSuffix[] = "embedded/setup/chromeos"; |
23 const char kServiceLoginAuthUrlSuffix[] = "ServiceLoginAuth"; | 24 const char kServiceLoginAuthUrlSuffix[] = "ServiceLoginAuth"; |
24 const char kServiceLogoutUrlSuffix[] = "Logout"; | 25 const char kServiceLogoutUrlSuffix[] = "Logout"; |
25 const char kIssueAuthTokenUrlSuffix[] = "IssueAuthToken"; | 26 const char kIssueAuthTokenUrlSuffix[] = "IssueAuthToken"; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 70 } |
70 | 71 |
71 | 72 |
72 } // namespace | 73 } // namespace |
73 | 74 |
74 GaiaUrls* GaiaUrls::GetInstance() { | 75 GaiaUrls* GaiaUrls::GetInstance() { |
75 return Singleton<GaiaUrls>::get(); | 76 return Singleton<GaiaUrls>::get(); |
76 } | 77 } |
77 | 78 |
78 GaiaUrls::GaiaUrls() { | 79 GaiaUrls::GaiaUrls() { |
| 80 google_url_ = GetURLSwitchValueWithDefault(switches::kGoogleUrl, |
| 81 kDefaultGoogleUrl); |
79 gaia_url_ = GetURLSwitchValueWithDefault(switches::kGaiaUrl, kDefaultGaiaUrl); | 82 gaia_url_ = GetURLSwitchValueWithDefault(switches::kGaiaUrl, kDefaultGaiaUrl); |
80 lso_origin_url_ = | 83 lso_origin_url_ = |
81 GetURLSwitchValueWithDefault(switches::kLsoUrl, kDefaultGaiaUrl); | 84 GetURLSwitchValueWithDefault(switches::kLsoUrl, kDefaultGaiaUrl); |
82 google_apis_origin_url_ = GetURLSwitchValueWithDefault( | 85 google_apis_origin_url_ = GetURLSwitchValueWithDefault( |
83 switches::kGoogleApisUrl, kDefaultGoogleApisBaseUrl); | 86 switches::kGoogleApisUrl, kDefaultGoogleApisBaseUrl); |
84 | 87 |
85 captcha_base_url_ = | 88 captcha_base_url_ = |
86 GURL("http://" + gaia_url_.host() + | 89 GURL("http://" + gaia_url_.host() + |
87 (gaia_url_.has_port() ? ":" + gaia_url_.port() : "")); | 90 (gaia_url_.has_port() ? ":" + gaia_url_.port() : "")); |
88 | 91 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); | 133 google_apis_origin_url_.Resolve(kOAuth2TokenInfoUrlSuffix); |
131 oauth_user_info_url_ = | 134 oauth_user_info_url_ = |
132 google_apis_origin_url_.Resolve(kOAuthUserInfoUrlSuffix); | 135 google_apis_origin_url_.Resolve(kOAuthUserInfoUrlSuffix); |
133 | 136 |
134 gaia_login_form_realm_ = gaia_url_; | 137 gaia_login_form_realm_ = gaia_url_; |
135 } | 138 } |
136 | 139 |
137 GaiaUrls::~GaiaUrls() { | 140 GaiaUrls::~GaiaUrls() { |
138 } | 141 } |
139 | 142 |
| 143 const GURL& GaiaUrls::google_url() const { |
| 144 return google_url_; |
| 145 } |
| 146 |
140 const GURL& GaiaUrls::gaia_url() const { | 147 const GURL& GaiaUrls::gaia_url() const { |
141 return gaia_url_; | 148 return gaia_url_; |
142 } | 149 } |
143 | 150 |
144 const GURL& GaiaUrls::captcha_base_url() const { | 151 const GURL& GaiaUrls::captcha_base_url() const { |
145 return captcha_base_url_; | 152 return captcha_base_url_; |
146 } | 153 } |
147 | 154 |
148 const GURL& GaiaUrls::client_login_url() const { | 155 const GURL& GaiaUrls::client_login_url() const { |
149 return client_login_url_; | 156 return client_login_url_; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 base::StringPrintf("?source=%s&%s", source.c_str(), query.c_str())); | 270 base::StringPrintf("?source=%s&%s", source.c_str(), query.c_str())); |
264 } | 271 } |
265 } | 272 } |
266 | 273 |
267 GURL GaiaUrls::GetCheckConnectionInfoURLWithSource(const std::string& source) { | 274 GURL GaiaUrls::GetCheckConnectionInfoURLWithSource(const std::string& source) { |
268 return source.empty() | 275 return source.empty() |
269 ? get_check_connection_info_url_ | 276 ? get_check_connection_info_url_ |
270 : get_check_connection_info_url_.Resolve( | 277 : get_check_connection_info_url_.Resolve( |
271 base::StringPrintf("?source=%s", source.c_str())); | 278 base::StringPrintf("?source=%s", source.c_str())); |
272 } | 279 } |
OLD | NEW |