| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 { |
| 11 | 11 |
| 12 const char kDefaultGaiaBaseUrl[] = "www.google.com"; | 12 const char kDefaultGaiaBaseUrl[] = "www.google.com"; |
| 13 const char kCaptchaUrlPrefixSuffix[] = "/accounts/"; | 13 const char kCaptchaUrlPrefixSuffix[] = "/accounts/"; |
| 14 const char kClientLoginUrlSuffix[] = "/accounts/ClientLogin"; | 14 const char kClientLoginUrlSuffix[] = "/accounts/ClientLogin"; |
| 15 const char kIssueAuthTokenUrlSuffix[] = "/accounts/IssueAuthToken"; | 15 const char kIssueAuthTokenUrlSuffix[] = "/accounts/IssueAuthToken"; |
| 16 const char kGetUserInfoUrlSuffix[] = "/accounts/GetUserInfo"; | 16 const char kGetUserInfoUrlSuffix[] = "/accounts/GetUserInfo"; |
| 17 const char kTokenAuthUrlSuffix[] = "/accounts/TokenAuth"; | 17 const char kTokenAuthUrlSuffix[] = "/accounts/TokenAuth"; |
| 18 const char kMergeSessionUrlSuffix[] = "/accounts/MergeSession"; |
| 18 | 19 |
| 19 } // namespacce | 20 } // namespacce |
| 20 | 21 |
| 21 GaiaUrls* GaiaUrls::GetInstance() { | 22 GaiaUrls* GaiaUrls::GetInstance() { |
| 22 return Singleton<GaiaUrls>::get(); | 23 return Singleton<GaiaUrls>::get(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 GaiaUrls::GaiaUrls() { | 26 GaiaUrls::GaiaUrls() { |
| 26 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 27 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 27 if (command_line->HasSwitch(switches::kGaiaHost)) { | 28 if (command_line->HasSwitch(switches::kGaiaHost)) { |
| 28 host_base_ = command_line->GetSwitchValueASCII(switches::kGaiaHost); | 29 host_base_ = command_line->GetSwitchValueASCII(switches::kGaiaHost); |
| 29 } else { | 30 } else { |
| 30 host_base_ = kDefaultGaiaBaseUrl; | 31 host_base_ = kDefaultGaiaBaseUrl; |
| 31 } | 32 } |
| 32 | 33 |
| 33 captcha_url_prefix_ = "http://" + host_base_ + kCaptchaUrlPrefixSuffix; | 34 captcha_url_prefix_ = "http://" + host_base_ + kCaptchaUrlPrefixSuffix; |
| 34 client_login_url_ = "https://" + host_base_ + kClientLoginUrlSuffix; | 35 client_login_url_ = "https://" + host_base_ + kClientLoginUrlSuffix; |
| 35 issue_auth_token_url_ = "https://" + host_base_ + kIssueAuthTokenUrlSuffix; | 36 issue_auth_token_url_ = "https://" + host_base_ + kIssueAuthTokenUrlSuffix; |
| 36 get_user_info_url_ = "https://" + host_base_ + kGetUserInfoUrlSuffix; | 37 get_user_info_url_ = "https://" + host_base_ + kGetUserInfoUrlSuffix; |
| 37 token_auth_url_ = "https://" + host_base_ + kTokenAuthUrlSuffix; | 38 token_auth_url_ = "https://" + host_base_ + kTokenAuthUrlSuffix; |
| 39 merge_session_url_ = "https://" + host_base_ + kMergeSessionUrlSuffix; |
| 38 } | 40 } |
| 39 | 41 |
| 40 GaiaUrls::~GaiaUrls() { | 42 GaiaUrls::~GaiaUrls() { |
| 41 } | 43 } |
| 42 | 44 |
| 43 const std::string& GaiaUrls::captcha_url_prefix() { | 45 const std::string& GaiaUrls::captcha_url_prefix() { |
| 44 return captcha_url_prefix_; | 46 return captcha_url_prefix_; |
| 45 } | 47 } |
| 46 | 48 |
| 47 const std::string& GaiaUrls::client_login_url() { | 49 const std::string& GaiaUrls::client_login_url() { |
| 48 return client_login_url_; | 50 return client_login_url_; |
| 49 } | 51 } |
| 50 | 52 |
| 51 const std::string& GaiaUrls::issue_auth_token_url() { | 53 const std::string& GaiaUrls::issue_auth_token_url() { |
| 52 return issue_auth_token_url_; | 54 return issue_auth_token_url_; |
| 53 } | 55 } |
| 54 | 56 |
| 55 const std::string& GaiaUrls::get_user_info_url() { | 57 const std::string& GaiaUrls::get_user_info_url() { |
| 56 return get_user_info_url_; | 58 return get_user_info_url_; |
| 57 } | 59 } |
| 58 | 60 |
| 59 const std::string& GaiaUrls::token_auth_url() { | 61 const std::string& GaiaUrls::token_auth_url() { |
| 60 return token_auth_url_; | 62 return token_auth_url_; |
| 61 } | 63 } |
| 64 |
| 65 const std::string& GaiaUrls::merge_session_url() { |
| 66 return merge_session_url_; |
| 67 } |
| OLD | NEW |